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

Namespaces

namespace  anonymous_namespace{VortexBoardBindEsp32c6.cpp}
 
namespace  anonymous_namespace{VortexBoardBindHost.cpp}
 
namespace  esp32c6
 
namespace  host
 

Classes

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

Enumerations

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

Functions

BaseUart * UartOpen (const UartSpec &spec) noexcept
 Open the board UART.
 
void UartClose () noexcept
 Close the UART opened by UartOpen() (idempotent).
 
bool SpiOpen (const SpiBusSpec &spec) noexcept
 Initialise the SPI bus.
 
int SpiAddDevice (const SpiDeviceSpec &spec) noexcept
 Add a chip select.
 
BaseSpi * SpiDevice (int index) noexcept
 The device at index, or nullptr.
 
void SpiClose () noexcept
 Remove every device and release the bus (idempotent).
 
bool I2cOpen (const I2cBusSpec &spec) noexcept
 Initialise the I2C bus.
 
int I2cAddDevice (const I2cDeviceSpec &spec) noexcept
 Add a device.
 
BaseI2c * I2cDevice (int index) noexcept
 The device at index, or nullptr.
 
bool I2cRemoveDevice (int index) noexcept
 Remove one device.
 
bool I2cProbe (uint8_t address, uint32_t timeout_ms) noexcept
 Address-only probe.
 
size_t 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 I2cReset () noexcept
 Recover a stuck bus (clock pulses + re-init).
 
void I2cClose () noexcept
 Remove every device and release the bus (idempotent).
 
BaseCan * CanOpen (const CanSpec &spec) noexcept
 Open the CAN controller.
 
void CanClose () noexcept
 Close the CAN controller (idempotent).
 
BaseGpio * 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 McuGpioCloseAll () noexcept
 Destroy every MCU GPIO created by McuGpioOpen(). Pointers handed out become invalid.
 
BaseNvs & Nvs (NvsRegion region) noexcept
 The NVS object of a region. Constructing it touches no hardware; call EnsureInitialized() on it.
 
BaseTemperature * McuTemperature () noexcept
 The MCU's on-chip temperature sensor (not yet initialised), or nullptr if the MCU has none.
 
uint64_t MonotonicMicros () noexcept
 Monotonic microseconds since boot, at the MCU's high-resolution timer (not the RTOS tick).
 
bool StatusLedOpen (int data_pin, uint32_t led_count) noexcept
 Open the addressable status LED chain on data_pin.
 
bool StatusLedShow (const uint32_t *rgb, uint32_t count, uint8_t brightness) noexcept
 Latch colours onto the chain.
 
void StatusLedClose () noexcept
 Turn the chain off and release it (idempotent).
 
constexpr const char * NvsNamespace (NvsRegion region) noexcept
 Namespace name of a region.
 

Enumeration Type Documentation

◆ NvsRegion

enum class vortex::bsp::NvsRegion : uint8_t
strong

The persistent-storage regions of the board.

Enumerator
App 

namespace "vortex"

Calibration 

namespace "vortex_cal"

Config 

namespace "vortex_cfg"

Count 

Function Documentation

◆ CanClose()

void vortex::bsp::CanClose ( )
noexcept

Close the CAN controller (idempotent).

Here is the caller graph for this function:

◆ CanOpen()

BaseCan * vortex::bsp::CanOpen ( const CanSpec &  spec)
noexcept

Open the CAN controller.

Returns
the port, or nullptr on failure.
Here is the caller graph for this function:

◆ I2cAddDevice()

int vortex::bsp::I2cAddDevice ( const I2cDeviceSpec &  spec)
noexcept

Add a device.

Returns
the device index (>= 0) or -1.
Here is the caller graph for this function:

◆ I2cClose()

void vortex::bsp::I2cClose ( )
noexcept

Remove every device and release the bus (idempotent).

Here is the caller graph for this function:

◆ I2cDevice()

BaseI2c * vortex::bsp::I2cDevice ( int  index)
noexcept

The device at index, or nullptr.

Here is the caller graph for this function:

◆ I2cOpen()

bool vortex::bsp::I2cOpen ( const I2cBusSpec &  spec)
noexcept

Initialise the I2C bus.

Returns
true on success.
Here is the caller graph for this function:

◆ I2cProbe()

