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

The board binding: the only way the Vortex managers reach MCU peripherals. More...

#include <cstddef>
#include <cstdint>
#include "base/BaseCan.h"
#include "base/BaseGpio.h"
#include "base/BaseI2c.h"
#include "base/BaseNvs.h"
#include "base/BaseSpi.h"
#include "base/BaseTemperature.h"
#include "base/BaseUart.h"
#include "core/hf-core-drivers/internal/hf-pincfg/src/hf_functional_pin_config_vortex_v1.hpp"
Include dependency graph for VortexBoardBind.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  vortex::bsp::UartSpec
 UART port, framing 8N1, no flow control. More...
 
struct  vortex::bsp::SpiBusSpec
 SPI master bus (one per board on Vortex: SPI2). More...
 
struct  vortex::bsp::SpiDeviceSpec
 One chip select on the SPI bus. More...
 
struct  vortex::bsp::I2cBusSpec
 I2C master bus. More...
 
struct  vortex::bsp::I2cDeviceSpec
 One 7-bit device on the I2C bus. More...
 
struct  vortex::bsp::CanSpec
 Classic CAN controller. More...
 

Namespaces

namespace  vortex
 
namespace  vortex::bsp
 

Enumerations

enum class  vortex::bsp::NvsRegion : uint8_t { vortex::bsp::App = 0 , vortex::bsp::Calibration , vortex::bsp::Config , vortex::bsp::Count }
 The persistent-storage regions of the board. More...
 

Functions

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.
 
constexpr const char * vortex::bsp::NvsNamespace (NvsRegion region) noexcept
 Namespace name of a region.
 
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).
 

Detailed Description

The board binding: the only way the Vortex managers reach MCU peripherals.

Managers above this header are MCU-free: they include Base* interfaces, hf-core handlers and this file, never an ESP-IDF, FreeRTOS or mcu/esp32/ header. Each function here is implemented once per platform, and CMake links exactly one implementation:

Directory Platform Built by
bsp_bind/esp32c6/ ESP32-C6 (Esp* wraps, RMT LED) the ESP-IDF component
bsp_bind/host/ hf-core host mocks tests/host

A future STM32 board adds its own directory (for example bsp_bind/stm32h7/) and nothing above it changes. tools/lint/ lint_hal_boundary.sh enforces the rule.

Ownership: every object a function returns lives in static storage inside the binding and stays valid until the matching Close / CloseAll call; the binding never allocates after Open returns. Thread safety: none. Each function is called by one owning manager, under that manager's lock (CommChannelsManager for buses, GpioManager for MCU pins, NvsManager, TemperatureManager, LedManager). Error handling: Open functions return nullptr / false / a negative index on failure.