10#ifdef SENSOR_BAR_BMP585
21#define BMP585_I2C_ADDR (0x46 << 1)
24#define REG_CHIP_ID 0x01
25#define REG_STATUS 0x28
26#define REG_DATA_0 0x20
27#define REG_DATA_1 0x21
28#define REG_DATA_2 0x22
29#define REG_TEMP_DATA_0 0x1D
30#define REG_TEMP_DATA_1 0x1E
31#define REG_TEMP_DATA_2 0x1F
32#define REG_OSR_CONFIG 0x36
33#define REG_ODR_CONFIG 0x37
34#define REG_INT_CONFIG 0x38
35#define REG_IF_CONFIG 0x39
39#define BMP585_CHIP_ID 0x50
42#define BAR_MODE_STANDBY 0x00
43#define BAR_MODE_NORMAL 0x01
44#define BAR_MODE_FORCED 0x02
45#define BAR_MODE_DEEP_SLEEP 0x00
56 HAL_StatusTypeDef status = HAL_ERROR;
61 uint8_t pwr_ctrl = 0x00;
65 *onOff = ((pwr_ctrl & 0x1F) != 0);
75 HAL_StatusTypeDef status = HAL_ERROR;
82 uint8_t odr_config = onOff;
100 const uint8_t val = 0x18;
104 if (status == HAL_OK)
123 if (status == HAL_OK)
139 uint8_t osr_config = 0x00;
157 HAL_StatusTypeDef status = HAL_ERROR;
168 status = HAL_TIMEOUT;
177 uint32_t raw_press = ((uint32_t)raw_data[2] << 16) | ((uint32_t)raw_data[1] << 8) | raw_data[0];
187 uint32_t raw_temp = ((uint32_t)raw_data[5] << 16) | ((uint32_t)raw_data[4] << 8) | raw_data[3];
HAL_StatusTypeDef bar_bmp585_On(I2C_HandleTypeDef *hi2c)
Turn on sensor - wakeup the sensor and start to processing of pressure measure.
HAL_StatusTypeDef bar_bmp585_Off(I2C_HandleTypeDef *hi2c)
Turn off sensor - stop measure and put sensor in very deep sleep mode.
static HAL_StatusTypeDef bar_bmp585_IsOn(I2C_HandleTypeDef *hi2c, uint8_t *onOff)
Check if sensor is turned on.
HAL_StatusTypeDef bar_bmp585_Read(I2C_HandleTypeDef *hi2c)
Read value from sensor, pressure and temperature. Sensor must be turned on before.
void bar_bmp585_LogData(char *buf)
Log data to buffer.
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...
static HAL_StatusTypeDef barometer_onOff(I2C_HandleTypeDef *hi2c, uint8_t onOff)
Control sensor power mode.
static uint8_t _isBarometer
int8_t bar_bmp585_Is(I2C_HandleTypeDef *hi2c, int8_t tryInit)
Check if sensor is present.
bar_bmp585_t _bar_bmp585Data
Live measurement data from the BMP585 sensor; updated by bar_bmp585_Read().
bar_bmp585_t _bck_bar_bmp585Data
Snapshot copy of the last completed BMP585 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 BMP585 barometric pressure sensor. Populated by bar_bmp585_Read(); c...
tmphm_sht45_t _tmphm_sht45Data
Live measurement data from the SHT45 sensor; updated by tmphm_sht45_Read().