Example #1
0
        private void I2CSendBit(bool bit)
        {
            if (bit)
            {
                _sda.On();
            }
            else
            {
                _sda.Off();
            }

            I2CSleep();

            do
            {
                _scl.On();
            } while (!_scl.Read()); // wait for clock stretching

            I2CSleep();

            _scl.Off();
        }
Example #2
0
        private bool I2CReadBit()
        {
            _sda.AsInput();
            I2CSleep();

            do
            {
                _scl.On();
            } while (!_scl.Read()); // wait for clock stretching

            I2CSleep();

            var result = _sda.Read();

            _scl.Off();

            return(result);
        }