|
Envorimental Monitoring
|
: Header for main.c file. This file contains the common defines of the application. More...
#include "stm32f4xx_hal.h"#include "bmp180.h"#include "bh1750.h"#include "aht20.h"#include "ring_buffer.h"#include "filter.h"#include <math.h>#include <string.h>#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | Sensor_Stats_t |
Macros | |
| #define | LED_GREEN_Pin GPIO_PIN_12 |
| #define | LED_GREEN_GPIO_Port GPIOD |
Functions | |
| void | Error_Handler (void) |
| This function is executed in case of error occurrence. | |
| void | calculate_statistics (buf_handle_t *p_handle, Sensor_Stats_t *stats) |
| Computes min, max, median, and standard deviation from a ring buffer. | |
: Header for main.c file. This file contains the common defines of the application.
Copyright (c) 2026 STMicroelectronics. All rights reserved.
This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.
| void calculate_statistics | ( | buf_handle_t * | p_handle, |
| Sensor_Stats_t * | stats ) |
Computes min, max, median, and standard deviation from a ring buffer.
| [in] | p_handle | Pointer to the ring buffer handle to analyse. |
| [out] | stats | Pointer to the Sensor_Stats_t structure to fill. |
Computes min, max, median, and standard deviation from a ring buffer.
Iterates over all valid samples in p_handle to find the minimum, maximum and arithmetic mean. A second pass computes the population standard deviation. The buffer is then copied to a temporary array, sorted with bubble_sort(), and the median is extracted.
| [in] | p_handle | Pointer to the ring buffer handle containing the samples. |
| [out] | stats | Pointer to the Sensor_Stats_t structure to populate. |
| void Error_Handler | ( | void | ) |
This function is executed in case of error occurrence.
| None |