示例#1
0
        public bool SetAllPortState(byte ctrlState)
        {
            bool retVal = SimpleIOClass.WritePort((uint)ctrlState);

            if (retVal)
            {
                _ioStateMap = ctrlState;
            }

            return(retVal);
        }
示例#2
0
        public void SetPortMode(uint port, CtrlMode mode)
        {
            if (mode == CtrlMode.Output)
            {
                _ioModeMap = (byte)(_ioModeMap & ~PortMask[port]);
            }
            else
            {
                _ioModeMap |= PortMask[port];
            }

            SimpleIOClass.ConfigureIO(_ioModeMap);
            SimpleIOClass.WritePort(_ioStateMap);
        }
示例#3
0
        public void SetPortState(uint port, CtrlState state)
        {
            if ((_ioModeMap & PortMask[port]) == PortMask[port])
            {
                throw new ArgumentException("Port must be in output state to be set.", "port");
            }

            if (state == CtrlState.High)
            {
                _ioStateMap |= PortMask[port];
            }
            else
            {
                _ioStateMap &= (byte)~PortMask[port];
            }

            SimpleIOClass.WritePort(_ioStateMap);
        }