Universal Synchronous/Asynchronous Receiver/Transmitter (USART, or commonly serial port) support.
Contents
USART register map type.
Public Members
- __io uint32 SR
Status register.
- __io uint32 DR
Data register.
- __io uint32 BRR
Baud rate register.
- __io uint32 CR1
Control register 1.
- __io uint32 CR2
Control register 2.
- __io uint32 CR3
Control register 3.
- __io uint32 GTPR
Guard time and prescaler register.
USART device type.
Public Members
- usart_reg_map * regs
Register map.
- ring_buffer * rb
RX ring buffer.
- uint32 max_baud
Maximum baud.
- uint8 rx_buf[USART_RX_BUF_SIZE]
Deprecated.
Actual RX buffer used by rb. This field will be removed in a future release.
- rcc_clk_id clk_id
RCC clock information.
- nvic_irq_num irq_num
USART NVIC interrupt.
USART1 device.
USART2 device.
USART3 device.
UART4 device.
UART5 device.
Initialize a serial port.
Parameters: |
|
---|
Configure a serial port’s baud rate.
Parameters: |
|
---|
Enable a serial port.
USART is enabled in single buffer transmission mode, multibuffer receiver mode, 8n1.
Serial port must have a baud rate configured to work properly.
Parameters: |
|
---|---|
See: |
Turn off a serial port.
Parameters: |
|
---|
Disable all serial ports.
Call a function on each USART.
Parameters: |
|
---|
Nonblocking USART transmit.
Parameters: |
|
---|---|
Return: | Number of bytes transmitted |
Transmit an unsigned integer to the specified serial port in decimal format.
This function blocks until the integer’s digits have been completely transmitted.
Parameters: |
|
---|
Transmit one character on a serial port.
This function blocks until the character has been successfully transmitted.
Parameters: |
|
---|
Transmit a character string on a serial port.
This function blocks until str is completely transmitted.
Parameters: |
|
---|
Read one character from a serial port.
It’s not safe to call this function if the serial port has no data available.
Parameters: |
|
---|---|
Return: | byte read |
See: |
Return the amount of data available in a serial port’s RX buffer.
Parameters: |
|
---|---|
Return: | Number of bytes in dev’s RX buffer. |
Discard the contents of a serial port’s RX buffer.
Parameters: |
|
---|
USART1 register map base pointer.
USART2 register map base pointer.
USART3 register map base pointer.
UART4 register map base pointer.
UART5 register map base pointer.