|
STM32 Traffic Control
|
UART drive implementation. More...
Macros | |
| #define | GPIOAEN (1U<<0) |
| #define | UART2EN (1U<<17) |
| #define | CR1_TE (1U<<3) |
| #define | CR1_RE (1U<<2) |
| #define | CR1_UE (1U<<13) |
| #define | SR_TXE (1U<<7) |
| #define | SYS_FREQ 16000000 |
| #define | APB1_CLK SYS_FREQ |
| #define | UART_BAUDRATE 115200 |
Functions | |
| int | __io_putchar (int ch) |
| Low-level character output function for printf redirection. | |
| void | uart2_init (void) |
| Initialize UART2 peripheral. | |
| void | uart2_write (int ch) |
| Transmit a single character over UART2. | |
UART drive implementation.
This file provides low-level UART2 initialization and transmit functionality. The UART is primarily used for serial logging and debug output cia printf() redirectiion.
| #define APB1_CLK SYS_FREQ |
| #define CR1_RE (1U<<2) |
| #define CR1_TE (1U<<3) |
| #define CR1_UE (1U<<13) |
| #define GPIOAEN (1U<<0) |
| #define SR_TXE (1U<<7) |
| #define SYS_FREQ 16000000 |
| #define UART2EN (1U<<17) |
| #define UART_BAUDRATE 115200 |
| int __io_putchar | ( | int | ch | ) |
Low-level character output function for printf redirection.
This function is called by the C standard library to output characters when using fucntions such as printf(). Characters are transmitted over UART2.
| ch | Character to transmit |
| void uart2_init | ( | void | ) |
Initialize UART2 peripheral.
UART2 is configured for basic asynchronous communication and is used primarily for logging and debugging.
| void uart2_write | ( | int | ch | ) |
Transmit a single character over UART2.
This function blocks until the transmit data register is empty, then writes the provided character to the UART data register.
| ch | Character to transmit. |