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

Host implementation of the Flux platform binding over the hf-core host fakes. More...

#include "bsp_bind/host/FluxHostBind.h"
#include <array>
#include <cstdlib>
#include <map>
#include <optional>
#include <utility>
Include dependency graph for FluxPlatformBindHost.cpp:

Classes

struct  flux::bsp::anonymous_namespace{FluxPlatformBindHost.cpp}::SpiDeviceSlot
 
struct  flux::bsp::anonymous_namespace{FluxPlatformBindHost.cpp}::SpiBusSlot
 
struct  flux::bsp::anonymous_namespace{FluxPlatformBindHost.cpp}::HostState
 

Namespaces

namespace  flux
 
namespace  flux::bsp
 
namespace  flux::bsp::anonymous_namespace{FluxPlatformBindHost.cpp}
 
namespace  flux::bsp::host
 

Functions

void flux::bsp::anonymous_namespace{FluxPlatformBindHost.cpp}::ClearBus (SpiBusSlot &b) noexcept
 
HostState & flux::bsp::anonymous_namespace{FluxPlatformBindHost.cpp}::S () noexcept
 
BaseGpio * flux::bsp::CreateGpio (size_t slot, const GpioSpec &spec) noexcept
 Create the GPIO object for slot. No hardware access until the object is initialised.
 
void flux::bsp::DestroyGpio (size_t slot) noexcept
 Destroy the GPIO object in slot (releases the pin).
 
uint8_t flux::bsp::InternalAdcChannelCount () noexcept
 Number of channels per unit of the MCU ADC (0 when the family has none).
 
BaseAdc * flux::bsp::CreateInternalAdc (uint8_t unit, uint32_t channel_mask) noexcept
 Create and initialise the MCU ADC unit with the given channels enabled.
 
void flux::bsp::DestroyInternalAdc () noexcept
 Destroy the MCU ADC unit.
 
BaseTemperature * flux::bsp::CreateDieTemperature () noexcept
 Create the MCU die-temperature sensor (not initialised). nullptr if the family has none.
 
void flux::bsp::DestroyDieTemperature () noexcept
 Destroy the die-temperature sensor.
 
BaseNvs & flux::bsp::NvsRegion (size_t slot, const char *name_space) noexcept
 The NVS region in slot, created on first call for name_space (no flash access).
 
bool flux::bsp::CreateSpiBus (size_t bus, const SpiBusSpec &spec) noexcept
 Create and initialise SPI bus bus.
 
BaseSpi * flux::bsp::CreateSpiDevice (size_t bus, const SpiDeviceSpec &spec) noexcept
 Add a device to an initialised SPI bus.
 
void flux::bsp::DestroySpiBus (size_t bus) noexcept
 Destroy SPI bus bus and every device on it.
 
BaseCan * flux::bsp::CreateCan (const CanSpec &spec) noexcept
 Create the CAN controller (configured, not started). nullptr on failure.
 
void flux::bsp::DestroyCan () noexcept
 Destroy the CAN controller.
 
BaseUart * flux::bsp::CreateUart (const UartSpec &spec, bool *rs485) noexcept
 Create and initialise a UART. When spec.rts >= 0 the port is switched to RS-485 half duplex.
 
void flux::bsp::DestroyUart (uint8_t port) noexcept
 Destroy the UART on port.
 
BaseUsbSerialJtag * flux::bsp::AcquireUsbSerialJtag (const hf_usb_serial_jtag_config_t &cfg) noexcept
 The USB Serial/JTAG controller, initialised. nullptr when the family has none or the feature is compiled out (HF_CORE_ENABLE_USB_SERIAL_JTAG=OFF). First call wins cfg.
 
bool flux::bsp::LedStripBegin (const LedStripSpec &spec) noexcept
 Create and start the strip.
 
void flux::bsp::LedStripSetPixel (uint16_t index, uint32_t rgb) noexcept
 Stage a 0xRRGGBB colour for LED index (sent on LedStripShow).
 
void flux::bsp::LedStripSetBrightness (uint8_t brightness) noexcept
 Global brightness 0..255 applied to the next LedStripShow.
 
bool flux::bsp::LedStripShow () noexcept
 Send the staged colours.
 
void flux::bsp::LedStripEnd () noexcept
 Stop the strip and release its peripheral.
 
uint32_t flux::bsp::LastResetReason () noexcept
 Opaque reset cause of the previous boot (family-specific numbering; 0 when unknown).
 
void flux::bsp::SystemRestart () noexcept
 Software reset of the MCU. Does not return.
 
uint32_t flux::bsp::FreeHeapBytes () noexcept
 Free bytes in the default heap (0 when unknown).
 
uint32_t flux::bsp::LargestFreeHeapBlock () noexcept
 Largest contiguous free block in the default heap (0 when unknown).
 
void flux::bsp::host::Reset () noexcept
 Destroy every object in every slot and clear all scripting (call between test cases).
 
hf::host::MockGpio * flux::bsp::host::Gpio (size_t slot) noexcept
 The fake in GPIO slot slot, or nullptr when the slot is empty.
 
hf::host::MockGpio * flux::bsp::host::GpioByPin (hf_pin_num_t pin) noexcept
 The fake driving MCU pin pin, or nullptr.
 
const GpioSpec * flux::bsp::host::GpioSpecOf (size_t slot) noexcept
 The spec the slot was created with (valid only while the slot is in use).
 
void flux::bsp::host::FailGpioInit (hf_pin_num_t pin) noexcept
 Make the next CreateGpio for pin produce a fake whose initialisation fails.
 
void flux::bsp::host::SetSpiResponder (hf_pin_num_t cs, hf::host::MockSpi::Responder responder)
 Install a responder for the device whose chip select is cs (applied when it is created).
 
hf::host::MockSpi * flux::bsp::host::SpiDeviceByCs (hf_pin_num_t cs) noexcept
 The fake for chip select cs, or nullptr when no such device exists.
 
const SpiDeviceSpec * flux::bsp::host::SpiDeviceSpecOf (hf_pin_num_t cs) noexcept
 The spec the device on chip select cs was created with, or nullptr.
 
const SpiBusSpec * flux::bsp::host::SpiBusSpecOf (size_t bus) noexcept
 The spec bus bus was created with, or nullptr when it is down.
 
void flux::bsp::host::FailSpiBus (size_t bus, bool fail=true) noexcept
 Make CreateSpiBus(bus) fail.
 
hf::host::MockAdc * flux::bsp::host::InternalAdc () noexcept
 The MCU ADC fake, or nullptr when not created.
 
uint32_t flux::bsp::host::InternalAdcChannelMask () noexcept
 Channel mask the MCU ADC was created with.
 
void flux::bsp::host::FailInternalAdc (bool fail=true) noexcept
 Make CreateInternalAdc fail.
 
hf::host::MockTemperature * flux::bsp::host::DieTemperature () noexcept
 The die-temperature fake, or nullptr.
 
void flux::bsp::host::FailDieTemperatureInit (bool fail=true) noexcept
 Make the next die-temperature fake fail its initialisation.
 
hf::host::MockNvs * flux::bsp::host::Nvs (size_t slot) noexcept
 The NVS fake in region slot, or nullptr.
 
hf::host::MockCan * flux::bsp::host::Can () noexcept
 The CAN fake, or nullptr.
 
hf::host::MockUart * flux::bsp::host::Uart (uint8_t port) noexcept
 The UART fake on port, or nullptr.
 
void flux::bsp::host::FailLedStrip (bool fail=true) noexcept
 Make LedStripBegin fail.
 
uint32_t flux::bsp::host::LedShownPixel (uint16_t index) noexcept
 Last colour shown on LED index (after LedStripShow).
 
void flux::bsp::host::SetResetReason (uint32_t reason) noexcept
 Value LastResetReason() returns.
 
int flux::bsp::host::RestartCalls () noexcept
 Number of SystemRestart() calls (the host version throws after counting).
 

Detailed Description

Host implementation of the Flux platform binding over the hf-core host fakes.

Same slot layout as the ESP32-S3 binding (bsp_bind/esp32s3/), so a manager under test runs exactly the code it runs on the board; only the objects behind the Base* pointers differ. Scripting and inspection: FluxHostBind.h.

Author
HardFOC Team
Date
2026