L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
Loading...
Searching...
No Matches
bar_bmp585.h
Go to the documentation of this file.
1/*
2 * bar_bmp585.h
3 *
4 * The processing of barometer sensor BMP585
5 * Created on: 16. 2. 2026
6 * Author: Milan
7 *
8 * Barometer sensor BMP585, datasheet datasheets/V1/Bar_bst-bmp585-ds003.pdf
9 * BMP585 from Bosch Sensortec
10 *
11 * The sensor needs to be explicitly turned on and then off to save power consumption
12 *
13 */
14
15#ifndef INC_BAR_BMP585_H_
16#define INC_BAR_BMP585_H_
17
18#include "mysensors_def.h"
19
20#ifdef SENSOR_BAR_BMP585
21
22#include "stm32wlxx_hal.h"
23
24#pragma pack(1)
25/**
26 * @brief Measurement data produced by the BMP585 barometric pressure sensor.
27 * Populated by bar_bmp585_Read(); check IsDataValid before use.
28 */
29typedef struct
30{
31 float PressureABS; /**< Absolute atmospheric pressure in hPa */
32 float PressureSEA; /**< Pressure corrected to sea level in hPa (requires SHT45 temperature and configured altitude) */
33 float Temperature; /**< Temperature measured by the BMP585 sensor in degrees Celsius */
34 int8_t IsDataValid; /**< 1 – values are valid; 0 – last read failed or sensor not ready */
36#pragma pack()
37
38/**
39 * @brief Live measurement data from the BMP585 sensor; updated by bar_bmp585_Read().
40 */
42/**
43 * @brief Snapshot copy of the last completed BMP585 measurement; used for LoRaWAN transmission.
44 */
46
47/**
48 * @brief Check if sensor is present
49 * @param hi2c - I2C handle
50 * @param tryInit - in case sensor is not yet initialized, 1 - attempt to initialize again, 0 - no
51 * @retval 1 - is present, 0 - is not
52 */
53int8_t bar_bmp585_Is(I2C_HandleTypeDef *hi2c, int8_t tryInit);
54
55/**
56 * @brief Initialize sensor, check if it really is this sensor. After check the sensor is turned off to save power
57 * @param hi2c - I2C handle
58 * @retval HAL_OK, HAL_ERROR
59 */
60HAL_StatusTypeDef bar_bmp585_Init(I2C_HandleTypeDef *hi2c);
61
62/**
63 * @brief Turn on sensor - wakeup the sensor and start to processing of pressure measure
64 * @param hi2c - I2C handle
65 * @retval HAL_OK, HAL_ERROR
66 */
67HAL_StatusTypeDef bar_bmp585_On(I2C_HandleTypeDef *hi2c);
68
69/**
70 * @brief Turn off sensor - stop measure and put sensor in very deep sleep mode
71 * @param hi2c - I2C handle
72 * @retval HAL_OK, HAL_ERROR
73 */
74HAL_StatusTypeDef bar_bmp585_Off(I2C_HandleTypeDef *hi2c);
75
76/**
77 * @brief Read value from sensor, pressure and temperature.
78 * Sensor must be turned on before
79 * @param hi2c - I2C handle
80 * @retval
81 * HAL_OK - have data,
82 * HAL_BUSY - next reading in progress,
83 * HAL_TIMEOUT - sensor is not turned on
84 * HAL_ERROR - error
85 */
86HAL_StatusTypeDef bar_bmp585_Read(I2C_HandleTypeDef *hi2c);
87
88/**
89 * @brief Log data to buffer
90 * @param buf - buffer to log data to
91 */
92void bar_bmp585_LogData(char* buf);
93
94#endif
95
96#endif /* INC_BAR_BMP585_H_ */
HAL_StatusTypeDef bar_bmp585_On(I2C_HandleTypeDef *hi2c)
Turn on sensor - wakeup the sensor and start to processing of pressure measure.
Definition bar_bmp585.c:96
HAL_StatusTypeDef bar_bmp585_Off(I2C_HandleTypeDef *hi2c)
Turn off sensor - stop measure and put sensor in very deep sleep mode.
Definition bar_bmp585.c:112
HAL_StatusTypeDef bar_bmp585_Read(I2C_HandleTypeDef *hi2c)
Read value from sensor, pressure and temperature. Sensor must be turned on before.
Definition bar_bmp585.c:154
void bar_bmp585_LogData(char *buf)
Log data to buffer.
Definition bar_bmp585.c:219
HAL_StatusTypeDef bar_bmp585_Init(I2C_HandleTypeDef *hi2c)
Initialize sensor, check if it really is this sensor. After check the sensor is turned off to save po...
Definition bar_bmp585.c:119
bar_bmp585_t _bar_bmp585Data
Live measurement data from the BMP585 sensor; updated by bar_bmp585_Read().
Definition bar_bmp585.c:47
bar_bmp585_t _bck_bar_bmp585Data
Snapshot copy of the last completed BMP585 measurement; used for LoRaWAN transmission.
Definition bar_bmp585.c:48
int8_t bar_bmp585_Is(I2C_HandleTypeDef *hi2c, int8_t tryInit)
Check if sensor is present.
Definition bar_bmp585.c:89
Measurement data produced by the BMP585 barometric pressure sensor. Populated by bar_bmp585_Read(); c...
Definition bar_bmp585.h:30
float PressureSEA
Definition bar_bmp585.h:32
int8_t IsDataValid
Definition bar_bmp585.h:34
float PressureABS
Definition bar_bmp585.h:31
float Temperature
Definition bar_bmp585.h:33