28 #include <libopencm3/stm32/rcc.h> 29 #include <libopencm3/stm32/gpio.h> 30 #include <libopencm3/stm32/usart.h> 31 #include <libopencm3/cm3/nvic.h> 32 #include <libopencmsis/core_cm3.h> 43 #define UART_BAUDRATE 921600 47 static volatile uint8_t
tx_i = 0;
55 rcc_periph_clock_enable(RCC_AFIO);
66 usart_set_flow_control(
USART(
UART_ID), USART_FLOWCONTROL_NONE);
#define USART_TX_PORT(x)
get port for USART transmit pin based on USART identifier
#define RCC_USART(x)
get RCC for USART based on USART identifier
#define UART_BAUDRATE
serial baudrate, in bits per second (with 8N1 8 bits, no parity bit, 1 stop bit settings) ...
library for UART communication (API)
void uart_putchar_blocking(char c)
send character over UART (blocking)
#define USART_ISR(x)
get interrupt service routine for USART based on USART identifier
#define RCC_USART_PORT(x)
get RCC for USART port based on USART identifier
void user_input_store(char c)
store user input
void uart_putchar_nonblocking(char c)
send character over UART (non-blocking)
global definitions and methods (API)
#define UART_ID
USART peripheral.
#define USART_RX_PIN(x)
get pin for USART receive pin based on USART identifier
#define USART_TX_PIN(x)
get pin for USART transmit pin based on USART identifier
#define USART_IRQ(x)
get NVIC IRQ for USART based on USART identifier
#define USART(x)
get USART based on USART identifier
void uart_flush(void)
ensure all data has been transmitted (blocking)
#define USART_RX_PORT(x)
get port for USART receive pin based on USART identifier
static volatile uint8_t tx_used
how much data needs to be transmitted
static volatile uint8_t tx_i
current position of transmitted data
#define LENGTH(x)
get the length of an array
static volatile uint8_t tx_buffer[64]
ring buffer for data to transmit
void uart_setup(void)
setup UART peripheral