HardFOC Vortex V1 HAL
Unified HAL API for the HardFOC Vortex motor-control platform (ESP32-C6, TMC9660)
Loading...
Searching...
No Matches
Classes | Namespaces | Functions | Variables
VortexBoardBindHost.cpp File Reference

Host implementation of VortexBoardBind.h over hf-core's host mocks (tests/host only). More...

#include "bsp_bind/host/VortexBoardBindHost.h"
#include "RtosMutex.h"
#include <algorithm>
#include <array>
#include <optional>
#include <cstdint>
#include <set>
Include dependency graph for VortexBoardBindHost.cpp:

Classes

struct  vortex::bsp::anonymous_namespace{VortexBoardBindHost.cpp}::I2cSlot
 
struct  vortex::bsp::anonymous_namespace{VortexBoardBindHost.cpp}::State
 

Namespaces

namespace  vortex
 
namespace  vortex::bsp
 
namespace  vortex::bsp::anonymous_namespace{VortexBoardBindHost.cpp}
 
namespace  vortex::bsp::host
 

Functions

State & vortex::bsp::anonymous_namespace{VortexBoardBindHost.cpp}::S () noexcept
 
BaseUart * vortex::bsp::UartOpen (const UartSpec &spec) noexcept
 Open the board UART.
 
void vortex::bsp::UartClose () noexcept
 Close the UART opened by UartOpen() (idempotent).
 
bool vortex::bsp::SpiOpen (const SpiBusSpec &spec) noexcept
 Initialise the SPI bus.
 
int vortex::bsp::SpiAddDevice (const SpiDeviceSpec &spec) noexcept
 Add a chip select.
 
BaseSpi * vortex::bsp::SpiDevice (int index) noexcept
 The device at index, or nullptr.
 
void vortex::bsp::SpiClose () noexcept
 Remove every device and release the bus (idempotent).
 
bool vortex::bsp::I2cOpen (const I2cBusSpec &spec) noexcept
 Initialise the I2C bus.
 
int vortex::bsp::I2cAddDevice (const I2cDeviceSpec &spec) noexcept
 Add a device.
 
BaseI2c * vortex::bsp::I2cDevice (int index) noexcept
 The device at index, or nullptr.
 
bool vortex::bsp::I2cRemoveDevice (int index) noexcept
 Remove one device.
 
bool vortex::bsp::I2cProbe (uint8_t address, uint32_t timeout_ms) noexcept
 Address-only probe.
 
size_t vortex::bsp::I2cScan (uint8_t *out, size_t max, uint8_t first, uint8_t last, uint32_t timeout_ms) noexcept
 Probe every address in [first, last].
 
bool vortex::bsp::I2cReset () noexcept
 Recover a stuck bus (clock pulses + re-init).
 
void vortex::bsp::I2cClose () noexcept
 Remove every device and release the bus (idempotent).
 
BaseCan * vortex::bsp::CanOpen (const CanSpec &spec) noexcept
 Open the CAN controller.
 
void vortex::bsp::CanClose () noexcept
 Close the CAN controller (idempotent).
 
BaseGpio * vortex::bsp::McuGpioOpen (HfFunctionalGpioPin pin, hf_gpio_direction_t direction, hf_gpio_active_state_t active, hf_gpio_output_mode_t output_mode, hf_gpio_pull_mode_t pull) noexcept
 Create the MCU GPIO for a functional pin (one slot per pin; a second call returns the same object).
 
void vortex::bsp::McuGpioCloseAll () noexcept
 Destroy every MCU GPIO created by McuGpioOpen(). Pointers handed out become invalid.
 
BaseNvs & vortex::bsp::Nvs (NvsRegion region) noexcept
 The NVS object of a region. Constructing it touches no hardware; call EnsureInitialized() on it.
 
BaseTemperature * vortex::bsp::McuTemperature () noexcept
 The MCU's on-chip temperature sensor (not yet initialised), or nullptr if the MCU has none.
 
uint64_t vortex::bsp::MonotonicMicros () noexcept
 Monotonic microseconds since boot, at the MCU's high-resolution timer (not the RTOS tick).
 
bool vortex::bsp::StatusLedOpen (int data_pin, uint32_t led_count) noexcept
 Open the addressable status LED chain on data_pin.
 
bool vortex::bsp::StatusLedShow (const uint32_t *rgb, uint32_t count, uint8_t brightness) noexcept
 Latch colours onto the chain.
 
void vortex::bsp::StatusLedClose () noexcept
 Turn the chain off and release it (idempotent).
 
void vortex::bsp::host::Reset () noexcept
 Close every object, forget the log and the failures, and remove every simulated I2C chip.
 
Failures & vortex::bsp::host::Fail () noexcept
 Failure injection for the next Open() calls (cleared by Reset()).
 
const OpenLog & vortex::bsp::host::Log () noexcept
 What the managers asked the binding for since the last Reset().
 
void vortex::bsp::host::SetI2cPresent (uint8_t address, bool present=true) noexcept
 Simulate a chip that acknowledges address on the I2C bus (probe and scan see it).
 
MockUart * vortex::bsp::host::Uart () noexcept
 
MockCan * vortex::bsp::host::Can () noexcept
 
MockSpi * vortex::bsp::host::Spi (int index) noexcept
 SPI device by the index SpiAddDevice() returned.
 
MockI2c * vortex::bsp::host::I2c (int index) noexcept
 I2C device by the index I2cAddDevice() returned.
 
MockI2c * vortex::bsp::host::I2cAt (uint8_t address) noexcept
 I2C device added at address, or nullptr.
 
MockGpio * vortex::bsp::host::Gpio (HfFunctionalGpioPin pin) noexcept
 MCU GPIO of a functional pin, or nullptr if McuGpioOpen() was not called for it.
 
MockNvs & vortex::bsp::host::NvsMock (NvsRegion region) noexcept
 
MockTemperature & vortex::bsp::host::Temperature () noexcept
 
const std::vector< LedFrame > & vortex::bsp::host::LedFrames () noexcept
 Frames latched onto the status LED since the last Reset().
 
bool vortex::bsp::host::LedOpen () noexcept
 True while the status LED is open.
 

Variables

constexpr size_t vortex::bsp::anonymous_namespace{VortexBoardBindHost.cpp}::kMaxSpiDevices = 8
 
constexpr size_t vortex::bsp::anonymous_namespace{VortexBoardBindHost.cpp}::kMaxI2cDevices = 12
 
constexpr size_t vortex::bsp::anonymous_namespace{VortexBoardBindHost.cpp}::kGpioSlots = static_cast<size_t>(HfFunctionalGpioPin::HF_FUNCTIONAL_GPIO_COUNT)
 

Detailed Description

Host implementation of VortexBoardBind.h over hf-core's host mocks (tests/host only).