|
HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
|
Comprehensive ADC testing suite for ESP32-C6 DevKit-M-1 (noexcept) More...
#include "base/BaseAdc.h"#include "mcu/esp32/EspAdc.h"#include "mcu/esp32/utils/EspTypes_ADC.h"#include "TestFramework.h"#include "hal/adc_types.h"Classes | |
| struct | adc_queue_message_t |
Functions | |
| bool | test_hardware_validation () noexcept |
| Test hardware setup validation. | |
| bool | test_adc_initialization () noexcept |
| Test ADC initialization and basic setup. | |
| bool | test_adc_channel_configuration () noexcept |
| Test ADC channel configuration. | |
| bool | test_adc_basic_conversion () noexcept |
| Test basic ADC conversion functionality. | |
| bool | test_adc_calibration () noexcept |
| Test ADC calibration functionality. | |
| bool | test_adc_multiple_channels () noexcept |
| Test reading from multiple ADC channels. | |
| bool | test_adc_averaging () noexcept |
| Test ADC averaging functionality. | |
| bool | test_adc_continuous_mode () noexcept |
| Test ADC continuous mode functionality. | |
| bool | test_adc_monitor_thresholds () noexcept |
| Test ADC monitor threshold functionality with proper ESP-IDF sequence. | |
| bool | test_adc_error_handling () noexcept |
| Test ADC error handling. | |
| bool | test_adc_statistics () noexcept |
| Test ADC statistics and diagnostics. | |
| bool | test_adc_performance () noexcept |
| Test ADC performance characteristics. | |
| bool | initialize_test_adc (EspAdc &adc) noexcept |
| Initialize ADC for testing with proper configuration. | |
| bool | configure_test_channels (EspAdc &adc) noexcept |
| Configure test channels with appropriate settings. | |
| bool | validate_voltage_reading (uint32_t voltage_mv, const char *channel_name) noexcept |
| Validate if voltage reading is within reasonable range. | |
| bool | continuous_callback (const hf_adc_continuous_data_t *data, void *user_data) noexcept |
| Continuous mode callback function (ISR-safe) - extracts latest voltage in real-time. | |
| void | setup_adc_config (hf_adc_unit_config_t &config, hf_adc_mode_t mode) noexcept |
| Setup ADC configuration with test channels pre-configured. | |
| void | monitor_callback (const hf_adc_monitor_event_t *event, void *user_data) noexcept |
| Monitor callback function for threshold testing (ISR-safe) | |
| void | app_main (void) |
Variables | |
| static const char * | TAG = "ADC_Test" |
| static TestResults | g_test_results |
| static constexpr hf_channel_id_t | TEST_CHANNEL_1 = 3 |
| static constexpr hf_channel_id_t | TEST_CHANNEL_2 = 0 |
| static constexpr hf_channel_id_t | TEST_CHANNEL_3 = 1 |
| static constexpr uint32_t | MIN_VALID_VOLTAGE_MV = 100 |
| static constexpr uint32_t | MAX_VALID_VOLTAGE_MV = 3200 |
| static constexpr uint32_t | VOLTAGE_DIVIDER_EXPECTED_MV = 1650 |
| static constexpr uint32_t | VOLTAGE_DIVIDER_TOLERANCE_MV = 150 |
| static constexpr uint32_t | GROUND_TOLERANCE_MV = 300 |
| static constexpr uint32_t | POTENTIOMETER_MAX_MV = 3300 |
| static constexpr uint32_t | ADC_12BIT_MAX_VALUE = 4095 |
| static constexpr uint32_t | ADC_12BIT_MID_VALUE = 2048 |
| static constexpr uint32_t | ADC_VOLTAGE_SCALE_FACTOR = 1000 |
| static constexpr uint32_t | MONITOR_TEST_DURATION_MS = 15000 |
| static constexpr uint32_t | MONITOR_UPDATE_INTERVAL_MS = 2000 |
| static constexpr uint32_t | MONITOR_THRESHOLD_SEPARATION_MV = 800 |
| static constexpr uint32_t | MONITOR_THRESHOLD_OFFSET_MV = 400 |
| static constexpr uint32_t | PERFORMANCE_NUM_CONVERSIONS = 1000 |
| static constexpr uint32_t | PERFORMANCE_MAX_TIME_US = 1000 |
| static constexpr uint32_t | CONTINUOUS_TEST_DURATION_MS = 2000 |
| static constexpr uint32_t | CONTINUOUS_SAMPLES_PER_FRAME = 64 |
| static constexpr uint32_t | CONTINUOUS_MAX_STORE_FRAMES = 4 |
| static QueueHandle_t | adc_data_queue = nullptr |
| static volatile bool | continuous_test_active = false |
| static volatile uint32_t | continuous_samples_received = 0 |
| static volatile bool | monitor_test_active = false |
| static volatile uint32_t | high_threshold_count = 0 |
| static volatile uint32_t | low_threshold_count = 0 |
| static volatile uint64_t | last_monitor_event_time = 0 |
| static constexpr bool | ENABLE_CORE_TESTS |
| static constexpr bool | ENABLE_CONVERSION_TESTS |
| static constexpr bool | ENABLE_ADVANCED_TESTS |
| static constexpr bool | ENABLE_PERFORMANCE_TESTS = true |
Comprehensive ADC testing suite for ESP32-C6 DevKit-M-1 (noexcept)
This file contains a dedicated, comprehensive test suite for the EspAdc class targeting ESP32-C6 with ESP-IDF v5.5+. It provides thorough testing of all ADC functionalities including basic operations, calibration, continuous conversion, and hardware-specific capabilities.
Hardware Configuration (ESP32-C6 DevKit-M-1):
Monitor Test Requirements:
| void app_main | ( | void | ) |
|
noexcept |
Configure test channels with appropriate settings.
|
noexcept |
Continuous mode callback function (ISR-safe) - extracts latest voltage in real-time.
|
noexcept |
Initialize ADC for testing with proper configuration.
|
noexcept |
Monitor callback function for threshold testing (ISR-safe)
|
noexcept |
Setup ADC configuration with test channels pre-configured.
|
noexcept |
Test ADC averaging functionality.
|
noexcept |
Test basic ADC conversion functionality.
|
noexcept |
Test ADC calibration functionality.
|
noexcept |
Test ADC channel configuration.
|
noexcept |
Test ADC continuous mode functionality.
|
noexcept |
Test ADC error handling.
|
noexcept |
Test ADC initialization and basic setup.
|
noexcept |
Test ADC monitor threshold functionality with proper ESP-IDF sequence.
Tests threshold monitoring on the potentiometer channel (GPIO0)
Proper ESP-IDF v5.5 sequence:
Expected hardware setup:
|
noexcept |
Test reading from multiple ADC channels.
|
noexcept |
Test ADC performance characteristics.
|
noexcept |
Test ADC statistics and diagnostics.
|
noexcept |
Test hardware setup validation.
Validates the expected hardware connections before running other tests
|
noexcept |
Validate if voltage reading is within reasonable range.
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
static |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
staticconstexpr |
|
static |
|
static |
|
static |
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
static |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |