18#define LPS22DF_TEMP_SENSITIVITY (1.0f / 100)
19#define LPS22DF_PRESS_SENSITIVITY (100.0f / 4096)
21#define LPS22DF_CTRL_REG1 0x10
22#define LPS22DF_CTRL_REG2 0x11
23#define LPS22DF_CTRL_REG3 0x12
24#define LPS22DF_CTRL_REG4 0x13
26#define LPS22DF_RPDS_L 0x1A
27#define LPS22DF_RPDS_H 0x1B
29#define LPS22DF_PRESS_OUT_XL 0x28
30#define LPS22DF_PRESS_OUT_L 0x29
31#define LPS22DF_PRESS_OUT_H 0x2A
33#define LPS22DF_TEMP_OUT_L 0x2B
34#define LPS22DF_TEMP_OUT_H 0x2C
36#define LPS22DF_CTRL_REG1_ODR_OFF 0x00
37#define LPS22DF_CTRL_REG1_ODR_1 0x08
38#define LPS22DF_CTRL_REG1_ODR_4 0x10
39#define LPS22DF_CTRL_REG1_ODR_10 0x18
40#define LPS22DF_CTRL_REG1_ODR_25 0x20
41#define LPS22DF_CTRL_REG1_ODR_50 0x28
42#define LPS22DF_CTRL_REG1_ODR_75 0x30
43#define LPS22DF_CTRL_REG1_ODR_100 0x38
44#define LPS22DF_CTRL_REG1_ODR_200 0x40
46#define LPS22DF_CTRL_REG1_AVG_4 0x00
47#define LPS22DF_CTRL_REG1_AVG_8 0x01
48#define LPS22DF_CTRL_REG1_AVG_16 0x02
49#define LPS22DF_CTRL_REG1_AVG_32 0x03
50#define LPS22DF_CTRL_REG1_AVG_64 0x04
51#define LPS22DF_CTRL_REG1_AVG_128 0x05
52#define LPS22DF_CTRL_REG1_AVG_512 0x07
54#define LPS22DF_CTRL_REG2_BDU 0x08
55#define LPS22DF_CTRL_REG2_SWRESET 0x04
57#define LPS22DF_PRESS_DATA_SIZE 3
58#define LPS22DF_TEMP_DATA_SIZE 2
59#define LPS22DF_DATA_COUNT 2
60#define LPS22DF_DATA_TOTAL (LPS22DF_TEMP_DATA_SIZE + LPS22DF_PRESS_DATA_SIZE)
69typedef struct LPS22DF {
73 float pressSensitivity;
74 float tempSensitivity;
75 uint8_t rawTemp[LPS22DF_PRESS_DATA_SIZE];
76 uint8_t rawPress[LPS22DF_TEMP_DATA_SIZE];
Defines the API for the Barometer sensor.
Struct definition for a GPIO pin.
void LPS22DF_readRawPress(Baro_t *, uint8_t *)
void LPS22DF_readPress(Baro_t *, float *)
void LPS22DF_processRawTemp(Baro_t *, uint8_t *, float *)
Processes raw temperature data from LPS22DF sensor.
void LPS22DF_readTemp(Baro_t *, float *)
Read the temperature from the LPS22DF sensor.
void LPS22DF_processRawPress(Baro_t *, uint8_t *, float *)
void LPS22DF_readRawTemp(Baro_t *, uint8_t *)
LPS22DF_t LPS22DF_init(LPS22DF_t *, SPI_t *, GPIOpin_t, const float, const float)
Initialiser for a LPS22DF barometer.
void LPS22DF_update(Baro_t *)
Updates the LPS22DF barometer readings.
Struct definition for SPI interface. Provides the interface for API consumers to interact with the SP...