I/O Stream USART
Description
I/O Stream USART.
Overview
The Universal Synchronous / Asynchronous Receiver / Transmitter controller(s) (USART) can be used as a UART and can, therefore, be connected to an external transceiver to communicate with another host using the serial link. Multiple instances can be instantiated as long as they are bound to a unique USART peripheral. The flow control is supported as well.
Initialization
The stream sets itself as the default stream at the end of the initialization function.You must reconfigure the default interface if you have multiple streams in your project else the last stream initialized will be set as the system default stream.
Power manager integration
On transmission side, I/O Stream-USART adds a requirement on EM1 until the transmit is really completed. Once the transmit is completed the requirement is removed and the system can go to a lower energy mode if allowed.
On the receive side, a requirement on EM1 is added if the application can receive data asynchronously. Meaning that the system can receive data when the MCU is into a sleep mode(will always be EM1 to allow the reception). Otherwise, If the system doesn't expect to receive anything, no requirement is added and the system can go to the lowest Energy mode allowed. You can control this behavior using a configuration per instance, see the following configuration:
SL_IOSTREAM_USART_<instance_name>_RESTRICT_ENERGY_MODE_TO_ALLOW_RECEPTION
Data Structures |
|
struct | sl_iostream_usart_config_t |
I/O Stream USART config.
|
|
struct | sl_iostream_usart_context_t |
I/O Stream USART context.
|
|
Functions |
|
sl_status_t | sl_iostream_usart_init ( sl_iostream_uart_t *iostream_uart, sl_iostream_uart_config_t *uart_config, USART_InitAsync_TypeDef *init, sl_iostream_usart_config_t *usart_config, sl_iostream_usart_context_t *usart_context) |
USART Stream init.
|
|
void | sl_iostream_usart_irq_handler (void *stream_context) |
Usart interrupt handler.
|
|
Function Documentation
◆ sl_iostream_usart_init()
sl_status_t sl_iostream_usart_init | ( | sl_iostream_uart_t * |
iostream_uart,
|
sl_iostream_uart_config_t * |
uart_config,
|
||
USART_InitAsync_TypeDef * |
init,
|
||
sl_iostream_usart_config_t * |
usart_config,
|
||
sl_iostream_usart_context_t * |
usart_context
|
||
) |
USART Stream init.
- Parameters
-
[in] iostream_uart
I/O Stream UART handle. [in] uart_config
I/O Stream UART config. [in] init
USART initialization modes. [in] usart_config
USART configuration. [in] usart_context
USART Instance context.
- Returns
- Status result
◆ sl_iostream_usart_irq_handler()
void sl_iostream_usart_irq_handler | ( | void * |
stream_context
|
) |
Usart interrupt handler.
- Parameters
-
[in] stream_context
Usart stream context.