HardFOC Flux V1 HAL
Unified HAL API for the HardFOC Flux valve-control platform (ESP32-S3)
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
Flux.h File Reference

Unified API singleton for the HardFOC Flux V1 platform. More...

#include <array>
#include <atomic>
#include <cstddef>
#include <cstring>
#include "FluxVersion.h"
#include "flux_hal/flux_hal_types.hpp"
#include "handlers/logger/Logger.h"
Include dependency graph for Flux.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FluxSystemDiagnostics
 Complete system diagnostics snapshot for the Flux API. More...
 
struct  ManagerHealthEntry
 Per-manager health entry for unified error aggregation. More...
 
struct  ManagerHealthSnapshot
 Aggregated health snapshot across all Flux managers. More...
 
struct  ManagerDiagnostic
 One manager's lifecycle state in FluxHalDiagnostics. More...
 
struct  FluxHalDiagnostics
 Board-level bring-up snapshot: every manager's state and every fitted part's readiness. More...
 
class  Flux
 Unified singleton entry point for the HardFOC Flux V1 platform. More...
 

Macros

#define FLUX_API   Flux::GetInstance()
 Shorthand for Flux::GetInstance().
 
#define FLUX_API_INIT()   (Flux::GetInstance().EnsureInitialized(), Flux::GetInstance())
 Initialise (if needed) and return the Flux API instance.
 

Functions

Flux & GetFlux () noexcept
 Convenience accessor — equivalent to Flux::GetInstance().
 

Variables

constexpr size_t kFluxManagerCount = 7
 Number of Flux subsystem managers exposed on Flux (incl. NVS).
 

Detailed Description

Unified API singleton for the HardFOC Flux V1 platform.

Provides a single entry point to every subsystem on the Flux board:

Initialization Order (dependency-based):

  1. NvsManager (flash key-value — before buses so config/cal is available early)
  2. CommChannelsManager (foundation — SPI, CAN, lazy UART acquisition)
  3. GpioManager (depends on comms for future expansion)
  4. ValveManager (depends on comms + gpio for drivers)
  5. AdcManager (ESP32 internal ADC, independent)
  6. LedManager (WS2812, independent)
  7. TemperatureManager (depends on ADC)

Task CPU affinity for this board uses logical indices from FluxCpuAffinity.h (flux_hal::kFluxCpuHostIo, kFluxCpuRealtime, …).

Usage:

if (flux.EnsureInitialized()) {
flux.valves.EnableChannel(ValveChannel::SOL_CH0);
float ntc_temp;
flux.temp.ReadNtcTemperature(ntc_temp);
flux.leds.IndicateReady();
}
static Flux & GetInstance() noexcept
Access the singleton instance (Meyers singleton, thread-safe).
Definition Flux.cpp:68
Definition flux_hal_types.hpp:29
Author
HardFOC Team
Date
2026
Version
1.0

Macro Definition Documentation

◆ FLUX_API

#define FLUX_API   Flux::GetInstance()

Shorthand for Flux::GetInstance().

◆ FLUX_API_INIT

#define FLUX_API_INIT ( )    (Flux::GetInstance().EnsureInitialized(), Flux::GetInstance())

Initialise (if needed) and return the Flux API instance.

Function Documentation

◆ GetFlux()

Flux & GetFlux ( )
inlinenoexcept

Convenience accessor — equivalent to Flux::GetInstance().

Returns
Reference to the singleton Flux API.
Here is the call graph for this function:

Variable Documentation

◆ kFluxManagerCount

constexpr size_t kFluxManagerCount = 7
inlineconstexpr

Number of Flux subsystem managers exposed on Flux (incl. NVS).