32#if defined(LIBOPENCM3_USART_H)
34#ifndef LIBOPENCM3_USART_COMMON_ALL_H
35#define LIBOPENCM3_USART_COMMON_ALL_H
46#define USART_PARITY_NONE 0x00
47#define USART_PARITY_EVEN USART_CR1_PCE
48#define USART_PARITY_ODD (USART_CR1_PS | USART_CR1_PCE)
50#define USART_PARITY_MASK (USART_CR1_PS | USART_CR1_PCE)
58#define USART_MODE_RX USART_CR1_RE
59#define USART_MODE_TX USART_CR1_TE
60#define USART_MODE_TX_RX (USART_CR1_RE | USART_CR1_TE)
62#define USART_MODE_MASK (USART_CR1_RE | USART_CR1_TE)
69#define USART_STOPBITS_1 USART_CR2_STOPBITS_1
70#define USART_STOPBITS_0_5 USART_CR2_STOPBITS_0_5
71#define USART_STOPBITS_2 USART_CR2_STOPBITS_2
72#define USART_STOPBITS_1_5 USART_CR2_STOPBITS_1_5
76#define USART_CR2_STOPBITS_1 (0x00 << 12)
77#define USART_CR2_STOPBITS_0_5 (0x01 << 12)
78#define USART_CR2_STOPBITS_2 (0x02 << 12)
79#define USART_CR2_STOPBITS_1_5 (0x03 << 12)
80#define USART_CR2_STOPBITS_MASK (0x03 << 12)
81#define USART_CR2_STOPBITS_SHIFT 12
90#define USART_FLOWCONTROL_NONE 0x00
91#define USART_FLOWCONTROL_RTS USART_CR3_RTSE
92#define USART_FLOWCONTROL_CTS USART_CR3_CTSE
93#define USART_FLOWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE)
95#define USART_FLOWCONTROL_MASK (USART_CR3_RTSE | USART_CR3_CTSE)
109void usart_send(uint32_t usart, uint16_t data);
136#warning "usart_common_all.h should not be included directly, only via usart.h"
void usart_disable_idle_interrupt(uint32_t usart)
USART Idle Interrupt Disable.
uint16_t usart_recv(uint32_t usart)
USART Read a Received Data Word.
void usart_enable_error_interrupt(uint32_t usart)
USART Error Interrupt Enable.
void usart_enable_rx_dma(uint32_t usart)
USART Receiver DMA Enable.
void usart_send(uint32_t usart, uint16_t data)
USART Send a Data Word.
void usart_enable_tx_interrupt(uint32_t usart)
USART Transmitter Interrupt Enable.
void usart_wait_recv_ready(uint32_t usart)
USART Wait for Received Data Available.
void usart_set_parity(uint32_t usart, uint32_t parity)
USART Set Parity.
void usart_disable_tx_dma(uint32_t usart)
USART Transmitter DMA Disable.
void usart_disable_rx_dma(uint32_t usart)
USART Receiver DMA Disable.
void usart_wait_send_ready(uint32_t usart)
USART Wait for Transmit Data Buffer Empty.
void usart_disable_rx_interrupt(uint32_t usart)
USART Receiver Interrupt Disable.
void usart_disable(uint32_t usart)
USART Disable.
void usart_set_mode(uint32_t usart, uint32_t mode)
USART Set Rx/Tx Mode.
void usart_set_databits(uint32_t usart, uint32_t bits)
USART Set Word Length.
void usart_set_baudrate(uint32_t usart, uint32_t baud)
USART Set Baudrate.
uint16_t usart_recv_blocking(uint32_t usart)
USART Read a Received Data Word with Blocking.
void usart_enable_rx_interrupt(uint32_t usart)
USART Receiver Interrupt Enable.
void usart_enable_idle_interrupt(uint32_t usart)
USART Idle Interrupt Enable.
void usart_disable_tx_complete_interrupt(uint32_t usart)
USART Transmission Complete Interrupt Disable.
void usart_set_stopbits(uint32_t usart, uint32_t stopbits)
USART Set Stop Bit(s).
void usart_enable(uint32_t usart)
USART Enable.
void usart_disable_error_interrupt(uint32_t usart)
USART Error Interrupt Disable.
void usart_enable_tx_dma(uint32_t usart)
USART Transmitter DMA Enable.
void usart_enable_tx_complete_interrupt(uint32_t usart)
USART Transmission Complete Interrupt Enable.
void usart_set_flow_control(uint32_t usart, uint32_t flowcontrol)
USART Set Hardware Flow Control.
void usart_disable_tx_interrupt(uint32_t usart)
USART Transmitter Interrupt Disable.
void usart_send_blocking(uint32_t usart, uint16_t data)
USART Send Data Word with Blocking.
bool usart_get_flag(uint32_t usart, uint32_t flag)
USART Read a Status Flag.