I/O Stream LEUART

Description

I/O Stream LEUART.

Overview

The Low Energy Universal Asynchronous Receiver/Transmitter controller(s) (LEUART) 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 LEUART peripheral.

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-LEUART adds a requirement on EM2 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 EM2 is added if the application can receive data asynchronously. Meaning that the system can receive data when the MCU is in sleep mode (will always be EM1 or EM2 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_LEUART_<instance_name>_RESTRICT_ENERGY_MODE_TO_ALLOW_RECEPTION

Data Structures

struct sl_iostream_leuart_config_t
Struct representing an I/O Stream LEUART configuration.
struct sl_iostream_leuart_context_t
Struct representing an I/O Stream LEUART context.

Functions

sl_status_t sl_iostream_leuart_init ( sl_iostream_uart_t *iostream_uart, sl_iostream_uart_config_t *uart_config, LEUART_Init_TypeDef *init, sl_iostream_leuart_config_t *leuart_config, sl_iostream_leuart_context_t *leuart_context)
LEUART Stream init.
void sl_iostream_leuart_irq_handler (void *stream_context)
LEUART interrupt handler.

Function Documentation

sl_iostream_leuart_init()

sl_status_t sl_iostream_leuart_init ( sl_iostream_uart_t * iostream_uart,
sl_iostream_uart_config_t * uart_config,
LEUART_Init_TypeDef * init,
sl_iostream_leuart_config_t * leuart_config,
sl_iostream_leuart_context_t * leuart_context
)

LEUART Stream init.

Parameters
[in] iostream_uart I/O Stream UART handle.
[in] uart_config I/O Stream UART config.
[in] init LEUART initialization modes.
[in] leuart_config LEUART configuration.
[in] leuart_context LEUART Instance context.
Returns
Status result

sl_iostream_leuart_irq_handler()

void sl_iostream_leuart_irq_handler ( void * stream_context )

LEUART interrupt handler.

Parameters
[in] stream_context USART stream context.