18#if defined(USE_HAL_DRIVER)
19#include "stm32h7xx_hal_uart.h"
21struct __UART_HandleTypeDef;
62 hf_u32_t timeout_ms = 0) noexcept override;
64 hf_u32_t timeout_ms = 0) noexcept override;
68 int Printf(const
char* format, ...) noexcept override;
Abstract base class for UART driver implementations in the HardFOC system.
hf_uart_err_t
Definition BaseUart.h:84
uint32_t hf_u32_t
Platform-agnostic 32-bit unsigned integer type.
Definition HardwareTypes.h:52
uint8_t hf_u8_t
Platform-agnostic 8-bit unsigned integer type.
Definition HardwareTypes.h:40
hf_u32_t hf_port_num_t
Platform-agnostic port/controller identifier type.
Definition HardwareTypes.h:120
uint16_t hf_u16_t
Platform-agnostic 16-bit unsigned integer type.
Definition HardwareTypes.h:46
STM32 platform-specific type definitions for hardware abstraction.
struct __UART_HandleTypeDef UART_HandleTypeDef
Definition StmUart.h:22
Abstract base class for UART driver implementations.
Definition BaseUart.h:191
STM32 UART implementation.
Definition StmUart.h:36
void EnableRxBuffer(hf_u8_t *buffer, hf_u16_t size) noexcept
Enable a software RX ring buffer.
Definition StmUart.cpp:259
hf_uart_err_t FlushTx() noexcept override
Flush the transmit buffer.
Definition StmUart.cpp:208
~StmUart() noexcept override
Definition StmUart.cpp:60
hf_uart_err_t FlushRx() noexcept override
Flush the receive buffer.
Definition StmUart.cpp:214
StmUart(const StmUart &)=delete
bool Initialize() noexcept override
Initialize the UART driver.
Definition StmUart.cpp:68
hf_u16_t BytesAvailable() noexcept override
Get the number of bytes available to read.
Definition StmUart.cpp:200
hf_uart_err_t Write(const hf_u8_t *data, hf_u16_t length, hf_u32_t timeout_ms=0) noexcept override
Write data to the UART.
Definition StmUart.cpp:102
hf_u8_t * rx_buf_
Definition StmUart.h:100
UART_HandleTypeDef * huart_
Definition StmUart.h:96
StmUart & operator=(const StmUart &)=delete
hf_u16_t rx_buf_size_
Definition StmUart.h:101
void FeedRxBlock(const hf_u8_t *data, hf_u16_t length) noexcept
Feed a block of bytes into the RX ring buffer (call from ISR/DMA).
Definition StmUart.cpp:278
volatile hf_u16_t rx_tail_
Read index (user reads)
Definition StmUart.h:103
UART_HandleTypeDef * GetHalHandle() const noexcept
Definition StmUart.h:71
volatile hf_u16_t rx_head_
Write index (ISR writes)
Definition StmUart.h:102
int Printf(const char *format,...) noexcept override
Printf-style formatted output.
Definition StmUart.cpp:238
hf_u32_t default_timeout_ms_
Definition StmUart.h:97
void FeedRxByte(hf_u8_t byte) noexcept
Feed a byte into the RX ring buffer (call from ISR).
Definition StmUart.cpp:266
hf_uart_err_t Read(hf_u8_t *data, hf_u16_t length, hf_u32_t timeout_ms=0) noexcept override
Read data from the UART.
Definition StmUart.cpp:125
bool Deinitialize() noexcept override
Deinitialize the UART driver.
Definition StmUart.cpp:91
Platform-agnostic UART configuration for STM32.
Definition StmTypes.h:422