TLE92466ED Driver 0.1.0-preview
Modern C++23 driver for Infineon TLE92466ED Six-Channel Low-Side Solenoid Driver
Loading...
Searching...
No Matches
TLE92466ED_TestFramework.hpp File Reference

Testing framework for TLE92466ED driver examples on ESP32-C6. More...

#include "esp_log.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/semphr.h"
#include "driver/gpio.h"
Include dependency graph for TLE92466ED_TestFramework.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TestResults
 Test execution tracking and results accumulation. More...
 
struct  TestTaskContext
 Context for test task. More...
 

Macros

#define RUN_TEST(test_func)
 Run a test function inline (no separate task)
 
#define RUN_TEST_IN_TASK(name, func, stack_size_bytes, priority)
 Run a test in its own FreeRTOS task.
 
#define RUN_TEST_SECTION_IF_ENABLED(enabled, section_name, ...)
 Run a test section with indicator pattern.
 
#define RUN_TEST_SECTION_IF_ENABLED_WITH_PATTERN(enabled, section_name, blink_count, ...)
 Run a test section with custom blink pattern.
 

Functions

bool init_test_progress_indicator () noexcept
 Initialize GPIO14 as test progression indicator.
 
void flip_test_progress_indicator () noexcept
 Toggle GPIO14 to indicate test progression.
 
void output_section_indicator (uint8_t blink_count=5) noexcept
 Blink GPIO14 to indicate section start/end.
 
void cleanup_test_progress_indicator () noexcept
 Cleanup GPIO14 indicator.
 
void ensure_gpio14_initialized () noexcept
 Ensure GPIO14 is initialized.
 
void test_task_trampoline (void *param)
 FreeRTOS task trampoline for test execution.
 
void print_test_section_status (const char *tag, const char *module_name)
 Print section configuration status.
 

Variables

static constexpr gpio_num_t TEST_PROGRESS_PIN = GPIO_NUM_14
 
static bool g_gpio14_initialized = false
 
static bool g_gpio14_state = false
 
static TestResults g_test_results
 

Detailed Description

Testing framework for TLE92466ED driver examples on ESP32-C6.

This file provides testing infrastructure including:

  • Test result tracking
  • Execution timing
  • FreeRTOS task-based test execution
  • GPIO14 progress indicator
  • Standardized test execution macros

Adapted from HardFOC Internal Interface Wrap test framework

Author
N3b3x
Date
2025-10-21
Version
2.0.0

Macro Definition Documentation

◆ RUN_TEST

#define RUN_TEST ( test_func)
Value:
do { \
ensure_gpio14_initialized(); \
ESP_LOGI(TAG, ""); \
ESP_LOGI(TAG, "╔══════════════════════════════════════════════════════════════════════════════╗"); \
ESP_LOGI(TAG, "║ Running: " #test_func " "); \
ESP_LOGI(TAG, "╚══════════════════════════════════════════════════════════════════════════════╝"); \
uint64_t start_time = esp_timer_get_time(); \
bool result = test_func(); \
uint64_t end_time = esp_timer_get_time(); \
uint64_t execution_time = end_time - start_time; \
g_test_results.add_result(result, execution_time); \
if (result) { \
ESP_LOGI(TAG, "[SUCCESS] PASSED: " #test_func " (%.2f ms)", execution_time / 1000.0); \
} else { \
ESP_LOGE(TAG, "[FAILED] FAILED: " #test_func " (%.2f ms)", execution_time / 1000.0); \
} \
flip_test_progress_indicator(); \
vTaskDelay(pdMS_TO_TICKS(100)); \
} while (0)
static const char * TAG
Definition BasicUsageExample.cpp:30
static TestResults g_test_results
Definition TLE92466ED_TestFramework.hpp:161
void add_result(bool passed, uint64_t execution_time) noexcept
Definition TLE92466ED_TestFramework.hpp:127

Run a test function inline (no separate task)

◆ RUN_TEST_IN_TASK

#define RUN_TEST_IN_TASK ( name,
func,
stack_size_bytes,
priority )

Run a test in its own FreeRTOS task.

◆ RUN_TEST_SECTION_IF_ENABLED

#define RUN_TEST_SECTION_IF_ENABLED ( enabled,
section_name,
... )
Value:
do { \
if (enabled) { \
ESP_LOGI(TAG, ""); \
ESP_LOGI(TAG, "╔══════════════════════════════════════════════════════════════════════════════╗"); \
ESP_LOGI(TAG, "║ SECTION: %-69s║", section_name); \
ESP_LOGI(TAG, "╚══════════════════════════════════════════════════════════════════════════════╝"); \
output_section_indicator(5); \
__VA_ARGS__ \
} \
} while (0)

Run a test section with indicator pattern.

◆ RUN_TEST_SECTION_IF_ENABLED_WITH_PATTERN

#define RUN_TEST_SECTION_IF_ENABLED_WITH_PATTERN ( enabled,
section_name,
blink_count,
... )
Value:
do { \
if (enabled) { \
ESP_LOGI(TAG, ""); \
ESP_LOGI(TAG, "╔══════════════════════════════════════════════════════════════════════════════╗"); \
ESP_LOGI(TAG, "║ SECTION: %-69s║", section_name); \
ESP_LOGI(TAG, "╚══════════════════════════════════════════════════════════════════════════════╝"); \
output_section_indicator(blink_count); \
__VA_ARGS__ \
} \
} while (0)

Run a test section with custom blink pattern.

Function Documentation

◆ cleanup_test_progress_indicator()

void cleanup_test_progress_indicator ( )
inlinenoexcept

Cleanup GPIO14 indicator.

◆ ensure_gpio14_initialized()

void ensure_gpio14_initialized ( )
inlinenoexcept

Ensure GPIO14 is initialized.

◆ flip_test_progress_indicator()

void flip_test_progress_indicator ( )
inlinenoexcept

Toggle GPIO14 to indicate test progression.

◆ init_test_progress_indicator()

bool init_test_progress_indicator ( )
inlinenoexcept

Initialize GPIO14 as test progression indicator.

◆ output_section_indicator()

void output_section_indicator ( uint8_t blink_count = 5)
inlinenoexcept

Blink GPIO14 to indicate section start/end.

◆ print_test_section_status()

void print_test_section_status ( const char * tag,
const char * module_name )
inline

Print section configuration status.

◆ test_task_trampoline()

void test_task_trampoline ( void * param)
inline

FreeRTOS task trampoline for test execution.

Variable Documentation

◆ g_gpio14_initialized

bool g_gpio14_initialized = false
static

◆ g_gpio14_state

bool g_gpio14_state = false
static

◆ g_test_results

TestResults g_test_results
static

◆ TEST_PROGRESS_PIN

constexpr gpio_num_t TEST_PROGRESS_PIN = GPIO_NUM_14
staticconstexpr