HardFOC Flux V1 HAL
Unified HAL API for the HardFOC Flux valve-control platform (ESP32-S3)
Loading...
Searching...
No Matches
FluxHostBind.h
Go to the documentation of this file.
1
17#ifndef FLUX_BSP_HOST_BIND_H_
18#define FLUX_BSP_HOST_BIND_H_
19
20#include <cstddef>
21#include <cstdint>
22
23#include "HfCoreMocks.h"
25
26namespace flux::bsp::host {
27
29void Reset() noexcept;
30
31// ── GPIO ──────────────────────────────────────────────────────────────────
33hf::host::MockGpio* Gpio(size_t slot) noexcept;
35hf::host::MockGpio* GpioByPin(hf_pin_num_t pin) noexcept;
37const GpioSpec* GpioSpecOf(size_t slot) noexcept;
39void FailGpioInit(hf_pin_num_t pin) noexcept;
40
41// ── SPI ───────────────────────────────────────────────────────────────────
43void SetSpiResponder(hf_pin_num_t cs, hf::host::MockSpi::Responder responder);
45hf::host::MockSpi* SpiDeviceByCs(hf_pin_num_t cs) noexcept;
47const SpiDeviceSpec* SpiDeviceSpecOf(hf_pin_num_t cs) noexcept;
49const SpiBusSpec* SpiBusSpecOf(size_t bus) noexcept;
51void FailSpiBus(size_t bus, bool fail = true) noexcept;
52
53// ── MCU ADC, die temperature, NVS, CAN, UART, LED ─────────────────────────
55hf::host::MockAdc* InternalAdc() noexcept;
57uint32_t InternalAdcChannelMask() noexcept;
59void FailInternalAdc(bool fail = true) noexcept;
61hf::host::MockTemperature* DieTemperature() noexcept;
63void FailDieTemperatureInit(bool fail = true) noexcept;
65hf::host::MockNvs* Nvs(size_t slot) noexcept;
67hf::host::MockCan* Can() noexcept;
69hf::host::MockUart* Uart(uint8_t port) noexcept;
71void FailLedStrip(bool fail = true) noexcept;
73uint32_t LedShownPixel(uint16_t index) noexcept;
74
75// ── System ────────────────────────────────────────────────────────────────
77void SetResetReason(uint32_t reason) noexcept;
79int RestartCalls() noexcept;
80
81} // namespace flux::bsp::host
82
83#endif // FLUX_BSP_HOST_BIND_H_
The MCU-family seam of the Flux V1 HAL: what a binding must provide to the managers.
Definition FluxHostBind.h:26
void FailGpioInit(hf_pin_num_t pin) noexcept
Make the next CreateGpio for pin produce a fake whose initialisation fails.
Definition FluxPlatformBindHost.cpp:361
hf::host::MockAdc * InternalAdc() noexcept
The MCU ADC fake, or nullptr when not created.
Definition FluxPlatformBindHost.cpp:406
hf::host::MockUart * Uart(uint8_t port) noexcept
The UART fake on port, or nullptr.
Definition FluxPlatformBindHost.cpp:435
hf::host::MockTemperature * DieTemperature() noexcept
The die-temperature fake, or nullptr.
Definition FluxPlatformBindHost.cpp:418
void FailLedStrip(bool fail=true) noexcept
Make LedStripBegin fail.
Definition FluxPlatformBindHost.cpp:440
hf::host::MockGpio * Gpio(size_t slot) noexcept
The fake in GPIO slot slot, or nullptr when the slot is empty.
Definition FluxPlatformBindHost.cpp:341
void FailInternalAdc(bool fail=true) noexcept
Make CreateInternalAdc fail.
Definition FluxPlatformBindHost.cpp:414
const SpiDeviceSpec * SpiDeviceSpecOf(hf_pin_num_t cs) noexcept
The spec the device on chip select cs was created with, or nullptr.
Definition FluxPlatformBindHost.cpp:384
int RestartCalls() noexcept
Number of SystemRestart() calls (the host version throws after counting).
Definition FluxPlatformBindHost.cpp:452
void FailDieTemperatureInit(bool fail=true) noexcept
Make the next die-temperature fake fail its initialisation.
Definition FluxPlatformBindHost.cpp:422
const SpiBusSpec * SpiBusSpecOf(size_t bus) noexcept
The spec bus bus was created with, or nullptr when it is down.
Definition FluxPlatformBindHost.cpp:395
hf::host::MockGpio * GpioByPin(hf_pin_num_t pin) noexcept
The fake driving MCU pin pin, or nullptr.
Definition FluxPlatformBindHost.cpp:346
hf::host::MockCan * Can() noexcept
The CAN fake, or nullptr.
Definition FluxPlatformBindHost.cpp:431
hf::host::MockSpi * SpiDeviceByCs(hf_pin_num_t cs) noexcept
The fake for chip select cs, or nullptr when no such device exists.
Definition FluxPlatformBindHost.cpp:373
uint32_t LedShownPixel(uint16_t index) noexcept
Last colour shown on LED index (after LedStripShow).
Definition FluxPlatformBindHost.cpp:444
uint32_t InternalAdcChannelMask() noexcept
Channel mask the MCU ADC was created with.
Definition FluxPlatformBindHost.cpp:410
const GpioSpec * GpioSpecOf(size_t slot) noexcept
The spec the slot was created with (valid only while the slot is in use).
Definition FluxPlatformBindHost.cpp:356
void 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).
Definition FluxPlatformBindHost.cpp:365
hf::host::MockNvs * Nvs(size_t slot) noexcept
The NVS fake in region slot, or nullptr.
Definition FluxPlatformBindHost.cpp:426
void FailSpiBus(size_t bus, bool fail=true) noexcept
Make CreateSpiBus(bus) fail.
Definition FluxPlatformBindHost.cpp:400
void Reset() noexcept
Destroy every object in every slot and clear all scripting (call between test cases).
Definition FluxPlatformBindHost.cpp:303
void SetResetReason(uint32_t reason) noexcept
Value LastResetReason() returns.
Definition FluxPlatformBindHost.cpp:448
Electrical configuration of one MCU GPIO.
Definition FluxPlatformBind.h:71
One SPI controller and its pins.
Definition FluxPlatformBind.h:131
One chip select on an SPI bus.
Definition FluxPlatformBind.h:141