//Method to read the caliberation data from the registers private Bme280CalibrationData ReadCoefficeints() { // 16 bit calibration data is stored as Little Endian, the helper method will do the byte swap. _calibrationData = new Bme280CalibrationData(); // Read temperature calibration data _calibrationData.DigT1 = (ushort)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_T1, 2); _calibrationData.DigT2 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_T2, 2); _calibrationData.DigT3 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_T3, 2); // Read presure calibration data _calibrationData.DigP9 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_P9, 2); _calibrationData.DigP8 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_P8, 2); _calibrationData.DigP7 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_P7, 2); _calibrationData.DigP6 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_P6, 2); _calibrationData.DigP5 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_P5, 2); _calibrationData.DigP4 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_P4, 2); _calibrationData.DigP3 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_P3, 2); _calibrationData.DigP2 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_P2, 2); _calibrationData.DigP1 = (ushort)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_P1, 2); // Read humidity calibration data _calibrationData.DigH1 = (byte)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_H1); _calibrationData.DigH2 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_H2, 2); _calibrationData.DigH3 = (byte)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_H3); short e4 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_H4_L); // Read 0xE4 short e5 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_H4_H); // Read 0xE5 short e6 = (short)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_H5_H); // Read 0xE6 _calibrationData.DigH6 = (sbyte)_bme280.ReadValue((byte)ERegisters.BME280_REGISTER_DIG_H6); _calibrationData.DigH4 = (short)((e4 << 4) + (e5 & 0x0F)); _calibrationData.DigH5 = (short)((e5 >> 4) + (e6 << 4)); return(_calibrationData); }