API Documentation
LPS22
Lps22Device
The class Lps22DeviceBase implements the low level interface of the sensor. The class Lps22Device extends the Lps22DeviceBase. It provides additional functions to ease the use of the sensor.
- class sensirion_i2c_lps22.device.Lps22DeviceBase(channel)[source]
Low level API implementation of LPS22
- property channel
- get_ctrl_reg1()[source]
Get the control register 1. See datasheet for description of the options.
- Return register_value
- set_ctrl_reg1(register_value)[source]
Set the control register 1. See datasheet for description of the options.
- Parameters
register_value –
- get_ctrl_reg2()[source]
Get the control register 3. See datasheet for description of the options.
- Return register_value
- set_ctrl_reg2(register_value)[source]
Set the control register 2. See datasheet for description of the options.
- Parameters
register_value –
- get_ctrl_reg3()[source]
Get the control register 3. See datasheet for description of the options.
- Return register_value
- set_ctrl_reg3(register_value)[source]
Set the control register 3. See datasheet for description of the options.
- Parameters
register_value –
- read_pressure()[source]
Read current pressure in register auto increment mode. The value returned is a two’s complement and has a scale factor of 4096 to convert to hPa.
- Return pressure
pressurer, three bytes in little endian order
- read_temperature_l()[source]
Read temperature measurement from register, LOW byte
- Return temperature_l
temperature low byte
- read_temperature_h()[source]
Read temperature measurement from register, high byte
- Return temperature_h
temperature high byte
- class sensirion_i2c_lps22.device.Lps22Device(channel)[source]
Driver class implementation of LPS22
- lps22
Access to base class
- get_ctrl_reg1()[source]
Get control register 1. See datasheet for details about the bitfields.
- Return register_value
- get_ctrl_reg2()[source]
Get control register 2. See datasheet for details about the bitfields.
- Return register_value
- get_ctrl_reg3()[source]
Get control register 3. See datasheet for details about the bitfields.
- Return register_value
- activate_multi_byte_read()[source]
Register address is automatically incremented during a multiple byte read access.
- deactivate_multi_byte_read()[source]
Disable that Register address is automatically incremented. If this is disabled, use single-byte read functions.
- power_down_mode()[source]
Switch to power down mode. In this mode one shot measurements can be done.
- stop_continious_measurement()[source]
Stop any running continious measurement. Sensor is in power down mode afterwards.
- start_one_shot_measurement()[source]
Start a one-shot measurement. Use read_pressure and read_temperature to get sensor values.
- start_continious_measurement(measurement_frequency)[source]
Start continious measurement with given frequency. Available frequencies depend on the version of your LPS22 sensor, please check the datasheet for more details. Use read_pressure_single_bytes and read_temperature_signle_bytes to get sensor values as the multi byte read option is disabled when using the continious measurement.
- Parameters
measurement_frequency –
- read_pressure()[source]
Read pressure value with multi byte read. Make sure you have the sensor in correct mode by runnin activate_multi_byte_read()
- Return a_pressure
measured pressure in hPa
- read_pressure_single_bytes()[source]
Read temperature measurement from registers in single byte read mode.
- Return a_pressure
measured pressure in hPa
- read_temperature()[source]
Read temperature value with multi byte read. Make sure you have the sensor in correct mode by running activate_multi_byte_read()
- Return a_temperature
measured temperature in degC
Commands
The transfer classes specify the data that is transferred between host and sensor. The generated transfer classes are used by the driver class and not intended for direct use.
- class sensirion_i2c_lps22.commands.Whoami[source]
Get the chip id.
- CMD_ID = 15
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.Status[source]
Get the status bit. See datasheet for description of the bits.
- CMD_ID = 39
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.GetCtrlReg1[source]
Get the control register 1. See datasheet for description of the options.
- CMD_ID = 16
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.SetCtrlReg1(register_value)[source]
Set the control register 1. See datasheet for description of the options.
- CMD_ID = 16
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_i2c_lps22.commands.GetCtrlReg2[source]
Get the control register 3. See datasheet for description of the options.
- CMD_ID = 17
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.SetCtrlReg2(register_value)[source]
Set the control register 2. See datasheet for description of the options.
- CMD_ID = 17
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_i2c_lps22.commands.GetCtrlReg3[source]
Get the control register 3. See datasheet for description of the options.
- CMD_ID = 18
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.SetCtrlReg3(register_value)[source]
Set the control register 3. See datasheet for description of the options.
- CMD_ID = 18
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_i2c_lps22.commands.ReadPressureOutXl[source]
Read current pressure from register, LSB
- CMD_ID = 40
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.ReadPressureOutL[source]
Read current pressure from register, middle byte
- CMD_ID = 41
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.ReadPressureOutH[source]
Read current pressure from register, MSB
- CMD_ID = 42
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.ReadPressure[source]
Read current pressure in register auto increment mode. The value returned is a two’s complement and has a scale factor of 4096 to convert to hPa.
- CMD_ID = 40
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.ReadTemperatureL[source]
Read temperature measurement from register, LOW byte
- CMD_ID = 43
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.ReadTemperatureH[source]
Read temperature measurement from register, high byte
- CMD_ID = 44
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.ReadTemperature[source]
Read current temperature from registers in auto increment mode. The value returned has a scale factor of 100 to convert to degC.
- CMD_ID = 43
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- rx = <sensirion_driver_adapters.rx_tx_data.RxData object>
- class sensirion_i2c_lps22.commands.ResetLowPass[source]
Low-pass filter reset. If the LPFP is active, in order to avoid the transitory phase, the filter can be reset by reading this register before generating pressure measurements.
- CMD_ID = 51
- tx = <sensirion_driver_adapters.rx_tx_data.TxData object>
- class sensirion_i2c_lps22.commands.CtrlRegOneT(int_value: int = 0)[source]
- ODR = BitField(offset=4, width=3)
- EN_LPFP = BitField(offset=3, width=1)
- LPFP_CFG = BitField(offset=2, width=1)
- BDU = BitField(offset=1, width=1)
- class sensirion_i2c_lps22.commands.CtrlRegTwoT(int_value: int = 0)[source]
- BOOT = BitField(offset=7, width=1)
- FIFO_EN = BitField(offset=6, width=1)
- STOP_ON_FTH = BitField(offset=5, width=1)
- IF_ADD_INC = BitField(offset=4, width=1)
- SWRESET = BitField(offset=2, width=1)
- ONE_SHOT = BitField(offset=0, width=1)
- class sensirion_i2c_lps22.commands.CtrlRegThreeT(int_value: int = 0)[source]
- INT_H_L = BitField(offset=7, width=1)
- PP_OD = BitField(offset=6, width=1)
- F_FSS5 = BitField(offset=5, width=1)
- F_FTH = BitField(offset=4, width=1)
- F_OVR = BitField(offset=3, width=1)
- DRDY = BitField(offset=2, width=1)
- INT_S2 = BitField(offset=1, width=2)
Result Types
The signal classes specify transformations of the raw sensor signals into a meaningful units. The generated signal types are used by the driver class and not intended for direct use.