34_Static_assert((
sizeof(
struct USARTRegs)) == (
sizeof(uint32_t) * 7U),
35 "USART register struct size mismatch. Is it aligned?");
37#define USART(x) (struct USARTRegs *)(x)
43 volatile _Bool TXEI : 1;
44 volatile _Bool CTSI : 1;
45 volatile _Bool TCI : 1;
46 volatile _Bool RXNEI : 1;
47 volatile _Bool IDLEI : 1;
48 volatile _Bool PEI : 1;
49 volatile _Bool LBDI : 1;
50 volatile _Bool EI : 1;
53_Static_assert((
sizeof(
struct USARTISR)) == (
sizeof(uint8_t) * 1U),
54 "USART interrupt struct size mismatch. Is it aligned?");
94 USART_DATABITS_DB8 = 0x00,
95 USART_DATABITS_DB9 = 0x01
102 USART_STOPBITS_SB1 = 0x00,
103 USART_STOPBITS_SBH = 0x01,
104 USART_STOPBITS_SB2 = 0x02,
105 USART_STOPBITS_SBO = 0x03
112 USART_PARITY_EVN = 0x00,
113 USART_PARITY_ODD = 0x01,
114 USART_PARITY_OFF = 0x02
Defines used commonly in most files.
CMSIS device header stubs.
Contains USART interrupt configuration.
Definition usart.h:42
Contains USART registers.
Definition usart.h:24
void usart_set_dma(const usart_peripheral_t usart, const _Bool forTX, const _Bool forRX)
Configures the USART DMA functionality.
Definition usart.c:94
usart_mode
Available USART modes.
Definition usart.h:84
usart_databits
Available USART databit number.
Definition usart.h:93
usart_peripheral
Available USART peripherals.
Definition usart.h:60
enum usart_databits usart_databits_t
Available USART databit number.
void usart_stop(const usart_peripheral_t usart)
Disable the USART interface.
Definition usart.c:248
void usart_set_interrupts(const usart_peripheral_t usart, const struct USARTISR config)
Enables the specified USART interrupts.
Definition usart.c:111
enum usart_peripheral usart_peripheral_t
Available USART peripherals.
usart_parity
Available USART parities.
Definition usart.h:111
enum usart_parity usart_parity_t
Available USART parities.
void usart_set_databits(const usart_peripheral_t usart, const usart_stopbits_t stopbits, const usart_databits_t databits)
Sets the USART databits to the specified values.
Definition usart.c:145
uint16_t usart_rx_byte(const usart_peripheral_t usart)
Reads the received data from the USART buffer.
Definition usart.c:234
usart_stopbits
Available USART stopbit number.
Definition usart.h:101
void usart_start(const usart_peripheral_t usart, const uint32_t baudrate, const usart_mode_t mode)
Initiates the USART peripheral with specified options.
Definition usart.c:68
void usart_set_parity(const usart_peripheral_t usart, const usart_parity_t parity)
Sets the USART parity to the specified mode.
Definition usart.c:182
enum usart_stopbits usart_stopbits_t
Available USART stopbit number.
void usart_tx_message(const usart_peripheral_t usart, const char *message)
Writes specified message to USART buffer.
Definition usart.c:220
enum usart_mode usart_mode_t
Available USART modes.