L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
bar_ils22qs.h
Go to the documentation of this file.
1/*
2 * bar_ils22qs.h
3 *
4 * Created on: 27. 12. 2025
5 * Author: Milan
6 *
7 * Barometer 8 Click, ILPS22QS.pdf datasheet https://www.st.com/resource/en/datasheet/ilps22qs.pdf
8 * ILPS22QS
9 *
10 * code generated via Gemini: https://gemini.google.com/share/76db6b22d296
11 *
12 * The sensor needs to be explicitly turned on and then off to save power consumption
13 *
14 * For
15 *
16 */
17
18#ifndef INC_BAR_ILS22QS_H_
19#define INC_BAR_ILS22QS_H_
20
21#include "mysensors_def.h"
22
23#ifdef SENSOR_BAR_ILS22QS
24
25#include "stm32wlxx_hal.h" // Change to your specific family (e.g., l4xx, g0xx)
26
27#pragma pack(1)
28/**
29 * @brief Measurement data produced by the ILPS22QS barometric pressure sensor.
30 * Populated by bar_ils22qs_Read(); check IsDataValid before use.
31 */
32typedef struct
33{
34 float PressureABS; /**< Absolute atmospheric pressure in hPa */
35 float PressureSEA; /**< Pressure corrected to sea level in hPa (requires SHT45 temperature) */
36 float Temperature; /**< Temperature from the sensor in degrees Celsius (accuracy may vary) */
37 int8_t IsDataValid; /**< 1 – values are valid; 0 – last read failed or sensor not ready */
39#pragma pack()
40/**
41 * @brief Live measurement data from the ILPS22QS sensor; updated by bar_ils22qs_Read().
42 */
44/**
45 * @brief Snapshot copy of the last completed ILPS22QS measurement; used for LoRaWAN transmission.
46 */
48
49/**
50 * @brief Check if the ILPS22QS barometric pressure sensor is present on the I2C bus.
51 * @param hi2c Pointer to the I2C handle.
52 * @param tryInit 1 – attempt to (re-)initialise if not yet done; 0 – no retry.
53 * @retval 1 – sensor is present and initialised.
54 * @retval 0 – sensor not detected.
55 */
56int8_t bar_ils22qs_Is(I2C_HandleTypeDef *hi2c, int8_t tryInit);
57
58/**
59 * @brief Initialise the ILPS22QS sensor and verify it is present on the I2C bus.
60 * The sensor is put into low-power standby mode after verification.
61 * @param hi2c Pointer to the I2C handle.
62 * @retval HAL_OK – sensor found and initialised successfully.
63 * @retval HAL_ERROR – sensor not detected on the bus or initialisation failed.
64 */
65HAL_StatusTypeDef bar_ils22qs_Init(I2C_HandleTypeDef *hi2c);
66
67
68/**
69 * @brief turn on sensor
70 * @retval HAL_OK, HAL_ERROR
71 */
72HAL_StatusTypeDef bar_ils22qs_On(I2C_HandleTypeDef *hi2c);
73
74/**
75 * @brief turn off sensor
76 * @retval HAL_OK, HAL_ERROR
77 */
78HAL_StatusTypeDef bar_ils22qs_Off(I2C_HandleTypeDef *hi2c);
79
80
81/**
82 * @brief read value from sensor, pressure and temperature.
83 * Sensor must be turned on before
84 * @retval
85 * HAL_OK - have data,
86 * HAL_BUSY - next reading in progress,
87 * HAL_TIMEOUT - sensor is not turned on
88 * HAL_ERROR - error
89 */
90HAL_StatusTypeDef bar_ils22qs_Read(I2C_HandleTypeDef *hi2c);
91
92/**
93 * @brief log data to buffer
94 */
95void bar_ils22qs_LogData(char* buf);
96
97#endif
98
99#endif /* INC_BAR_ILS22QS_H_ */
int8_t bar_ils22qs_Is(I2C_HandleTypeDef *hi2c, int8_t tryInit)
Check if the ILPS22QS barometric pressure sensor is present on the I2C bus.
Definition bar_ils22qs.c:67
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
HAL_StatusTypeDef bar_ils22qs_On(I2C_HandleTypeDef *hi2c)
turn on sensor
Definition bar_ils22qs.c:74
void bar_ils22qs_LogData(char *buf)
log data to buffer
bar_ils22qs_t _bar_ils22qsData
Live measurement data from the ILPS22QS sensor; updated by bar_ils22qs_Read().
Definition bar_ils22qs.c:31
HAL_StatusTypeDef bar_ils22qs_Off(I2C_HandleTypeDef *hi2c)
turn off sensor
Definition bar_ils22qs.c:94
bar_ils22qs_t _bck_bar_ils22qsData
Snapshot copy of the last completed ILPS22QS measurement; used for LoRaWAN transmission.
Definition bar_ils22qs.c:32
Measurement data produced by the ILPS22QS barometric pressure sensor. Populated by bar_ils22qs_Read()...
Definition bar_ils22qs.h:33
float PressureSEA
Definition bar_ils22qs.h:35
int8_t IsDataValid
Definition bar_ils22qs.h:37
float Temperature
Definition bar_ils22qs.h:36
float PressureABS
Definition bar_ils22qs.h:34