bool vortex::bsp::I2cProbe ( uint8_t  address,
uint32_t  timeout_ms 
)
noexcept

Address-only probe.

Returns
true if a device acknowledged address.
Here is the caller graph for this function:

◆ I2cRemoveDevice()

bool vortex::bsp::I2cRemoveDevice ( int  index)
noexcept

Remove one device.

Returns
true if it existed.
Here is the caller graph for this function:

◆ I2cReset()

bool vortex::bsp::I2cReset ( )
noexcept

Recover a stuck bus (clock pulses + re-init).

Returns
true on success.
Here is the caller graph for this function:

◆ I2cScan()

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].

Parameters
outReceives the 7-bit addresses that acknowledged.
maxCapacity of out.
Returns
Number of addresses written.
Here is the caller graph for this function:

◆ McuGpioCloseAll()

void vortex::bsp::McuGpioCloseAll ( )
noexcept

Destroy every MCU GPIO created by McuGpioOpen(). Pointers handed out become invalid.

Here is the caller graph for this function:

◆ McuGpioOpen()

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).

Returns
The pin, initialised; nullptr if the row is not an MCU pin or init failed.
Here is the caller graph for this function:

◆ McuTemperature()

BaseTemperature * vortex::bsp::McuTemperature ( )
noexcept

The MCU's on-chip temperature sensor (not yet initialised), or nullptr if the MCU has none.

Here is the caller graph for this function:

◆ MonotonicMicros()

uint64_t vortex::bsp::MonotonicMicros ( )
noexcept

Monotonic microseconds since boot, at the MCU's high-resolution timer (not the RTOS tick).

Used to time TMCL batches; the RTOS tick (10 ms at CONFIG_FREERTOS_HZ=100) is far too coarse. Callable from any task.

Here is the caller graph for this function:

◆ Nvs()

BaseNvs & vortex::bsp::Nvs ( NvsRegion  region)
noexcept

The NVS object of a region. Constructing it touches no hardware; call EnsureInitialized() on it.

Here is the call graph for this function:

◆ NvsNamespace()

constexpr const char * vortex::bsp::NvsNamespace ( NvsRegion  region)
constexprnoexcept

Namespace name of a region.

Here is the caller graph for this function:

◆ SpiAddDevice()

int vortex::bsp::SpiAddDevice ( const SpiDeviceSpec &  spec)
noexcept

Add a chip select.

Returns
the device index (>= 0) or -1. Call after SpiOpen().
Here is the caller graph for this function:

◆ SpiClose()

void vortex::bsp::SpiClose ( )
noexcept

Remove every device and release the bus (idempotent).

Here is the caller graph for this function:

◆ SpiDevice()

BaseSpi * vortex::bsp::SpiDevice ( int  index)
noexcept

The device at index, or nullptr.

Here is the caller graph for this function:

◆ SpiOpen()

bool vortex::bsp::SpiOpen ( const SpiBusSpec &  spec)
noexcept

Initialise the SPI bus.

Returns
true on success.
Here is the caller graph for this function:

◆ StatusLedClose()

void vortex::bsp::StatusLedClose ( )
noexcept

Turn the chain off and release it (idempotent).

Here is the caller graph for this function:

◆ StatusLedOpen()

bool vortex::bsp::StatusLedOpen ( int  data_pin,
uint32_t  led_count 
)
noexcept

Open the addressable status LED chain on data_pin.

Returns
true on success.
Here is the caller graph for this function:

◆ StatusLedShow()

bool vortex::bsp::StatusLedShow ( const uint32_t *  rgb,
uint32_t  count,
uint8_t  brightness 
)
noexcept

Latch colours onto the chain.

Parameters
rgbOne 0xRRGGBB value per LED.
countNumber of entries in rgb (at most the count given to StatusLedOpen()).
brightnessGlobal brightness 0..255 applied by the LED driver.
Returns
true when the frame was sent.
Here is the caller graph for this function:

◆ UartClose()

void vortex::bsp::UartClose ( )
noexcept

Close the UART opened by UartOpen() (idempotent).

Here is the caller graph for this function:

◆ UartOpen()

BaseUart * vortex::bsp::UartOpen ( const UartSpec &  spec)
noexcept

Open the board UART.

Returns
the port, or nullptr on failure.
Here is the caller graph for this function: