|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
Go to the source code of this file.
Data Structures | |
| struct | amb_tsl2591_t |
| Measurement data produced by the TSL2591 ambient light sensor. Populated by amb_tsl2591_Read(); check IsDataValid before using Lux. More... | |
Functions | |
| int8_t | amb_tsl2591_Is (I2C_HandleTypeDef *hi2c, int8_t tryInit) |
| |
| HAL_StatusTypeDef | amb_tsl2591_Init (I2C_HandleTypeDef *hi2c) |
| initialization of light sensor, and check if sensor is present or not Subsequently the sensor is turned off so it doesn't run unnecessarily | |
| HAL_StatusTypeDef | amb_tsl2591_IsOn (I2C_HandleTypeDef *hi2c, uint8_t *onOff) |
| check if sensor is turned on or not | |
| HAL_StatusTypeDef | amb_tsl2591_On (I2C_HandleTypeDef *hi2c) |
| turn on sensor, read value 4x to automatically configure the sensor. | |
| HAL_StatusTypeDef | amb_tsl2591_Off (I2C_HandleTypeDef *hi2c) |
| turn off sensor | |
| HAL_StatusTypeDef | amb_tsl2591_Read (I2C_HandleTypeDef *hi2c) |
| read value from sensor, the value is in _ambientData | |
| void | amb_tsl2591_LogData (char *buf) |
| log data to buffer | |
Variables | |
| amb_tsl2591_t | _amb_tsl2591Data |
| Live measurement data from the TSL2591 sensor; updated by amb_tsl2591_Read(). | |
| amb_tsl2591_t | _bck_amb_tsl2591Data |
| Snapshot copy of the last completed TSL2591 measurement; used for LoRaWAN transmission. | |
| HAL_StatusTypeDef amb_tsl2591_Init | ( | I2C_HandleTypeDef * | hi2c | ) |
initialization of light sensor, and check if sensor is present or not Subsequently the sensor is turned off so it doesn't run unnecessarily
| HAL_OK | - sensor is present, HAL_ERROR |
Definition at line 121 of file amb_tsl2591.c.
References _isAmbientSensor, amb_tsl2591_Off(), amb_tsl2591_On(), AMBIENT_ADDR, and I2C_IsDeviceReadyMT().
Referenced by amb_tsl2591_Is().
| int8_t amb_tsl2591_Is | ( | I2C_HandleTypeDef * | hi2c, |
| int8_t | tryInit ) |
| tryInit | - in case sensor is not yet initialized, 1 - attempt to initialize again, 0 - no |
| 1 | - is present, 0 - is not |
Definition at line 35 of file amb_tsl2591.c.
References _isAmbientSensor, and amb_tsl2591_Init().
| HAL_StatusTypeDef amb_tsl2591_IsOn | ( | I2C_HandleTypeDef * | hi2c, |
| uint8_t * | onOff ) |
check if sensor is turned on or not
| onOff | - on output contains 1-on 0-off, but only if status is HAL_OK |
| HAL_OK | - onOff contains sensor state, HAL_ERROR |
Definition at line 42 of file amb_tsl2591.c.
References _isAmbientSensor, AMBIENT_ADDR, REG_ENABLE, and TSL2591_COMMAND.
Referenced by amb_tsl2591_Read().
| void amb_tsl2591_LogData | ( | char * | buf | ) |
log data to buffer
Definition at line 248 of file amb_tsl2591.c.
References _amb_tsl2591Data, PRIf_02, and PRIf_02D.
| HAL_StatusTypeDef amb_tsl2591_Off | ( | I2C_HandleTypeDef * | hi2c | ) |
turn off sensor
| HAL_OK,HAL_ERROR |
Definition at line 101 of file amb_tsl2591.c.
References _isAmbientSensor, AMBIENT_ADDR, REG_ENABLE, and TSL2591_COMMAND.
Referenced by amb_tsl2591_Init().
| HAL_StatusTypeDef amb_tsl2591_On | ( | I2C_HandleTypeDef * | hi2c | ) |
turn on sensor, read value 4x to automatically configure the sensor.
| HAL_OK,HAL_ERROR |
Definition at line 57 of file amb_tsl2591.c.
References _amb_tsl2591Data, _currentGain, _isAmbientSensor, _memsMainBlock, amb_tsl2591_Read(), AMBIENT_ADDR, mems_WriteMainBlock(), REG_CONFIG, REG_ENABLE, TSL2591_COMMAND, and TSL2591_GAIN_MED.
Referenced by amb_tsl2591_Init().
| HAL_StatusTypeDef amb_tsl2591_Read | ( | I2C_HandleTypeDef * | hi2c | ) |
read value from sensor, the value is in _ambientData
| HAL_OK | - have data, HAL_BUSY - next reading in progress, HAL_TIMEOUT - sensor is not turned on HAL_ERROR - error |
read value from sensor, the value is in _ambientData
Definition at line 179 of file amb_tsl2591.c.
References _amb_tsl2591Data, _currentGain, _isAmbientSensor, amb_tsl2591_IsOn(), AMBIENT_ADDR, ambient_AdjustGain(), REG_C0DATAL, THRESH_MAX, TSL2591_COMMAND, TSL2591_GAIN_HIGH, TSL2591_GAIN_LOW, TSL2591_GAIN_MAX, and TSL2591_GAIN_MED.
Referenced by amb_tsl2591_On().
|
extern |
Live measurement data from the TSL2591 sensor; updated by amb_tsl2591_Read().
Definition at line 32 of file amb_tsl2591.c.
Referenced by amb_tsl2591_LogData(), amb_tsl2591_On(), amb_tsl2591_Read(), and sensors_CopyToBck().
|
extern |
Snapshot copy of the last completed TSL2591 measurement; used for LoRaWAN transmission.
Definition at line 33 of file amb_tsl2591.c.
Referenced by sensors_CayennelFromBckData(), sensors_CopyToBck(), sensors_ReadToBckFromDataBlock(), and sensors_WriteFromBckToDataBlock().