|
L14-Click 1.0
STM32WLE5CC LoRaWAN Sensor Platform
|
Go to the source code of this file.
Data Structures | |
| struct | sps30_t |
| Measurement data produced by the SPS30 particulate matter sensor. Populated by sps30_Read(); check IsDataValid before using the values. More... | |
Enumerations | |
| enum | AQI_Level_t { AQI_GOOD = 0 , AQI_MODERATE , AQI_UNHEALTHY_SENSITIVE , AQI_UNHEALTHY , AQI_VERY_UNHEALTHY , AQI_HAZARDOUS } |
| Air Quality Index (AQI) level based on PM2.5 mass concentration. Follows US EPA / WHO PM2.5 breakpoints (µg/m³). More... | |
Functions | |
| AQI_Level_t | sps30_ClassifyPM25 (char **label) |
| Classify the current PM2.5 mass concentration according to the AQI scale. | |
| int8_t | sps30_Is (I2C_HandleTypeDef *hi2c, int8_t tryInit) |
| |
| HAL_StatusTypeDef | sps30_Init (I2C_HandleTypeDef *hi2c) |
| initialization of sensor sps30 | |
| HAL_StatusTypeDef | sps30_On (I2C_HandleTypeDef *hi2c) |
| Turn on laser and fan to allow measurements. | |
| HAL_StatusTypeDef | sps30_Off (I2C_HandleTypeDef *hi2c) |
| Turn off laser and fan to stop measurements. | |
| HAL_StatusTypeDef | sps30_IsDataReady (I2C_HandleTypeDef *hi2c) |
| Check if data is available. | |
| HAL_StatusTypeDef | sps30_Read (I2C_HandleTypeDef *hi2c) |
| Read data if data is available. | |
| HAL_StatusTypeDef | sps30_IsOnOff (I2C_HandleTypeDef *hi2c, uint8_t *onOff) |
| |
| HAL_StatusTypeDef | sps30_StartCleaning (I2C_HandleTypeDef *hi2c) |
| manually start fan for cleaning, runs for about 10s Note: The sensor will be busy cleaning for 10 seconds. Data read during this time might be inconsistent due to high airflow. | |
| HAL_StatusTypeDef | sps30_GetAutoCleanInterval (I2C_HandleTypeDef *hi2c, uint32_t *interval_sec) |
| interval for auto cleaning | |
| HAL_StatusTypeDef | sps30_SetAutoCleanInterval (I2C_HandleTypeDef *hi2c, uint32_t interval_sec) |
| set interval for auto cleaning | |
| int8_t | sps30_Service (I2C_HandleTypeDef *hi2c) |
| the sensor need to be cleaning | |
| void | sps30_LogData (char *buf) |
| log data to buffer | |
Variables | |
| sps30_t | _sps30Data |
| Live measurement data from the SPS30 sensor; updated by sps30_Read(). | |
| sps30_t | _bck_sps30Data |
| Snapshot copy of the last completed SPS30 measurement; used for LoRaWAN transmission. | |
| enum AQI_Level_t |
Air Quality Index (AQI) level based on PM2.5 mass concentration. Follows US EPA / WHO PM2.5 breakpoints (µg/m³).
| AQI_Level_t sps30_ClassifyPM25 | ( | char ** | label | ) |
Classify the current PM2.5 mass concentration according to the AQI scale.
| label | Optional output pointer; if non-NULL, *label is set to a static human-readable string (e.g. "Good", "Moderate", "Hazardous"). |
Definition at line 47 of file sps30.c.
References _sps30Data, AQI_GOOD, AQI_HAZARDOUS, AQI_MODERATE, AQI_UNHEALTHY, AQI_UNHEALTHY_SENSITIVE, and AQI_VERY_UNHEALTHY.
Referenced by sps30_LogData().
| HAL_StatusTypeDef sps30_GetAutoCleanInterval | ( | I2C_HandleTypeDef * | hi2c, |
| uint32_t * | interval_sec ) |
interval for auto cleaning
Definition at line 300 of file sps30.c.
References _isSps30, SPS30_CMD_CLEAN_INTERVAL, SPS30_I2C_ADDR, and systemParams_CalculateCrc().
| HAL_StatusTypeDef sps30_Init | ( | I2C_HandleTypeDef * | hi2c | ) |
initialization of sensor sps30
| HAL_OK | - sensor is present, HAL_ERROR - error |
Definition at line 90 of file sps30.c.
References _isClearing, _isSps30, CLR_NONE, HAL_Delay(), I2C_IsDeviceReadyMT(), SPS30_CMD_SLEEP, SPS30_CMD_SOFT_RESET, SPS30_CMD_WAKEUP, and SPS30_I2C_ADDR.
Referenced by sps30_Is().
| int8_t sps30_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 83 of file sps30.c.
References _isSps30, and sps30_Init().
| HAL_StatusTypeDef sps30_IsDataReady | ( | I2C_HandleTypeDef * | hi2c | ) |
Check if data is available.
| HAL_OK,HAL_ERROR,HAL_BUSY |
Definition at line 201 of file sps30.c.
References _isSps30, SPS30_CMD_READ_DRDY, and SPS30_I2C_ADDR.
Referenced by sps30_IsOnOff(), and sps30_Read().
| HAL_StatusTypeDef sps30_IsOnOff | ( | I2C_HandleTypeDef * | hi2c, |
| uint8_t * | onOff ) |
Definition at line 271 of file sps30.c.
References sps30_IsDataReady().
| void sps30_LogData | ( | char * | buf | ) |
log data to buffer
Definition at line 356 of file sps30.c.
References _sps30Data, PRIf_02, PRIf_02D, and sps30_ClassifyPM25().
| HAL_StatusTypeDef sps30_Off | ( | I2C_HandleTypeDef * | hi2c | ) |
Turn off laser and fan to stop measurements.
| HAL_OK,HAL_ERROR |
Definition at line 175 of file sps30.c.
References _isSps30, HAL_Delay(), SPS30_CMD_SLEEP, SPS30_CMD_STOP_MEAS, and SPS30_I2C_ADDR.
Referenced by sps30_Service().
| HAL_StatusTypeDef sps30_On | ( | I2C_HandleTypeDef * | hi2c | ) |
Turn on laser and fan to allow measurements.
| HAL_OK,HAL_ERROR |
Definition at line 128 of file sps30.c.
References _cleaningInterval, _isClearing, _isSps30, _memsMainBlock, _sps30Data, CLR_NONE, CLR_START, HAL_Delay(), mems_WriteMainBlock(), SPS30_CMD_START_MEAS, SPS30_CMD_WAKEUP, SPS30_I2C_ADDR, and systemParams_CalculateCrc().
Referenced by sps30_Service().
| HAL_StatusTypeDef sps30_Read | ( | I2C_HandleTypeDef * | hi2c | ) |
Read data if data is available.
Definition at line 224 of file sps30.c.
References _sps30Data, SPS30_CMD_READ_MEAS, SPS30_I2C_ADDR, sps30_IsDataReady(), and systemParams_CalculateCrc().
| int8_t sps30_Service | ( | I2C_HandleTypeDef * | hi2c | ) |
the sensor need to be cleaning
| 0 | - no need, 1 - sensor is clearing |
Definition at line 367 of file sps30.c.
References _clearingTime, _isClearing, CLR_NONE, CLR_PROCESS, CLR_START, CLR_STOP, sleeper_Init(), sleeper_IsElapsed(), sps30_Off(), sps30_On(), sps30_StartCleaning(), and writeLog().
| HAL_StatusTypeDef sps30_SetAutoCleanInterval | ( | I2C_HandleTypeDef * | hi2c, |
| uint32_t | interval_sec ) |
set interval for auto cleaning
Definition at line 329 of file sps30.c.
References _isSps30, SPS30_CMD_CLEAN_INTERVAL, SPS30_I2C_ADDR, and systemParams_CalculateCrc().
| HAL_StatusTypeDef sps30_StartCleaning | ( | I2C_HandleTypeDef * | hi2c | ) |
manually start fan for cleaning, runs for about 10s Note: The sensor will be busy cleaning for 10 seconds. Data read during this time might be inconsistent due to high airflow.
Definition at line 288 of file sps30.c.
References _isSps30, SPS30_CMD_START_CLEAN, and SPS30_I2C_ADDR.
Referenced by sps30_Service().
|
extern |
Snapshot copy of the last completed SPS30 measurement; used for LoRaWAN transmission.
Definition at line 39 of file sps30.c.
Referenced by sensors_CayennelFromBckData(), sensors_CopyToBck(), sensors_ReadToBckFromDataBlock(), and sensors_WriteFromBckToDataBlock().
|
extern |
Live measurement data from the SPS30 sensor; updated by sps30_Read().
Definition at line 38 of file sps30.c.
Referenced by sensors_CopyToBck(), sps30_ClassifyPM25(), sps30_LogData(), sps30_On(), and sps30_Read().