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

ESP32-C6 implementation of the Vortex board binding (VortexBoardBind.h). More...

#include "bsp_bind/VortexBoardBind.h"
#include "bsp_bind/esp32c6/VortexBoardBindEsp32c6.h"
#include <algorithm>
#include <array>
#include <optional>
#include <vector>
#include "esp_timer.h"
#include "handlers/ws2812/Ws2812Handler.h"
#include "mcu/esp32/EspCan.h"
#include "mcu/esp32/EspGpio.h"
#include "mcu/esp32/EspI2c.h"
#include "mcu/esp32/EspNvs.h"
#include "mcu/esp32/EspSpi.h"
#include "mcu/esp32/EspTemperature.h"
#include "mcu/esp32/EspUart.h"
Include dependency graph for VortexBoardBindEsp32c6.cpp:

Namespaces

namespace  vortex
 
namespace  vortex::bsp
 
namespace  vortex::bsp::anonymous_namespace{VortexBoardBindEsp32c6.cpp}
 
namespace  vortex::bsp::esp32c6
 

Functions

std::optional< EspUart > & vortex::bsp::anonymous_namespace{VortexBoardBindEsp32c6.cpp}::UartSlot () noexcept
 
std::optional< EspSpiBus > & vortex::bsp::anonymous_namespace{VortexBoardBindEsp32c6.cpp}::SpiSlot () noexcept
 
std::optional< EspI2cBus > & vortex::bsp::anonymous_namespace{VortexBoardBindEsp32c6.cpp}::I2cSlot () noexcept
 
std::optional< EspCan > & vortex::bsp::anonymous_namespace{VortexBoardBindEsp32c6.cpp}::CanSlot () noexcept
 
std::array< std::optional< EspGpio >, kGpioSlots > & vortex::bsp::anonymous_namespace{VortexBoardBindEsp32c6.cpp}::GpioSlots () noexcept
 
std::optional< Ws2812Handler > & vortex::bsp::anonymous_namespace{VortexBoardBindEsp32c6.cpp}::LedSlot () 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).
 
EspCan * vortex::bsp::esp32c6::CanController () noexcept
 The TWAI controller CommChannelsManager opened, as its concrete EspCan.
 
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).
 

Variables

constexpr size_t vortex::bsp::anonymous_namespace{VortexBoardBindEsp32c6.cpp}::kGpioSlots = static_cast<size_t>(HfFunctionalGpioPin::HF_FUNCTIONAL_GPIO_COUNT)
 

Detailed Description

ESP32-C6 implementation of the Vortex board binding (VortexBoardBind.h).

The only translation unit of the HAL that constructs ESP32 peripherals: EspSpiBus, EspI2cBus, EspUart, EspCan, EspGpio, EspNvs, EspTemperature, and the WS2812 status LED through hf-core's Ws2812Handler. Every object lives in function-local static storage (std::optional, emplaced on Open and reset on Close), so the binding itself allocates nothing; the ESP-IDF drivers underneath allocate their queues inside Open.

Thread safety: none; each function is called by its owning manager under that manager's lock.