|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
#include "bar_ils22qs.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 | ILPS22QS_I2C_ADDR (0x5C << 1) |
| #define | REG_WHO_AM_I 0x0F |
| #define | REG_CTRL_REG1 0x10 |
| #define | REG_PRESS_OUT_XL 0x28 |
| #define | REG_PRESS_OFFSET 0x1A |
| #define | ILPS22QS_ID 0xB4 |
Functions | |
| static HAL_StatusTypeDef | bar_ils22qs_IsOn (I2C_HandleTypeDef *hi2c, uint8_t *onOff) |
| static HAL_StatusTypeDef | barometer_onOff (I2C_HandleTypeDef *hi2c, uint8_t onOff) |
| 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_On (I2C_HandleTypeDef *hi2c) |
| turn on sensor | |
| HAL_StatusTypeDef | bar_ils22qs_Off (I2C_HandleTypeDef *hi2c) |
| turn off sensor | |
| 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-power standby mode after verification. | |
| HAL_StatusTypeDef | bar_ils22qs_Read (I2C_HandleTypeDef *hi2c) |
| read value from sensor, pressure and temperature. Sensor must be turned on before | |
| void | bar_ils22qs_LogData (char *buf) |
| log data to buffer | |
Variables | |
| 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. | |
| static uint8_t | _isBarometer = 0 |
| #define ILPS22QS_I2C_ADDR (0x5C << 1) |
Definition at line 21 of file bar_ils22qs.c.
Referenced by bar_ils22qs_Init(), bar_ils22qs_IsOn(), bar_ils22qs_Read(), and barometer_onOff().
| #define ILPS22QS_ID 0xB4 |
Definition at line 29 of file bar_ils22qs.c.
Referenced by bar_ils22qs_Init().
| #define REG_CTRL_REG1 0x10 |
Definition at line 25 of file bar_ils22qs.c.
Referenced by bar_ils22qs_IsOn(), and barometer_onOff().
| #define REG_PRESS_OFFSET 0x1A |
Definition at line 27 of file bar_ils22qs.c.
Referenced by bar_ils22qs_Read().
| #define REG_PRESS_OUT_XL 0x28 |
Definition at line 26 of file bar_ils22qs.c.
Referenced by bar_ils22qs_Read().
| #define REG_WHO_AM_I 0x0F |
Definition at line 24 of file bar_ils22qs.c.
Referenced by bar_ils22qs_Init().
| 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-power standby mode after verification.
| hi2c | Pointer to the I2C handle. |
| HAL_OK | – sensor found and initialised successfully. |
| HAL_ERROR | – sensor not detected on the bus or initialisation failed. |
Definition at line 101 of file bar_ils22qs.c.
References _isBarometer, bar_ils22qs_Off(), bar_ils22qs_On(), I2C_IsDeviceReadyMT(), ILPS22QS_I2C_ADDR, ILPS22QS_ID, and REG_WHO_AM_I.
Referenced by bar_ils22qs_Is().
| int8_t bar_ils22qs_Is | ( | I2C_HandleTypeDef * | hi2c, |
| int8_t | tryInit ) |
Check if the ILPS22QS barometric pressure sensor is present on the I2C bus.
| hi2c | Pointer to the I2C handle. |
| tryInit | 1 – attempt to (re-)initialise if not yet done; 0 – no retry. |
| 1 | – sensor is present and initialised. |
| 0 | – sensor not detected. |
Definition at line 67 of file bar_ils22qs.c.
References _isBarometer, and bar_ils22qs_Init().
|
static |
Definition at line 35 of file bar_ils22qs.c.
References _isBarometer, ILPS22QS_I2C_ADDR, and REG_CTRL_REG1.
Referenced by bar_ils22qs_Read().
| void bar_ils22qs_LogData | ( | char * | buf | ) |
log data to buffer
Definition at line 206 of file bar_ils22qs.c.
References _bar_ils22qsData, PRIf_02, and PRIf_02D.
| HAL_StatusTypeDef bar_ils22qs_Off | ( | I2C_HandleTypeDef * | hi2c | ) |
turn off sensor
| HAL_OK,HAL_ERROR |
Definition at line 94 of file bar_ils22qs.c.
References barometer_onOff().
Referenced by bar_ils22qs_Init().
| HAL_StatusTypeDef bar_ils22qs_On | ( | I2C_HandleTypeDef * | hi2c | ) |
turn on sensor
| HAL_OK,HAL_ERROR |
Definition at line 74 of file bar_ils22qs.c.
References _bar_ils22qsData, _memsMainBlock, barometer_onOff(), and mems_WriteMainBlock().
Referenced by bar_ils22qs_Init().
| HAL_StatusTypeDef bar_ils22qs_Read | ( | I2C_HandleTypeDef * | hi2c | ) |
read value from sensor, pressure and temperature. Sensor must be turned on before
| HAL_OK | - have data, HAL_BUSY - next reading in progress, HAL_TIMEOUT - sensor is not turned on HAL_ERROR - error |
Definition at line 129 of file bar_ils22qs.c.
References _bar_ils22qsData, _isBarometer, _systemParams, _tmphm_sht45Data, bar_ils22qs_IsOn(), ILPS22QS_I2C_ADDR, REG_PRESS_OFFSET, and REG_PRESS_OUT_XL.
|
static |
Definition at line 52 of file bar_ils22qs.c.
References _isBarometer, ILPS22QS_I2C_ADDR, and REG_CTRL_REG1.
Referenced by bar_ils22qs_Off(), and bar_ils22qs_On().
| bar_ils22qs_t _bar_ils22qsData = {} |
Live measurement data from the ILPS22QS sensor; updated by bar_ils22qs_Read().
Definition at line 31 of file bar_ils22qs.c.
Referenced by bar_ils22qs_LogData(), bar_ils22qs_On(), bar_ils22qs_Read(), and sensors_CopyToBck().
| bar_ils22qs_t _bck_bar_ils22qsData = {} |
Snapshot copy of the last completed ILPS22QS measurement; used for LoRaWAN transmission.
Definition at line 32 of file bar_ils22qs.c.
Referenced by sensors_CayennelFromBckData(), sensors_CopyToBck(), sensors_ReadToBckFromDataBlock(), and sensors_WriteFromBckToDataBlock().
|
static |
Definition at line 33 of file bar_ils22qs.c.