Class to manage ADC hardware sampling and filtering. More...
#include <adc_utils.hpp>
Public Member Functions | |
| adc_manager (ADC_HandleTypeDef *adc_cap, ADC_HandleTypeDef *adc_bat, ADC_HandleTypeDef *adc_temp) | |
| Constructor. | |
| HAL_StatusTypeDef | adc_init (uint8_t *filters_length) |
| Initializes ADCs and filter states. | |
| float | get_temperature () |
| Reads temperature using onboard NTC. | |
Data Fields | |
| bool | calibration_ready = false |
| Optional flag for calibration flow. | |
Class to manage ADC hardware sampling and filtering.
|
inline |
Constructor.
| adc_cap | Pointer to ADC for capacitor-side sampling |
| adc_bat | Pointer to ADC for battery-side sampling |
| adc_temp | Pointer to ADC for temperature sensing |
| HAL_StatusTypeDef adc_manager::adc_init | ( | uint8_t * | filters_length | ) |
Initializes ADCs and filter states.
Initializes ADC peripherals, DMA, and filter buffers.
| filters_length | Pointer to array of filter lengths per channel |
Also starts internal ADC calibration and begins temperature ADC readings.
| filters_length | Pointer to an array specifying the filter window length per channel. |
| float adc_manager::get_temperature | ( | ) |
Reads temperature using onboard NTC.
Calculates the ambient temperature using a thermistor connected to an analog input.
Converts ADC reading to voltage, calculates NTC resistance, and applies the B-parameter equation.
| bool adc_manager::calibration_ready = false |
Optional flag for calibration flow.