Пример #1
0
        public byte ReadRegister(byte addr)
        {
            switch (addr)
            {
            case UARTDATA:
            {
                byte data;
                if (_attachedDevice.ReadByte(out data))
                {
                    return(data);
                }
                return(0);
            }

            case UARTSTAT:
                return((byte)((_attachedDevice.WasReceived() ? 1 : 0) << 7 | (_attachedDevice.IsSending() ? 1 : 0) << 6));

            default:
                throw new Exception("UART: Reading invalid register " + addr);
            }
        }