HardFOC Flux V1 HAL
Unified HAL API for the HardFOC Flux valve-control platform (ESP32-S3)
Loading...
Searching...
No Matches
Namespaces | Classes | Functions | Variables
flux::bsp Namespace Reference

Namespaces

namespace  anonymous_namespace{FluxPlatformBindEsp32s3.cpp}
 
namespace  anonymous_namespace{FluxPlatformBindHost.cpp}
 
namespace  host
 

Classes

struct  CanSpec
 The CAN controller and its pins. More...
 
struct  GpioSpec
 Electrical configuration of one MCU GPIO. More...
 
struct  LedStripSpec
 An addressable RGB LED strip on one data pin. More...
 
struct  SpiBusSpec
 One SPI controller and its pins. More...
 
struct  SpiDeviceSpec
 One chip select on an SPI bus. More...
 
struct  UartSpec
 One hardware UART, 8N1, no flow control. More...
 

Functions

BaseGpio * CreateGpio (size_t slot, const GpioSpec &spec) noexcept
 Create the GPIO object for slot. No hardware access until the object is initialised.
 
void DestroyGpio (size_t slot) noexcept
 Destroy the GPIO object in slot (releases the pin).
 
uint8_t InternalAdcChannelCount () noexcept
 Number of channels per unit of the MCU ADC (0 when the family has none).
 
BaseAdc * CreateInternalAdc (uint8_t unit, uint32_t channel_mask) noexcept
 Create and initialise the MCU ADC unit with the given channels enabled.
 
void DestroyInternalAdc () noexcept
 Destroy the MCU ADC unit.
 
BaseTemperature * CreateDieTemperature () noexcept
 Create the MCU die-temperature sensor (not initialised). nullptr if the family has none.
 
void DestroyDieTemperature () noexcept
 Destroy the die-temperature sensor.
 
BaseNvs & NvsRegion (size_t slot, const char *name_space) noexcept
 The NVS region in slot, created on first call for name_space (no flash access).
 
bool CreateSpiBus (size_t bus, const SpiBusSpec &spec) noexcept
 Create and initialise SPI bus bus.
 
BaseSpi * CreateSpiDevice (size_t bus, const SpiDeviceSpec &spec) noexcept
 Add a device to an initialised SPI bus.
 
void DestroySpiBus (size_t bus) noexcept
 Destroy SPI bus bus and every device on it.
 
BaseCan * CreateCan (const CanSpec &spec) noexcept
 Create the CAN controller (configured, not started). nullptr on failure.
 
void DestroyCan () noexcept
 Destroy the CAN controller.
 
BaseUart * CreateUart (const UartSpec &spec, bool *rs485) noexcept
 Create and initialise a UART. When spec.rts >= 0 the port is switched to RS-485 half duplex.
 
void DestroyUart (uint8_t port) noexcept
 Destroy the UART on port.
 
BaseUsbSerialJtag * AcquireUsbSerialJtag (const hf_usb_serial_jtag_config_t &cfg) noexcept
 The USB Serial/JTAG controller, initialised. nullptr when the family has none or the feature is compiled out (HF_CORE_ENABLE_USB_SERIAL_JTAG=OFF). First call wins cfg.
 
bool LedStripBegin (const LedStripSpec &spec) noexcept
 Create and start the strip.
 
void LedStripSetPixel (uint16_t index, uint32_t rgb) noexcept
 Stage a 0xRRGGBB colour for LED index (sent on LedStripShow).
 
void LedStripSetBrightness (uint8_t brightness) noexcept
 Global brightness 0..255 applied to the next LedStripShow.
 
bool LedStripShow () noexcept
 Send the staged colours.
 
void LedStripEnd () noexcept
 Stop the strip and release its peripheral.
 
uint32_t LastResetReason () noexcept
 Opaque reset cause of the previous boot (family-specific numbering; 0 when unknown).
 
void SystemRestart () noexcept
 Software reset of the MCU. Does not return.
 
uint32_t FreeHeapBytes () noexcept
 Free bytes in the default heap (0 when unknown).
 
