コード例 #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);
            }
        }
コード例 #2
0
        public static BoardDigest FromHardware(WiseBoard board)
        {
            BoardDigest ret = new BoardDigest()
            {
                Daqs = new List <DaqDigest>(),
            };

            foreach (WiseDaq daq in board.daqs)
            {
                ret.Daqs.Add(DaqDigest.FromHardware(daq));
            }

            return(ret);
        }
コード例 #3
0
        public void init()
        {
            if (_initialized)
            {
                return;
            }

            int wantedBoards = 3;        // We always have three boards, either real or simulated
            int maxMccBoards;

            if (!Simulated)
            {
                MccService.GetRevision(out mccRevNum, out mccVxdRevNum);
                MccService.ErrHandling(MccDaq.ErrorReporting.DontPrint, MccDaq.ErrorHandling.DontStop);
                maxMccBoards = MccDaq.GlobalConfig.NumBoards;

                // get the real Mcc boards
                for (int i = 0; i < maxMccBoards; i++)
                {
                    int type;

                    MccDaq.MccBoard board = new MccDaq.MccBoard(i);
                    board.BoardConfig.GetBoardType(out type);
                    if (type != 0)
                    {
                        WiseBoards.Add(new WiseBoard(board));
                    }
                }
            }

            // Add simulated boards, as needed
            for (int i = WiseBoards.Count; i < wantedBoards; i++)
            {
                WiseBoards.Add(new WiseBoard(null, i));
            }

            domeboard = WiseBoards.Find(x => x.mccBoard.BoardNum == 0);
            teleboard = WiseBoards.Find(x => x.mccBoard.BoardNum == 1);
            miscboard = WiseBoards.Find(x => x.mccBoard.BoardNum == 2);

            if (computerControlPin == null)
            {
                computerControlPin = new WisePin("CompControl", teleboard, DigitalPortType.SecondPortCH, 0, DigitalPortDirection.DigitalIn);
                computerControlPin.Connect(true);
            }

            _initialized = true;
        }
コード例 #4
0
        public static BoardMetaDigest FromHardware(WiseBoard board)
        {
            BoardMetaDigest ret = new BoardMetaDigest()
            {
                Number = board.boardNum,
                Type   = board.type,
                Name   = board.WiseName,
                Daqs   = new List <DaqMetaDigest>(),
            };

            foreach (WiseDaq daq in board.daqs)
            {
                ret.Daqs.Add(DaqMetaDigest.FromHardware(daq));
            }

            return(ret);
        }
コード例 #5
0
        public WiseDaq(WiseBoard wiseBoard, int devno)
        {
            int porttype;

            this.wiseBoard = wiseBoard;
            if (wiseBoard.type == WiseBoard.BoardType.Soft)
            {
                porttype = (int)DigitalPortType.FirstPortA + devno;
                WiseName = "Board" + wiseBoard.boardNum.ToString() + "." + ((DigitalPortType)porttype).ToString();
                _value   = 0;
                switch (devno % 4)
                {
                case 0: nbits = 8; break;       // XXX-PortA

                case 1: nbits = 8; break;       // XXX-PortB

                case 2: nbits = 4; break;       // XXX-PortCL

                case 3: nbits = 4; break;       // XXX-PortCH
                }
            }
            else
            {
                MccDaq.ErrorInfo err;

                err      = wiseBoard.mccBoard.DioConfig.GetDevType(devno, out porttype);
                err      = wiseBoard.mccBoard.DioConfig.GetNumBits(devno, out nbits);
                WiseName = "Board" + wiseBoard.mccBoard.BoardNum.ToString() + "." + ((DigitalPortType)porttype).ToString();
            }

            this.porttype = (DigitalPortType)porttype;
            _mask         = (ushort)((nbits == 8) ? 0xff : 0xf);
            owners        = new WiseBitOwner[nbits];
            for (int i = 0; i < nbits; i++)
            {
                owners[i] = new WiseBitOwner();
            }
        }