fusion_hat.modules.bmp180 module

class fusion_hat.modules.bmp180.BMP180(bus: smbus2.SMBus, oversampling=3)[source]

Bases: object

BMP180 pressure/temperature sensor driver class Used to measure atmospheric pressure and temperature, and can calculate altitude This is a concise implementation version that uses floating-point calculations to improve accuracy

ADDR = 119
REG_CAL = 170
REG_CTRL = 244
REG_DATA = 246
CMD_TEMP = 46
CMD_PRES_BASE = 52
_readS16(reg)[source]

Read a signed 16-bit integer from the specified register

Parameters:

reg – register address

Returns:

converted signed 16-bit integer value

Return type:

int

_readU16(reg)[source]

Read an unsigned 16-bit integer from the specified register

Parameters:

reg – register address

Returns:

converted unsigned 16-bit integer value

Return type:

int

_read_calibration()[source]

Read calibration parameters of the sensor Each BMP180 chip has unique calibration parameters stored in internal EEPROM These parameters are used to compensate for individual differences of the sensor

_read_raw_temp()[source]

Read raw temperature value Trigger temperature conversion and wait for completion, then read the result

Returns:

raw temperature value (16-bit unsigned integer)

Return type:

int

_read_raw_pressure()[source]

Read raw pressure value Trigger pressure conversion and wait for completion, then read the result

Returns:

raw pressure value (16-bit unsigned integer)

Return type:

int

read()[source]

Read and calculate temperature, pressure, and altitude Use standard formulas provided in BMP180 datasheet

Returns:

(temperature(°C), pressure(Pa), altitude(m))

Return type:

tuple