|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
#include "bar_bmp585.h"#include "i2c.h"#include "utils/mydefs.h"#include "mymems.h"#include "mysensors_base.h"#include <stdio.h>#include <math.h>#include "tmphm_sht45.h"Go to the source code of this file.
Macros | |
| #define | BMP585_I2C_ADDR (0x46 << 1) |
| #define | REG_CHIP_ID 0x01 |
| #define | REG_STATUS 0x28 |
| #define | REG_DATA_0 0x20 |
| #define | REG_DATA_1 0x21 |
| #define | REG_DATA_2 0x22 |
| #define | REG_TEMP_DATA_0 0x1D |
| #define | REG_TEMP_DATA_1 0x1E |
| #define | REG_TEMP_DATA_2 0x1F |
| #define | REG_OSR_CONFIG 0x36 |
| #define | REG_ODR_CONFIG 0x37 |
| #define | REG_INT_CONFIG 0x38 |
| #define | REG_IF_CONFIG 0x39 |
| #define | REG_CMD 0x7E |
| #define | BMP585_CHIP_ID 0x50 |
| #define | BAR_MODE_STANDBY 0x00 |
| #define | BAR_MODE_NORMAL 0x01 |
| #define | BAR_MODE_FORCED 0x02 |
| #define | BAR_MODE_DEEP_SLEEP 0x00 |
Functions | |
| static HAL_StatusTypeDef | bar_bmp585_IsOn (I2C_HandleTypeDef *hi2c, uint8_t *onOff) |
| Check if sensor is turned on. | |
| static HAL_StatusTypeDef | barometer_onOff (I2C_HandleTypeDef *hi2c, uint8_t onOff) |
| Control sensor power mode. | |
| int8_t | bar_bmp585_Is (I2C_HandleTypeDef *hi2c, int8_t tryInit) |
| Check if sensor is present. | |
| 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. | |
| 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 power. | |
| 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. | |
Variables | |
| 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. | |
| static uint8_t | _isBarometer = 0 |
| #define BAR_MODE_DEEP_SLEEP 0x00 |
Definition at line 45 of file bar_bmp585.c.
| #define BAR_MODE_FORCED 0x02 |
Definition at line 44 of file bar_bmp585.c.
| #define BAR_MODE_NORMAL 0x01 |
Definition at line 43 of file bar_bmp585.c.
| #define BAR_MODE_STANDBY 0x00 |
Definition at line 42 of file bar_bmp585.c.
| #define BMP585_CHIP_ID 0x50 |
Definition at line 39 of file bar_bmp585.c.
Referenced by bar_bmp585_Init().
| #define BMP585_I2C_ADDR (0x46 << 1) |
Definition at line 21 of file bar_bmp585.c.
Referenced by bar_bmp585_Init(), bar_bmp585_IsOn(), bar_bmp585_Read(), and barometer_onOff().
| #define REG_CHIP_ID 0x01 |
Definition at line 24 of file bar_bmp585.c.
Referenced by bar_bmp585_Init().
| #define REG_CMD 0x7E |
Definition at line 36 of file bar_bmp585.c.
| #define REG_DATA_0 0x20 |
Definition at line 26 of file bar_bmp585.c.
Referenced by bar_bmp585_Read().
| #define REG_DATA_1 0x21 |
Definition at line 27 of file bar_bmp585.c.
| #define REG_DATA_2 0x22 |
Definition at line 28 of file bar_bmp585.c.
| #define REG_IF_CONFIG 0x39 |
Definition at line 35 of file bar_bmp585.c.
| #define REG_INT_CONFIG 0x38 |
Definition at line 34 of file bar_bmp585.c.
| #define REG_ODR_CONFIG 0x37 |
Definition at line 33 of file bar_bmp585.c.
Referenced by bar_bmp585_IsOn(), and barometer_onOff().
| #define REG_OSR_CONFIG 0x36 |
Definition at line 32 of file bar_bmp585.c.
Referenced by bar_bmp585_Init().
| #define REG_STATUS 0x28 |
Definition at line 25 of file bar_bmp585.c.
| #define REG_TEMP_DATA_0 0x1D |
Definition at line 29 of file bar_bmp585.c.
Referenced by bar_bmp585_Read().
| #define REG_TEMP_DATA_1 0x1E |
Definition at line 30 of file bar_bmp585.c.
| #define REG_TEMP_DATA_2 0x1F |
Definition at line 31 of file bar_bmp585.c.
| 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 power.
| hi2c | - I2C handle |
| HAL_OK,HAL_ERROR |
Definition at line 119 of file bar_bmp585.c.
References _isBarometer, bar_bmp585_Off(), bar_bmp585_On(), BMP585_CHIP_ID, BMP585_I2C_ADDR, I2C_IsDeviceReadyMT(), REG_CHIP_ID, and REG_OSR_CONFIG.
Referenced by bar_bmp585_Is().
| int8_t bar_bmp585_Is | ( | I2C_HandleTypeDef * | hi2c, |
| int8_t | tryInit ) |
Check if sensor is present.
| hi2c | - I2C handle |
| tryInit | - in case sensor is not yet initialized, 1 - attempt to initialize again, 0 - no |
| 1 | - is present, 0 - is not |
Definition at line 89 of file bar_bmp585.c.
References _isBarometer, and bar_bmp585_Init().
|
static |
Check if sensor is turned on.
Definition at line 54 of file bar_bmp585.c.
References _isBarometer, BMP585_I2C_ADDR, and REG_ODR_CONFIG.
Referenced by bar_bmp585_Read().
| void bar_bmp585_LogData | ( | char * | buf | ) |
Log data to buffer.
| buf | - buffer to log data to |
Definition at line 219 of file bar_bmp585.c.
References _bar_bmp585Data, PRIf_02, and PRIf_02D.
| HAL_StatusTypeDef bar_bmp585_Off | ( | I2C_HandleTypeDef * | hi2c | ) |
Turn off sensor - stop measure and put sensor in very deep sleep mode.
| hi2c | - I2C handle |
| HAL_OK,HAL_ERROR |
Definition at line 112 of file bar_bmp585.c.
References barometer_onOff().
Referenced by bar_bmp585_Init().
| HAL_StatusTypeDef bar_bmp585_On | ( | I2C_HandleTypeDef * | hi2c | ) |
Turn on sensor - wakeup the sensor and start to processing of pressure measure.
| hi2c | - I2C handle |
| HAL_OK,HAL_ERROR |
Definition at line 96 of file bar_bmp585.c.
References _bar_bmp585Data, _memsMainBlock, barometer_onOff(), and mems_WriteMainBlock().
Referenced by bar_bmp585_Init().
| HAL_StatusTypeDef bar_bmp585_Read | ( | I2C_HandleTypeDef * | hi2c | ) |
Read value from sensor, pressure and temperature. Sensor must be turned on before.
| hi2c | - I2C handle |
| HAL_OK | - have data, HAL_BUSY - next reading in progress, HAL_TIMEOUT - sensor is not turned on HAL_ERROR - error |
Definition at line 154 of file bar_bmp585.c.
References _bar_bmp585Data, _isBarometer, _systemParams, _tmphm_sht45Data, bar_bmp585_IsOn(), BMP585_I2C_ADDR, REG_DATA_0, and REG_TEMP_DATA_0.
|
static |
Control sensor power mode.
Definition at line 73 of file bar_bmp585.c.
References _isBarometer, BMP585_I2C_ADDR, and REG_ODR_CONFIG.
Referenced by bar_bmp585_Off(), and bar_bmp585_On().
| bar_bmp585_t _bar_bmp585Data = {} |
Live measurement data from the BMP585 sensor; updated by bar_bmp585_Read().
Definition at line 47 of file bar_bmp585.c.
Referenced by bar_bmp585_LogData(), bar_bmp585_On(), bar_bmp585_Read(), and sensors_CopyToBck().
| bar_bmp585_t _bck_bar_bmp585Data = {} |
Snapshot copy of the last completed BMP585 measurement; used for LoRaWAN transmission.
Definition at line 48 of file bar_bmp585.c.
Referenced by sensors_CayennelFromBckData(), sensors_CopyToBck(), sensors_ReadToBckFromDataBlock(), and sensors_WriteFromBckToDataBlock().
|
static |
Definition at line 49 of file bar_bmp585.c.
Referenced by bar_bmp585_Init(), bar_bmp585_Is(), bar_bmp585_IsOn(), bar_bmp585_Read(), bar_ils22qs_Init(), bar_ils22qs_Is(), bar_ils22qs_IsOn(), bar_ils22qs_Read(), barometer_onOff(), and barometer_onOff().