Ejemplo n.º 1
0
 public Bmp280(I2cDevice i2cDevice)
 {
     _i2cDevice             = i2cDevice;
     _deviceId              = DeviceId;
     _calibrationData       = new CalibrationData();
     _communicationProtocol = CommunicationProtocol.I2c;
 }
Ejemplo n.º 2
0
        internal void Begin()
        {
            _i2cDevice.WriteByte((byte)Register.CHIPID);
            byte readSignature = _i2cDevice.ReadByte();

            if (readSignature != _deviceId)
            {
                throw new Exception($"Device ID {readSignature} is not the same as expected {_deviceId}. Please check you are using the right device.");
            }
            _initialized = true;

            //Read the coefficients table
            CalibrationData = ReadCalibrationData();
        }