10#ifdef SENSOR_BAR_ILS22QS
21#define ILPS22QS_I2C_ADDR (0x5C << 1)
24#define REG_WHO_AM_I 0x0F
25#define REG_CTRL_REG1 0x10
26#define REG_PRESS_OUT_XL 0x28
27#define REG_PRESS_OFFSET 0x1A
29#define ILPS22QS_ID 0xB4
37 HAL_StatusTypeDef status = HAL_ERROR;
46 *onOff = ((ctrl1 & 0x50) != 0);
54 HAL_StatusTypeDef status = HAL_ERROR;
60 uint8_t ctrl1 = onOff;
82 const uint8_t val = 0b00011010;
105 if (status == HAL_OK)
132 HAL_StatusTypeDef status = HAL_ERROR;
143 status = HAL_TIMEOUT;
157 int32_t raw_press = (int32_t) ((uint32_t) raw_data[2] << 16 | (uint32_t) raw_data[1] << 8 | raw_data[0]);
159 if (raw_press & 0x800000)
160 raw_press |= 0xFF000000;
165 int16_t raw_temp = (int16_t) ((uint16_t) raw_data[4] << 8 | raw_data[3]);
static uint8_t _isBarometer
int8_t bar_ils22qs_Is(I2C_HandleTypeDef *hi2c, int8_t tryInit)
Check if the ILPS22QS barometric pressure sensor is present on the I2C bus.
HAL_StatusTypeDef bar_ils22qs_Init(I2C_HandleTypeDef *hi2c)
Initialise the ILPS22QS sensor and verify it is present on the I2C bus. The sensor is put into low-po...
HAL_StatusTypeDef bar_ils22qs_Read(I2C_HandleTypeDef *hi2c)
read value from sensor, pressure and temperature. Sensor must be turned on before
#define ILPS22QS_I2C_ADDR
static HAL_StatusTypeDef bar_ils22qs_IsOn(I2C_HandleTypeDef *hi2c, uint8_t *onOff)
static HAL_StatusTypeDef barometer_onOff(I2C_HandleTypeDef *hi2c, uint8_t onOff)
HAL_StatusTypeDef bar_ils22qs_On(I2C_HandleTypeDef *hi2c)
turn on sensor
void bar_ils22qs_LogData(char *buf)
log data to buffer
HAL_StatusTypeDef bar_ils22qs_Off(I2C_HandleTypeDef *hi2c)
turn off sensor
bar_ils22qs_t _bar_ils22qsData
Live measurement data from the ILPS22QS sensor; updated by bar_ils22qs_Read().
bar_ils22qs_t _bck_bar_ils22qsData
Snapshot copy of the last completed ILPS22QS measurement; used for LoRaWAN transmission.
This file contains all the function prototypes for the i2c.c file.
HAL_StatusTypeDef I2C_IsDeviceReadyMT(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout)
Wrapper around HAL_I2C_IsDeviceReady() that recovers from a busy bus. If the HAL I2C bus is in a BUSY...
#define PRIf_02D(fData)
Expands to integer and fractional arguments for use with PRIf_02. Splits a float/double into the inte...
#define PRIf_02
printf format string for printing a float/double as integer with 2 decimal places....
mems_MainBlock_t _memsMainBlock
Global instance of the main flash control block; loaded by mems_ReadMainBlock().
HAL_StatusTypeDef mems_WriteMainBlock()
writing the main block on flash. The main block is stored on address 0
systemParams_t _systemParams
Measurement data produced by the ILPS22QS barometric pressure sensor. Populated by bar_ils22qs_Read()...
tmphm_sht45_t _tmphm_sht45Data
Live measurement data from the SHT45 sensor; updated by tmphm_sht45_Read().