HardFOC Flux V1 HAL
Unified HAL API for the HardFOC Flux valve-control platform (ESP32-S3)
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
FluxPlatformBindEsp32s3.cpp File Reference

ESP32-S3 implementation of the Flux platform binding (bsp_bind/FluxPlatformBind.h). More...

#include "bsp_bind/FluxPlatformBind.h"
#include <array>
#include <optional>
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/mcu/esp32/EspAdc.h"
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/mcu/esp32/EspCan.h"
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/mcu/esp32/EspGpio.h"
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/mcu/esp32/EspNvs.h"
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/mcu/esp32/EspSpi.h"
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/mcu/esp32/EspTemperature.h"
#include "core/hf-core-drivers/internal/hf-internal-interface-wrap/inc/mcu/esp32/EspUart.h"
#include "esp_heap_caps.h"
#include "esp_system.h"
Include dependency graph for FluxPlatformBindEsp32s3.cpp:

Namespaces

namespace  flux
 
namespace  flux::bsp
 
namespace  flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}
 

Functions

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.
 
void flux::bsp::DestroyGpio (size_t slot) noexcept
 Destroy the GPIO object in slot (releases the pin).
 
uint8_t flux::bsp::InternalAdcChannelCount () noexcept
 Number of channels per unit of the MCU ADC (0 when the family has none).
 
BaseAdc * flux::bsp::CreateInternalAdc (uint8_t unit, uint32_t channel_mask) noexcept
 Create and initialise the MCU ADC unit with the given channels enabled.
 
void flux::bsp::DestroyInternalAdc () noexcept
 Destroy the MCU ADC unit.
 
BaseTemperature * flux::bsp::CreateDieTemperature () noexcept
 Create the MCU die-temperature sensor (not initialised). nullptr if the family has none.
 
void flux::bsp::DestroyDieTemperature () noexcept
 Destroy the die-temperature sensor.
 
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).
 
bool flux::bsp::CreateSpiBus (size_t bus, const SpiBusSpec &spec) noexcept
 Create and initialise SPI bus bus.
 
BaseSpi * flux::bsp::CreateSpiDevice (size_t bus, const SpiDeviceSpec &spec) noexcept
 Add a device to an initialised SPI bus.
 
void flux::bsp::DestroySpiBus (size_t bus) noexcept
 Destroy SPI bus bus and every device on it.
 
BaseCan * flux::bsp::CreateCan (const CanSpec &spec) noexcept
 Create the CAN controller (configured, not started). nullptr on failure.
 
void flux::bsp::DestroyCan () noexcept
 Destroy the CAN controller.
 
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.
 
void flux::bsp::DestroyUart (uint8_t port) noexcept
 Destroy the UART on port.
 
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.
 
bool flux::bsp::LedStripBegin (const LedStripSpec &spec) noexcept
 Create and start the strip.
 
void flux::bsp::LedStripSetPixel (uint16_t index, uint32_t rgb) noexcept
 Stage a 0xRRGGBB colour for LED index (sent on LedStripShow).
 
void flux::bsp::LedStripSetBrightness (uint8_t brightness) noexcept
 Global brightness 0..255 applied to the next LedStripShow.
 
bool flux::bsp::LedStripShow () noexcept
 Send the staged colours.
 
void flux::bsp::LedStripEnd () noexcept
 Stop the strip and release its peripheral.
 
uint32_t flux::bsp::LastResetReason () noexcept
 Opaque reset cause of the previous boot (family-specific numbering; 0 when unknown).
 
void flux::bsp::SystemRestart () noexcept
 Software reset of the MCU. Does not return.
 
uint32_t flux::bsp::FreeHeapBytes () noexcept
 Free bytes in the default heap (0 when unknown).
 
uint32_t flux::bsp::LargestFreeHeapBlock () noexcept
 Largest contiguous free block in the default heap (0 when unknown).
 

Variables

std::array< std::optional< EspGpio >, kMaxGpioSlots > flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::g_gpio
 
std::optional< EspAdc > flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::g_adc
 
std::optional< EspTemperature > flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::g_die_temp
 
std::array< std::optional< EspNvs >, kMaxNvsRegions > flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::g_nvs
 
std::array< std::optional< EspSpiBus >, kMaxSpiBuses > flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::g_spi
 
std::array< uint8_t, kMaxSpiBuses > flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::g_spi_device_count {}
 
std::optional< EspCan > flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::g_can
 
std::array< std::optional< EspUart >, kMaxUartPorts > flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::g_uart
 
constexpr uint16_t flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::kLedT0h = 14
 
constexpr uint16_t flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::kLedT1h = 52
 
constexpr uint16_t flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::kLedT0l = 52
 
constexpr uint16_t flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::kLedT1l = 52
 
constexpr uint8_t flux::bsp::anonymous_namespace{FluxPlatformBindEsp32s3.cpp}::kLedInitialBrightness = 255
 

Detailed Description

ESP32-S3 implementation of the Flux platform binding (bsp_bind/FluxPlatformBind.h).

The only translation unit of the HAL that names Esp* wrappers, ESP-IDF headers or the WS2812 RMT driver. Every object lives in a fixed std::optional slot in static storage, so the binding itself never calls the heap allocator; the ESP-IDF drivers underneath (SPI master, TWAI, UART, RMT) allocate their own queues inside the Create* call, which runs from the owning manager's EnsureInitialized().

Author
HardFOC Team
Date
2026