Unified API singleton for the HardFOC Vortex platform.
More...
#include <Vortex.h>
Unified API singleton for the HardFOC Vortex platform.
◆ Vortex() [1/3]
| Vortex::Vortex |
( |
const Vortex & |
| ) |
|
|
delete |
◆ Vortex() [2/3]
◆ Vortex() [3/3]
Private constructor for singleton pattern.
◆ ~Vortex()
◆ AddSystemWarning()
| void Vortex::AddSystemWarning |
( |
const char * |
warning | ) |
|
|
privatenoexcept |
Add warning message to system warnings.
- Parameters
-
| warning | Warning message to add |
◆ CollectDiagnostics()
Aggregated health of every manager, the buses and the device counts.
Reads counters the managers already hold: no bus transfer, no allocation. Works before and after initialisation (a manager that is down reports NotInitialized).
- Parameters
-
- Returns
- The value of IsInitialized().
◆ CollectManagerHealth()
Collect per-manager error health into a unified snapshot.
- Parameters
-
| snapshot | Reference to snapshot structure to fill |
- Returns
- true if snapshot collected successfully, false if not initialized
- Note
- Error codes are manager-specific uint8_t values (0 = success)
◆ DumpSystemStatistics()
| void Vortex::DumpSystemStatistics |
( |
| ) |
const |
|
noexcept |
Dump comprehensive system statistics.
- Note
- This will dump statistics from all component handlers
◆ EnsureInitialized()
| bool Vortex::EnsureInitialized |
( |
| ) |
|
|
noexcept |
Bring the managers up in dependency order (idempotent).
Fail-closed: if a required manager (NVS, comms, GPIO, LEDs) fails, every manager that did come up is shut down again in reverse order, GetLastError() says why, and the call returns false; nothing is left half-initialised. Best-effort managers (motors, ADC, IMU, encoders, temperature) that fail become warnings (GetSystemWarnings()). If the motor controller does not come up, the TMC9660 driver-enable line is driven inactive.
- Returns
- true when every required manager is up.
◆ FailClosed()
Record why init failed and shut everything down again. Caller holds lifecycle_mutex_.
◆ GetComponentInitializationStatus()
Get initialization status for each component.
- Returns
- Array of initialization status (true/false) for each component
◆ GetFailedComponents()
| size_t Vortex::GetFailedComponents |
( |
const char * |
out_names[], |
|
|
size_t |
max_entries |
|
) |
| const |
|
noexcept |
Get list of failed components during initialization.
- Parameters
-
| out_names | Array to receive failed component name pointers |
| max_entries | Maximum entries the array can hold |
- Returns
- Number of failed components written
◆ GetInitializationTimeMs()
| uint64_t Vortex::GetInitializationTimeMs |
( |
| ) |
const |
|
noexcept |
Get initialization time in milliseconds.
- Returns
- Time taken for initialization in milliseconds
◆ GetInstance()
| Vortex & Vortex::GetInstance |
( |
| ) |
|
|
staticnoexcept |
Get the singleton instance of Vortex API.
- Returns
- Reference to the singleton Vortex instance
- Note
- Uses Meyer's singleton for thread-safe initialization
◆ GetLastError()
◆ GetOnboardTmc9660Transport()
◆ GetSystemDiagnostics()
Get comprehensive system diagnostics.
- Parameters
-
| diagnostics | Reference to diagnostics structure to fill |
- Returns
- true if diagnostics retrieved successfully, false otherwise
◆ GetSystemUptimeMs()
| uint64_t Vortex::GetSystemUptimeMs |
( |
| ) |
const |
|
noexcept |
Get system uptime in milliseconds.
- Returns
- System uptime in milliseconds
◆ GetSystemVersion()
| const char * Vortex::GetSystemVersion |
( |
| ) |
const |
|
noexcept |
Get system version information.
- Returns
- System version string
◆ GetSystemWarnings()
| size_t Vortex::GetSystemWarnings |
( |
const char * |
out_warnings[], |
|
|
size_t |
max_entries |
|
) |
| const |
|
noexcept |
Get the warnings recorded by the last EnsureInitialized() (degraded subsystems and unusual conditions that did not fail initialisation).
- Parameters
-
| out_warnings | Array to receive warning string pointers (static storage) |
| max_entries | Maximum entries the array can hold |
- Returns
- Number of warnings written
◆ InitializeAdc()
| bool Vortex::InitializeAdc |
( |
| ) |
|
|
privatenoexcept |
Initialize ADC management (step 6)
- Returns
- true if successful, false otherwise
◆ InitializeAllComponents()
| bool Vortex::InitializeAllComponents |
( |
| ) |
|
|
privatenoexcept |
Initialize all component handlers in proper order.
- Returns
- true if all components initialized successfully, false otherwise
◆ InitializeComms()
| bool Vortex::InitializeComms |
( |
| ) |
|
|
privatenoexcept |
Initialize communication channels (step 2)
- Returns
- true if successful, false otherwise
◆ InitializeEncoders()
| bool Vortex::InitializeEncoders |
( |
| ) |
|
|
privatenoexcept |
Initialize encoder management (step 8)
- Returns
- true if successful, false otherwise
◆ InitializeGpio()
| bool Vortex::InitializeGpio |
( |
| ) |
|
|
privatenoexcept |
Initialize GPIO management (step 3)
- Returns
- true if successful, false otherwise
◆ InitializeImu()
| bool Vortex::InitializeImu |
( |
| ) |
|
|
privatenoexcept |
Initialize IMU management (step 7)
- Returns
- true if successful, false otherwise
◆ InitializeLeds()
| bool Vortex::InitializeLeds |
( |
| ) |
|
|
privatenoexcept |
Initialize LED management (step 4 — early for LED-only benches)
- Returns
- true if successful, false otherwise
◆ InitializeMotors()
| bool Vortex::InitializeMotors |
( |
| ) |
|
|
privatenoexcept |
Initialize motor controllers (step 5 — after GPIO + LEDs)
- Returns
- true if successful, false otherwise
◆ InitializeNvs()
| bool Vortex::InitializeNvs |
( |
| ) |
|
|
privatenoexcept |
◆ InitializeTemperature()
| bool Vortex::InitializeTemperature |
( |
| ) |
|
|
privatenoexcept |
Initialize temperature management (step 9)
- Returns
- true if successful, false otherwise
◆ IsInitialized()
| bool Vortex::IsInitialized |
( |
| ) |
const |
|
inlinenoexcept |
Check if all Vortex systems are initialized.
- Returns
- true if all systems are initialized, false otherwise
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ PerformHealthCheck()
| bool Vortex::PerformHealthCheck |
( |
| ) |
|
|
noexcept |
Perform system health check.
- Returns
- true if system is healthy, false otherwise
◆ SetOnboardTmc9660Transport()
◆ Shutdown()
| bool Vortex::Shutdown |
( |
| ) |
|
|
noexcept |
Shut down all subsystems in reverse initialization order.
- Returns
- true if all subsystems shut down cleanly
◆ ShutdownComponentsLocked()
| void Vortex::ShutdownComponentsLocked |
( |
| ) |
|
|
privatenoexcept |
Shut down every manager that is up, in reverse init order. Caller holds lifecycle_mutex_.
◆ UpdateSystemDiagnostics()
| void Vortex::UpdateSystemDiagnostics |
( |
| ) |
|
|
privatenoexcept |
Update system diagnostics.
◆ adc
◆ adc_initialized_
| std::atomic<bool> Vortex::adc_initialized_ |
|
private |
◆ comms
Communication channels (SPI, I²C, UART, CAN). After NVS.
◆ comms_initialized_
| std::atomic<bool> Vortex::comms_initialized_ |
|
private |
◆ diagnostics_
◆ encoders
AS5047U rotary encoders. Depends on comms and gpio.
◆ encoders_initialized_
| std::atomic<bool> Vortex::encoders_initialized_ |
|
private |
◆ gpio
ESP32 + I/O-expander GPIO pins. Depends on comms.
◆ gpio_initialized_
| std::atomic<bool> Vortex::gpio_initialized_ |
|
private |
◆ imu
BNO08x IMU sensors. Depends on comms and gpio.
◆ imu_initialized_
| std::atomic<bool> Vortex::imu_initialized_ |
|
private |
◆ initialization_end_time_
| std::atomic<uint64_t> Vortex::initialization_end_time_ |
|
private |
Initialization end timestamp.
◆ initialization_start_time_
| std::atomic<uint64_t> Vortex::initialization_start_time_ |
|
private |
Initialization start timestamp.
◆ initialized_
| std::atomic<bool> Vortex::initialized_ |
|
private |
Overall initialization status.
◆ last_error_
Why the last init attempt failed.
◆ leds
WS2812 status LED. Independent component.
◆ leds_initialized_
| std::atomic<bool> Vortex::leds_initialized_ |
|
private |
◆ lifecycle_mutex_
| RtosMutex Vortex::lifecycle_mutex_ |
|
mutableprivate |
◆ motors
TMC9660 motor controllers. Depends on comms.
◆ motors_initialized_
| std::atomic<bool> Vortex::motors_initialized_ |
|
private |
◆ nvs
Non-volatile storage (vortex / vortex_cal / vortex_cfg). Init before comms.
◆ nvs_initialized_
| std::atomic<bool> Vortex::nvs_initialized_ |
|
private |
◆ onboard_tmc9660_transport_
| std::atomic< std::uint8_t > Vortex::onboard_tmc9660_transport_ |
|
staticprivate |
Initial value:0 = Spi, 1 = Uart — must match VortexOnboardTmc9660Transport enumerators.
◆ report_
Failed components and warnings of the last init attempt.
◆ temp
Temperature sensors (NTC, ESP32, TMC9660). Depends on ADC and motors.
◆ temp_initialized_
| std::atomic<bool> Vortex::temp_initialized_ |
|
private |
The documentation for this class was generated from the following files: