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

Host (unit-test) family of the Flux platform binding: scripting and inspection hooks. More...

#include <cstddef>
#include <cstdint>
#include "HfCoreMocks.h"
#include "bsp_bind/FluxPlatformBind.h"
Include dependency graph for FluxHostBind.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  flux
 
namespace  flux::bsp
 
namespace  flux::bsp::host
 

Functions

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 (unit-test) family of the Flux platform binding: scripting and inspection hooks.

FluxPlatformBindHost.cpp implements bsp_bind/FluxPlatformBind.h with the hf-core host fakes (hf_core_host_mocks): every GPIO is a MockGpio, every SPI chip select a MockSpi, the MCU ADC a MockAdc, NVS regions MockNvs, and so on, all in static slots exactly like the ESP32-S3 binding. This header lets a test reach those fakes, script them before a manager initialises, and inject failures. Only tests/host includes it.

Thread safety: none; host tests are single-threaded.

Author
HardFOC Team
Date
2026