|
| enum class | hf::stm32::GpioPort : hf_u8_t {
hf::stm32::A = 0
, hf::stm32::B = 1
, hf::stm32::C = 2
, hf::stm32::D = 3
,
hf::stm32::E = 4
, hf::stm32::F = 5
, hf::stm32::G = 6
, hf::stm32::H = 7
,
hf::stm32::I = 8
, hf::stm32::J = 9
, hf::stm32::K = 10
} |
| | GPIO port index (A=0, B=1, ... K=10) More...
|
| |
| enum class | hf_stm32_i2c_addr_mode_t : hf_u8_t { ADDR_7BIT = 0
, ADDR_10BIT = 1
} |
| | I2C address mode. More...
|
| |
| enum class | hf_stm32_spi_mode_t : hf_u8_t { MODE_0 = 0
, MODE_1 = 1
, MODE_2 = 2
, MODE_3 = 3
} |
| | SPI mode (CPOL/CPHA) More...
|
| |
| enum class | hf_stm32_uart_data_bits_t : hf_u8_t { DATA_7_BITS = 7
, DATA_8_BITS = 8
, DATA_9_BITS = 9
} |
| | UART data bits. More...
|
| |
| enum class | hf_stm32_uart_parity_t : hf_u8_t { NONE = 0
, EVEN = 1
, ODD = 2
} |
| | UART parity. More...
|
| |
| enum class | hf_stm32_uart_stop_bits_t : hf_u8_t { STOP_1 = 0
, STOP_2 = 1
} |
| | UART stop bits. More...
|
| |
| enum class | hf_stm32_can_type_t : hf_u8_t { BXCAN = 0
, FDCAN = 1
} |
| | CAN bus type selection. More...
|
| |
| enum class | hf_stm32_pwm_channel_t : hf_u32_t { CHANNEL_1 = 0x00000000U
, CHANNEL_2 = 0x00000004U
, CHANNEL_3 = 0x00000008U
, CHANNEL_4 = 0x0000000CU
} |
| | PWM channel identifier (maps to TIM_CHANNEL_1..4) More...
|
| |
| enum class | hf_stm32_adc_resolution_t : hf_u8_t {
BITS_6 = 6
, BITS_8 = 8
, BITS_10 = 10
, BITS_12 = 12
,
BITS_14 = 14
, BITS_16 = 16
} |
| | ADC resolution. More...
|
| |
| enum class | hf::stm32::HalStatus : hf_u8_t { hf::stm32::OK = 0x00U
, hf::stm32::ERROR = 0x01U
, hf::stm32::BUSY = 0x02U
, hf::stm32::TIMEOUT = 0x03U
} |
| | STM32 HAL status codes (mirrors HAL_StatusTypeDef without HAL include) More...
|
| |
|
| static constexpr hf_u8_t | hf::stm32::kMaxGpioPorts = 11 |
| | Maximum GPIO ports (A..K = 11 on largest STM32H7)
|
| |
| static constexpr hf_u8_t | hf::stm32::kPinsPerPort = 16 |
| | Maximum pins per GPIO port.
|
| |
| static constexpr hf_u16_t | hf::stm32::kMaxGpioPins = kMaxGpioPorts * kPinsPerPort |
| | Maximum total GPIO pins (ports * pins_per_port)
|
| |
| static constexpr hf_u8_t | hf::stm32::kAdcMaxChannels = 20 |
| | ADC maximum channels (typical STM32F4/H7)
|
| |
| static constexpr hf_u8_t | hf::stm32::kAdcMaxResolutionBits = 16 |
| | ADC maximum resolution (bits)
|
| |
| static constexpr hf_u8_t | hf::stm32::kAdcDefaultResolutionBits = 12 |
| |
| static constexpr float | hf::stm32::kAdcDefaultVrefV = 3.3f |
| | ADC reference voltage (V) — most STM32 boards.
|
| |
| static constexpr hf_u32_t | hf::stm32::kI2cMaxFreqHz = 1000000 |
| | I2C limits.
|
| |
| static constexpr hf_u32_t | hf::stm32::kI2cStandardFreqHz = 100000 |
| |
| static constexpr hf_u32_t | hf::stm32::kI2cFastFreqHz = 400000 |
| |
| static constexpr hf_u32_t | hf::stm32::kI2cFastPlusFreqHz = 1000000 |
| |
| static constexpr hf_u16_t | hf::stm32::kI2cMaxTransferBytes = 65535 |
| |
| static constexpr hf_u32_t | hf::stm32::kSpiMaxFreqHz = 50000000 |
| | SPI limits.
|
| |
| static constexpr hf_u32_t | hf::stm32::kSpiDefaultFreqHz = 1000000 |
| |
| static constexpr hf_u16_t | hf::stm32::kSpiMaxTransferBytes = 65535 |
| |
| static constexpr hf_u32_t | hf::stm32::kUartMaxBaudRate = 10000000 |
| | UART limits.
|
| |
| static constexpr hf_u32_t | hf::stm32::kUartDefaultBaudRate = 115200 |
| |
| static constexpr hf_u16_t | hf::stm32::kUartDefaultBufferSize = 256 |
| |
| static constexpr hf_u64_t | hf::stm32::kTimerMinPeriodUs = 1 |
| | Timer limits (in microseconds)
|
| |
| static constexpr hf_u64_t | hf::stm32::kTimerMaxPeriodUs = 4294967295ULL |
| |
| static constexpr hf_u64_t | hf::stm32::kTimerResolutionUs = 1 |
| |
| static constexpr hf_u32_t | hf::stm32::kPwmMaxFreqHz = 1000000 |
| | PWM limits.
|
| |
| static constexpr hf_u32_t | hf::stm32::kPwmMinFreqHz = 1 |
| |
| static constexpr hf_u16_t | hf::stm32::kPwmMaxResolution = 65535 |
| |
| static constexpr hf_u8_t | hf::stm32::kPwmMaxChannelsPerTimer = 4 |
| |
| static constexpr hf_u32_t | hf::stm32::kCanMaxBaudRate = 1000000 |
| | CAN limits.
|
| |
| static constexpr hf_u32_t | hf::stm32::kCanFdMaxBaudRate = 8000000 |
| |
| static constexpr hf_u16_t | hf::stm32::kCanDefaultQueueSize = 16 |
| |
| static constexpr size_t | hf::stm32::kNvsMaxKeyLength = 64 |
| | Flash/NVS limits.
|
| |
| static constexpr size_t | hf::stm32::kNvsMaxValueSize = 4096 |
| |
| static constexpr size_t | hf::stm32::kNvsDefaultSectorSize = 4096 |
| |
| static constexpr float | hf::stm32::kTempSensorMinC = -40.0f |
| | Temperature sensor.
|
| |
| static constexpr float | hf::stm32::kTempSensorMaxC = 125.0f |
| |
| static constexpr float | hf::stm32::kTempSensorTypAccuracyC = 1.5f |
| |
| static constexpr hf_u32_t | hf::stm32::kLoggerMaxMessageLen = 256 |
| | Logger.
|
| |
| static constexpr hf_u32_t | hf::stm32::kLoggerDefaultBufferSize = 1024 |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA0 = EncodePin(GpioPort::A, 0) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA1 = EncodePin(GpioPort::A, 1) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA2 = EncodePin(GpioPort::A, 2) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA3 = EncodePin(GpioPort::A, 3) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA4 = EncodePin(GpioPort::A, 4) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA5 = EncodePin(GpioPort::A, 5) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA6 = EncodePin(GpioPort::A, 6) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA7 = EncodePin(GpioPort::A, 7) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA8 = EncodePin(GpioPort::A, 8) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA9 = EncodePin(GpioPort::A, 9) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA10 = EncodePin(GpioPort::A, 10) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA11 = EncodePin(GpioPort::A, 11) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA12 = EncodePin(GpioPort::A, 12) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA13 = EncodePin(GpioPort::A, 13) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA14 = EncodePin(GpioPort::A, 14) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PA15 = EncodePin(GpioPort::A, 15) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB0 = EncodePin(GpioPort::B, 0) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB1 = EncodePin(GpioPort::B, 1) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB2 = EncodePin(GpioPort::B, 2) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB3 = EncodePin(GpioPort::B, 3) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB4 = EncodePin(GpioPort::B, 4) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB5 = EncodePin(GpioPort::B, 5) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB6 = EncodePin(GpioPort::B, 6) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB7 = EncodePin(GpioPort::B, 7) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB8 = EncodePin(GpioPort::B, 8) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB9 = EncodePin(GpioPort::B, 9) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB10 = EncodePin(GpioPort::B, 10) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB11 = EncodePin(GpioPort::B, 11) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB12 = EncodePin(GpioPort::B, 12) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB13 = EncodePin(GpioPort::B, 13) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB14 = EncodePin(GpioPort::B, 14) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PB15 = EncodePin(GpioPort::B, 15) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC0 = EncodePin(GpioPort::C, 0) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC1 = EncodePin(GpioPort::C, 1) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC2 = EncodePin(GpioPort::C, 2) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC3 = EncodePin(GpioPort::C, 3) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC4 = EncodePin(GpioPort::C, 4) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC5 = EncodePin(GpioPort::C, 5) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC6 = EncodePin(GpioPort::C, 6) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC7 = EncodePin(GpioPort::C, 7) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC8 = EncodePin(GpioPort::C, 8) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC9 = EncodePin(GpioPort::C, 9) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC10 = EncodePin(GpioPort::C, 10) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC11 = EncodePin(GpioPort::C, 11) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC12 = EncodePin(GpioPort::C, 12) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC13 = EncodePin(GpioPort::C, 13) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC14 = EncodePin(GpioPort::C, 14) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PC15 = EncodePin(GpioPort::C, 15) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PD0 = EncodePin(GpioPort::D, 0) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PD1 = EncodePin(GpioPort::D, 1) |
| |
| constexpr hf_pin_num_t | hf::stm32::pin::PD2 = EncodePin(GpioPort::D, 2) |
| |
STM32 platform-specific type definitions for hardware abstraction.
This header provides the bridge between STM32 HAL (CubeMX-generated) types and the HardFOC base class interfaces. Users integrate their CubeMX projects by passing STM32 HAL handles (e.g., ADC_HandleTypeDef*, I2C_HandleTypeDef*) into the Stm* wrapper constructors.
Design Philosophy
STM32 CubeMX generates peripheral initialization code that populates HAL handle structs. The HardFOC wrappers accept these handles — they do NOT re-initialize the hardware. This provides:
- Zero-friction integration with existing CubeMX projects
- Full compatibility with any STM32 family (F0/F1/F3/F4/F7/G0/G4/H5/H7/L0/L4/U5/WB/WL)
- Users retain full control of clock trees, pin-muxing, and peripheral config
Usage
extern ADC_HandleTypeDef hadc1;
extern I2C_HandleTypeDef hi2c1;
extern SPI_HandleTypeDef hspi1;
STM32 ADC wrapper — wraps STM32 HAL ADC with full channel management.
Definition StmAdc.h:40
STM32 I2C bus — manages the HAL handle and device collection.
Definition StmI2c.h:87
STM32 SPI bus — manages the HAL handle and device collection.
Definition StmSpi.h:86
- Author
- HardFOC
- Date
- 2025
- Copyright
- HardFOC — Licensed under GPL v3.0 or later.