Example #1
0
        public byte ReceiveByte(bool ACK)
        {
            // Clock in one data byte
            MpsseCommand.BytesInOnPlusEdgeWithMsbFirst(1);
            _mpsse.Enqueue(CommandCode.BytesInOnPlusEdgeWithMsbFirst, 0x00, 0x00);

            // clock out one bit as ack/nak bit
            var ack = ACK ? 0x00 : 0xFF;

            _mpsse.Enqueue(CommandCode.BitsOutOnMinusEdgeWithMsbFirst, 0x00, (byte)ack);

            // I2C lines back to idle state
            _mpsse.AdBusValue.SetBit(1).UnsetBit(0);
            _mpsse.AdBusDirection.SetBit(1).SetBit(1);
            _mpsse.Enqueue(MpsseCommand.SetDataBitsLowByte(_mpsse.AdBusValue, _mpsse.AdBusDirection));

            // This command then tells the MPSSE to send any results gathered back immediately
            _mpsse.Enqueue(MpsseCommand.SendImmediate());

            // Execute
            _mpsse.ExecuteBuffer();

            // Result
            var result = _mpsse.read(1);

            return(result[0]);
        }
Example #2
0
        public byte GetHighGpio()
        {
            _mpsse.Enqueue(MpsseCommand.ReadDataBitsHighByte());
            _mpsse.ExecuteBuffer();

            // Result
            var result = _mpsse.read(1);

            return(result[0]);
        }