uint32_t LargestFreeHeapBlock () noexcept
 Largest contiguous free block in the default heap (0 when unknown).
 

Variables

constexpr size_t kMaxGpioSlots = 64
 GPIO objects (one per functional pin index)
 
constexpr size_t kMaxSpiBuses = 2
 SPI controllers in use.
 
constexpr size_t kMaxSpiDevicesPerBus = 4
 Chip selects per SPI bus.
 
constexpr size_t kMaxUartPorts = 3
 Hardware UART ports.
 
constexpr size_t kMaxNvsRegions = 3
 NVS namespaces opened by NvsManager.
 
constexpr uint8_t kMaxInternalAdcChannels = 16
 Upper bound on MCU ADC channels per unit.
 

Function Documentation

◆ AcquireUsbSerialJtag()

BaseUsbSerialJtag * flux::bsp::AcquireUsbSerialJtag ( const hf_usb_serial_jtag_config_t &  cfg)
noexcept

The USB Serial/JTAG controller, initialised. nullptr when the family has none or the feature is compiled out (HF_CORE_ENABLE_USB_SERIAL_JTAG=OFF). First call wins cfg.

Here is the caller graph for this function:

◆ CreateCan()

BaseCan * flux::bsp::CreateCan ( const CanSpec &  spec)
noexcept

Create the CAN controller (configured, not started). nullptr on failure.

Here is the caller graph for this function:

◆ CreateDieTemperature()

BaseTemperature * flux::bsp::CreateDieTemperature ( )
noexcept

Create the MCU die-temperature sensor (not initialised). nullptr if the family has none.

Here is the caller graph for this function:

◆ CreateGpio()

BaseGpio * flux::bsp::CreateGpio ( size_t  slot,
const GpioSpec &  spec 
)
noexcept

Create the GPIO object for slot. No hardware access until the object is initialised.

Parameters
slotIndex below kMaxGpioSlots (the functional pin index).
specPin and electrical configuration.
Returns
The object, or nullptr if slot is out of range or already in use.
Here is the caller graph for this function:

◆ CreateInternalAdc()

BaseAdc * flux::bsp::CreateInternalAdc ( uint8_t  unit,
uint32_t  channel_mask 
)
noexcept

Create and initialise the MCU ADC unit with the given channels enabled.

Parameters
unitADC unit (0 = ADC1).
channel_maskBit n set = enable channel n (full-scale range, 12-bit).
Returns
The ADC, or nullptr if the unit failed to initialise (the slot is then empty).
Here is the caller graph for this function:

◆ CreateSpiBus()

bool flux::bsp::CreateSpiBus ( size_t  bus,
const SpiBusSpec &  spec 
)
noexcept

Create and initialise SPI bus bus.

Returns
true when the controller is up.
Here is the caller graph for this function:

◆ CreateSpiDevice()

BaseSpi * flux::bsp::CreateSpiDevice ( size_t  bus,
const SpiDeviceSpec &  spec 
)
noexcept

Add a device to an initialised SPI bus.

Returns
The device, or nullptr if the bus is down or the device could not be added.
Here is the caller graph for this function:

◆ CreateUart()

BaseUart * flux::bsp::CreateUart ( const UartSpec &  spec,
bool *  rs485 
)
noexcept

Create and initialise a UART. When spec.rts >= 0 the port is switched to RS-485 half duplex.

Parameters
specPort and line configuration.
[out]rs485Set to true when RS-485 mode was requested and applied (may be nullptr).
Returns
The UART, or nullptr if the port failed to initialise.
Here is the caller graph for this function:

◆ DestroyCan()

void flux::bsp::DestroyCan ( )
noexcept

Destroy the CAN controller.

Here is the caller graph for this function:

◆ DestroyDieTemperature()

void flux::bsp::DestroyDieTemperature ( )
noexcept

Destroy the die-temperature sensor.

Here is the caller graph for this function:

◆ DestroyGpio()

