|
GPS Device
|
STM32F401RE USART driver public API. More...


Go to the source code of this file.
Classes | |
| struct | USART_CFG_ts |
| Configuration structure for initializing a USART peripheral. More... | |
Macros | |
| #define | USART_NAME_LEN 6 |
| Length of the null-terminated USART peripheral name string (e.g. "USART1"). | |
Enumerations | |
| enum | USART_MODE_te { USART_MODE_ASYNC , USART_MODE_SYNC } |
| USART operating mode. More... | |
| enum | USART_BAUD_RATE_te { USART_BAUD_RATE_1200 = 1200 , USART_BAUD_RATE_2400 = 2400 , USART_BAUD_RATE_9600 = 9600 , USART_BAUD_RATE_19200 = 19200 , USART_BAUD_RATE_38400 = 38400 , USART_BAUD_RATE_57600 = 57600 , USART_BAUD_RATE_115200 = 115200 , USART_BAUD_RATE_230400 = 230400 , USART_BAUD_RATE_460800 = 460800 , USART_BAUD_RATE_921600 = 921600 , USART_BAUD_RATE_2000000 = 2000000 , USART_BAUD_RATE_3000000 = 3000000 } |
| USART baud rate in bits per second. More... | |
| enum | USART_PARITY_te { USART_PARITY_DISABLED , USART_PARITY_EVEN , USART_PARITY_ODD } |
| USART parity bit configuration. More... | |
| enum | USART_FRAME_DATA_BITS_te { USART_FRAME_DATA_BITS_8 , USART_FRAME_DATA_BITS_9 } |
| USART data word length. More... | |
| enum | USART_OVERSAMPLING_te { USART_OVERSAMPLING_16 , USART_OVERSAMPLING_8 } |
| USART oversampling ratio. More... | |
| enum | USART_FRAME_STOP_BITS_te { USART_FRAME_STOP_BITS_1 , USART_FRAME_STOP_BITS_0_5 , USART_FRAME_STOP_BITS_2 , USART_FRAME_STOP_BITS_1_5 } |
| USART number of stop bits. More... | |
| enum | USART_HW_FLOW_CONTROL_te { USART_HW_FLOW_CONTROL_DISABLED , USART_HW_FLOW_CONTROL_ENABLED } |
| USART hardware flow control (RTS/CTS). More... | |
| enum | USART_SAMPLE_BIT_te { USART_SAMPLE_BIT_3 , USART_SAMPLE_BIT_1 } |
| USART receiver sample bit method. More... | |
| enum | USART_INTERRUPT_EN_te { USART_INTERRUPT_EN_FALSE , USART_INTERRUPT_EN_TRUE } |
| USART RXNE interrupt enable configuration. More... | |
Functions | |
| void | usart_init (USART_CFG_ts *usart_cfg) |
| Initializes the USART peripheral with the given configuration. | |
| void | usart_deinit (USART_REGDEF_ts const *usart_instance) |
| Deinitializes the USART peripheral, disables its NVIC interrupt, and disables its clock. | |
| void | usart_send (USART_REGDEF_ts *usart_instance, uint8_t *tx_buffer, uint32_t len) |
Blocking USART transmit. Sends len bytes from tx_buffer. | |
| void | usart_receive (USART_REGDEF_ts const *usart_instance, uint8_t *rx_buffer, uint32_t len) |
Blocking USART receive. Reads len bytes into rx_buffer. | |
| void | usart_set_transmission (USART_REGDEF_ts *usart_instance, EN_STATUS_te en_status) |
| Enables or disables the USART transmitter (TE bit). | |
| void | usart_set_reception (USART_REGDEF_ts *usart_instance, EN_STATUS_te en_status) |
| Enables or disables the USART receiver (RE bit). | |
| void | usart_get_name (USART_REGDEF_ts const *usart_instance, char *name) |
| Returns the name string of a USART peripheral instance (e.g. "USART1"). | |
| void | usart1_irq_data_recv_callback (uint8_t data) |
| RXNE callback for USART1. Called by USART1_IRQHandler on each received byte. | |
| void | usart6_irq_data_recv_callback (uint8_t data) |
| RXNE callback for USART6. Called by USART6_IRQHandler on each received byte. | |
STM32F401RE USART driver public API.
This module provides a driver for the STM32F401RE USART peripheral, supporting asynchronous (UART) mode with configurable baud rate, parity, data width, stop bits, oversampling, hardware flow control, and interrupt-driven reception.
Transmission and reception are controlled independently:
Interrupt-driven reception requires the application to override the weak callback functions:
If no override is provided, the default weak alias spins in an infinite loop.
Definition in file stm32f401re_usart.h.