HF-Core Platform 0.1.0-dev
Hardware-Agnostic Handler Layer & RTOS Utilities for HardFOC
Loading...
Searching...
No Matches
tmc9660_handler_comprehensive_test.cpp File Reference

Comprehensive test suite for Tmc9660Handler. More...

#include "TestFramework.h"
#include "esp32_bus_setup.hpp"
#include "esp32_test_config.hpp"
#include "handlers/tmc9660/Tmc9660Handler.h"
#include "handlers/tmc9660/Tmc9660AdcWrapper.h"
#include <cmath>
#include <memory>
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
Include dependency graph for tmc9660_handler_comprehensive_test.cpp:

Functions

static bool create_handler () noexcept
 
static bool test_construction () noexcept
 
static bool test_initialize () noexcept
 
static bool test_is_ready () noexcept
 
static bool test_read_parameter () noexcept
 
static bool test_write_parameter () noexcept
 
static bool test_set_target_velocity () noexcept
 
static bool test_set_target_position () noexcept
 
static bool test_supply_voltage () noexcept
 
static bool test_chip_temperature () noexcept
 
static bool test_motor_current () noexcept
 
static bool test_status_flags () noexcept
 
static bool test_error_flags () noexcept
 
static bool test_gpio17_wrapper () noexcept
 
static bool test_gpio18_wrapper () noexcept
 
static bool test_adc_wrapper () noexcept
 
static bool test_adc_wrapper_delegation () noexcept
 
static bool test_temperature_wrapper () noexcept
 
static bool test_driver_enable () noexcept
 
static bool test_operations_before_init () noexcept
 
void app_main (void)
 

Variables

static const char * TAG = "TMC9660_Handler_Test"
 
static TestResults g_test_results
 
static constexpr bool ENABLE_CONSTRUCTION_TESTS = true
 
static constexpr bool ENABLE_INITIALIZATION_TESTS = true
 
static constexpr bool ENABLE_PARAMETER_TESTS = true
 
static constexpr bool ENABLE_MOTOR_CONTROL_TESTS = true
 
static constexpr bool ENABLE_TELEMETRY_TESTS = true
 
static constexpr bool ENABLE_GPIO_WRAPPER_TESTS = true
 
static constexpr bool ENABLE_ADC_WRAPPER_TESTS = true
 
static constexpr bool ENABLE_TEMP_WRAPPER_TESTS = true
 
static constexpr bool ENABLE_DRIVER_ENABLE_TESTS = true
 
static constexpr bool ENABLE_ERROR_HANDLING_TESTS = true
 
static std::unique_ptr< EspGpio > g_rst_gpio
 
static std::unique_ptr< EspGpio > g_drv_en_gpio
 
static std::unique_ptr< EspGpio > g_faultn_gpio
 
static std::unique_ptr< EspGpio > g_wake_gpio
 
static BaseSpi * g_spi_device = nullptr
 
static std::unique_ptr< Tmc9660Handlerg_handler
 
static bool g_hw_present = false
 

Detailed Description

Comprehensive test suite for Tmc9660Handler.

Tests: SPI comm adapter, bootloader initialization, TMCL parameters, motor control (velocity/position/torque), telemetry (voltage/temp/current/flags), GPIO wrapper (GPIO17/18), ADC wrapper (multi-channel), Temperature wrapper, null-safe accessors (eager wrapper creation), driver enable, PID gains, and visitDriver() advanced access.

Note
This test requires a TMC9660-3PH-EVAL or compatible board connected via SPI. Without hardware, initialization will fail gracefully and remaining tests will be skipped.
Author
HardFOC Team
Date
2025-2026

Function Documentation

◆ app_main()

void app_main ( void )
Here is the call graph for this function:

◆ create_handler()

static bool create_handler ( )
staticnoexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_adc_wrapper()

static bool test_adc_wrapper ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_adc_wrapper_delegation()

static bool test_adc_wrapper_delegation ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_chip_temperature()

static bool test_chip_temperature ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_construction()

static bool test_construction ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_driver_enable()

static bool test_driver_enable ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_error_flags()

static bool test_error_flags ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_gpio17_wrapper()

static bool test_gpio17_wrapper ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_gpio18_wrapper()

static bool test_gpio18_wrapper ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_initialize()

static bool test_initialize ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_is_ready()

static bool test_is_ready ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_motor_current()

static bool test_motor_current ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_operations_before_init()

static bool test_operations_before_init ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_read_parameter()

static bool test_read_parameter ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_set_target_position()

static bool test_set_target_position ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_set_target_velocity()

static bool test_set_target_velocity ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_status_flags()

static bool test_status_flags ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_supply_voltage()

static bool test_supply_voltage ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_temperature_wrapper()

static bool test_temperature_wrapper ( )
staticnoexcept
Here is the caller graph for this function:

◆ test_write_parameter()

static bool test_write_parameter ( )
staticnoexcept
Here is the caller graph for this function:

Variable Documentation

◆ ENABLE_ADC_WRAPPER_TESTS

constexpr bool ENABLE_ADC_WRAPPER_TESTS = true
staticconstexpr

◆ ENABLE_CONSTRUCTION_TESTS

constexpr bool ENABLE_CONSTRUCTION_TESTS = true
staticconstexpr

◆ ENABLE_DRIVER_ENABLE_TESTS

constexpr bool ENABLE_DRIVER_ENABLE_TESTS = true
staticconstexpr

◆ ENABLE_ERROR_HANDLING_TESTS

constexpr bool ENABLE_ERROR_HANDLING_TESTS = true
staticconstexpr

◆ ENABLE_GPIO_WRAPPER_TESTS

constexpr bool ENABLE_GPIO_WRAPPER_TESTS = true
staticconstexpr

◆ ENABLE_INITIALIZATION_TESTS

constexpr bool ENABLE_INITIALIZATION_TESTS = true
staticconstexpr

◆ ENABLE_MOTOR_CONTROL_TESTS

constexpr bool ENABLE_MOTOR_CONTROL_TESTS = true
staticconstexpr

◆ ENABLE_PARAMETER_TESTS

constexpr bool ENABLE_PARAMETER_TESTS = true
staticconstexpr

◆ ENABLE_TELEMETRY_TESTS

constexpr bool ENABLE_TELEMETRY_TESTS = true
staticconstexpr

◆ ENABLE_TEMP_WRAPPER_TESTS

constexpr bool ENABLE_TEMP_WRAPPER_TESTS = true
staticconstexpr

◆ g_drv_en_gpio

std::unique_ptr<EspGpio> g_drv_en_gpio
static

◆ g_faultn_gpio

std::unique_ptr<EspGpio> g_faultn_gpio
static

◆ g_handler

std::unique_ptr<Tmc9660Handler> g_handler
static

◆ g_hw_present

bool g_hw_present = false
static

◆ g_rst_gpio

std::unique_ptr<EspGpio> g_rst_gpio
static

◆ g_spi_device

BaseSpi* g_spi_device = nullptr
static

◆ g_test_results

TestResults g_test_results
static

◆ g_wake_gpio

std::unique_ptr<EspGpio> g_wake_gpio
static

◆ TAG

const char* TAG = "TMC9660_Handler_Test"
static