Example #1
0
        public WisePin(string name,
                       WiseBoard brd,
                       DigitalPortType port,
                       int bit,
                       DigitalPortDirection dir,
                       bool inverse = false,
                       Const.Direction direction = Const.Direction.None,
                       bool controlled           = false)
        {
            this.WiseName = name +
                            "@Board" +
                            (brd.type == WiseBoard.BoardType.Hard ? brd.mccBoard.BoardNum : brd.boardNum) +
                            port.ToString() +
                            "[" + bit.ToString() + "]";

            if ((daq = brd.daqs.Find(x => x.porttype == port)) == null)
            {
                throw new WiseException(this.WiseName + ": Invalid Daq spec, no " + port + " on this board");
            }
            this.dir         = dir;
            this.bit         = bit;
            this.inverse     = inverse;
            this._direction  = direction;
            this._controlled = controlled;
            daq.setDir(dir);
            if (daq.owners != null && daq.owners[bit].owner == null)
            {
                daq.setOwner(name, bit);
            }
        }
Example #2
0
 public void Connect(bool connected)
 {
     if (connected)
     {
         daq.setOwner(WiseName, bit);
     }
     else
     {
         daq.unsetOwner(bit);
     }
     _connected = connected;
 }