|
STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
|
UART driver implementation (API in uart.h). More...
#include "uart.h"Go to the source code of this file.
Macros | |
| #define | UART_BRR_MIN (16U) |
| Smallest valid BRR: USARTDIV below 1, a baud rate above pclk / 16, cannot be generated. | |
Functions | |
| static DriverStatus_e | uartComputeBrr (uint32_t pclk_hz, uint32_t baud, uint32_t *brr) |
| Compute BRR for 16x oversampling: round(pclk_hz / baud). | |
| DRIVER_MUST_CHECK DriverStatus_e | uartInit (UartRegisters_t *uart, uint32_t pclk_hz, uint32_t baud, uint32_t stop_bits, uint32_t parity_enable, uint32_t parity_select, uint32_t direction) |
| Configure an instance for asynchronous 8-bit operation and enable it. | |
| void | uartDeinit (UartRegisters_t *uart) |
| Return CR1, CR2, CR3, BRR and GTPR to their reset values (disabled). | |
| static DriverStatus_e | uartWaitSrFlag (const UartRegisters_t *uart, uint32_t flag, uint32_t timeout) |
Poll an SR flag until it sets or timeout polls pass. | |
| DRIVER_MUST_CHECK DriverStatus_e | uartFlush (const UartRegisters_t *uart, uint32_t timeout) |
| Wait until the last byte has left the shift register (SR.TC). | |
| DRIVER_MUST_CHECK DriverStatus_e | uartTransmitByte (UartRegisters_t *uart, uint8_t byte, uint32_t timeout) |
| Send one byte once DR is free (SR.TXE). | |
| DRIVER_MUST_CHECK DriverStatus_e | uartTransmit (UartRegisters_t *uart, const uint8_t *data, size_t length, uint32_t timeout) |
| Send a buffer and wait until the line is idle. | |
| DRIVER_MUST_CHECK DriverStatus_e | uartReceiveByte (UartRegisters_t *uart, uint8_t *byte, uint32_t timeout) |
| Receive one byte once SR.RXNE sets. | |
| DRIVER_MUST_CHECK DriverStatus_e | uartReceive (UartRegisters_t *uart, uint8_t *data, size_t length, uint32_t timeout) |
| Receive a buffer, one byte at a time. | |