67 if (usart == LPUART1) {
69 + ((clock % baud) * 256 + baud / 2) / baud;
74 USART_BRR(usart) = (clock + baud / 2) / baud;
113 reg32 = (reg32 & ~USART_CR2_STOPBITS_MASK) | stopbits;
132 reg32 = (reg32 & ~USART_PARITY_MASK) | parity;
151 reg32 = (reg32 & ~USART_MODE_MASK) | mode;
170 reg32 = (reg32 & ~USART_FLOWCONTROL_MASK) | flowcontrol;
uint32_t rcc_get_usart_clk_freq(uint32_t usart)
Get the peripheral clock speed for the USART at base specified.
#define USART_CR1_UE
UE: USART enable.
#define USART_CR1_IDLEIE
IDLEIE: IDLE interrupt enable.
#define USART_CR1_TXEIE
TXEIE: Interrupt enable.
#define USART_CR1_RXNEIE
RXNEIE: RXNE interrupt enable.
#define USART_CR1_TCIE
TCIE: Transmission complete interrupt enable.
#define USART_CR3_DMAT
DMAT: DMA enable transmitter.
#define USART_CR3_EIE
EIE: Error interrupt enable.
#define USART_CR3_DMAR
DMAR: DMA enable receiver.
uint16_t usart_recv(uint32_t usart)
USART Read a Received Data Word.
void usart_send(uint32_t usart, uint16_t data)
USART Send a Data Word.
void usart_wait_recv_ready(uint32_t usart)
USART Wait for Received Data Available.
void usart_wait_send_ready(uint32_t usart)
USART Wait for Transmit Data Buffer Empty.
void usart_disable_idle_interrupt(uint32_t usart)
USART Idle Interrupt Disable.
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_enable_tx_interrupt(uint32_t usart)
USART Transmitter Interrupt Enable.
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_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.
#define USART_CR3(usart_base)
Control register 3 (USARTx_CR3)
#define USART_CR1(usart_base)
Control register 1 (USARTx_CR1)
#define USART_BRR(usart_base)
Baud rate register (USARTx_BRR)
#define USART_CR2(usart_base)
Control register 2 (USARTx_CR2)