void flux::bsp::DestroyGpio ( size_t  slot)
noexcept

Destroy the GPIO object in slot (releases the pin).

Here is the caller graph for this function:

◆ DestroyInternalAdc()

void flux::bsp::DestroyInternalAdc ( )
noexcept

Destroy the MCU ADC unit.

Here is the caller graph for this function:

◆ DestroySpiBus()

void flux::bsp::DestroySpiBus ( size_t  bus)
noexcept

Destroy SPI bus bus and every device on it.

Here is the caller graph for this function:

◆ DestroyUart()

void flux::bsp::DestroyUart ( uint8_t  port)
noexcept

Destroy the UART on port.

◆ FreeHeapBytes()

uint32_t flux::bsp::FreeHeapBytes ( )
noexcept

Free bytes in the default heap (0 when unknown).

Here is the caller graph for this function:

◆ InternalAdcChannelCount()

uint8_t flux::bsp::InternalAdcChannelCount ( )
noexcept

Number of channels per unit of the MCU ADC (0 when the family has none).

Here is the caller graph for this function:

◆ LargestFreeHeapBlock()

uint32_t flux::bsp::LargestFreeHeapBlock ( )
noexcept

Largest contiguous free block in the default heap (0 when unknown).

Here is the caller graph for this function:

◆ LastResetReason()

uint32_t flux::bsp::LastResetReason ( )
noexcept

Opaque reset cause of the previous boot (family-specific numbering; 0 when unknown).

Here is the caller graph for this function:

◆ LedStripBegin()

bool flux::bsp::LedStripBegin ( const LedStripSpec &  spec)
noexcept

Create and start the strip.

Returns
true when it is ready.
Here is the caller graph for this function:

◆ LedStripEnd()

void flux::bsp::LedStripEnd ( )
noexcept

Stop the strip and release its peripheral.

Here is the caller graph for this function:

◆ LedStripSetBrightness()

void flux::bsp::LedStripSetBrightness ( uint8_t  brightness)
noexcept

Global brightness 0..255 applied to the next LedStripShow.

Here is the caller graph for this function:

◆ LedStripSetPixel()

void flux::bsp::LedStripSetPixel ( uint16_t  index,
uint32_t  rgb 
)
noexcept

Stage a 0xRRGGBB colour for LED index (sent on LedStripShow).

Here is the caller graph for this function:

◆ LedStripShow()

bool flux::bsp::LedStripShow ( )
noexcept

Send the staged colours.

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

◆ NvsRegion()

BaseNvs & flux::bsp::NvsRegion ( size_t  slot,
const char *  name_space 
)
noexcept

The NVS region in slot, created on first call for name_space (no flash access).

Parameters
slotIndex below kMaxNvsRegions.
name_spaceNamespace name (at most 15 characters); ignored after the first call.
Returns
Reference valid for the life of the program.

◆ SystemRestart()

void flux::bsp::SystemRestart ( )
noexcept

Software reset of the MCU. Does not return.

Here is the caller graph for this function:

Variable Documentation

◆ kMaxGpioSlots

constexpr size_t flux::bsp::kMaxGpioSlots = 64
inlineconstexpr

GPIO objects (one per functional pin index)

◆ kMaxInternalAdcChannels

constexpr uint8_t flux::bsp::kMaxInternalAdcChannels = 16
inlineconstexpr

Upper bound on MCU ADC channels per unit.

◆ kMaxNvsRegions

constexpr size_t flux::bsp::kMaxNvsRegions = 3
inlineconstexpr

NVS namespaces opened by NvsManager.

◆ kMaxSpiBuses

constexpr size_t flux::bsp::kMaxSpiBuses = 2
inlineconstexpr

SPI controllers in use.

◆ kMaxSpiDevicesPerBus

constexpr size_t flux::bsp::kMaxSpiDevicesPerBus = 4
inlineconstexpr

Chip selects per SPI bus.

◆ kMaxUartPorts

constexpr size_t flux::bsp::kMaxUartPorts = 3
inlineconstexpr

Hardware UART ports.