Microchip® Advanced Software Framework

usart_config Struct Reference

USART configuration struct.

Configuration options for USART.

#include <usart.h>

Data Fields

uint32_t baudrate
 USART baudrate. More...
 
enum usart_character_size character_size
 USART character size. More...
 
bool clock_polarity_inverted
 USART Clock Polarity. More...
 
enum usart_dataorder data_order
 USART bit order (MSB or LSB first) More...
 
uint32_t ext_clock_freq
 External clock frequency in synchronous mode. More...
 
enum gclk_generator generator_source
 GCLK generator source. More...
 
enum usart_signal_mux_settings mux_setting
 USART pin out. More...
 
enum usart_parity parity
 USART parity. More...
 
uint32_t pinmux_pad0
 PAD0 pinmux. More...
 
uint32_t pinmux_pad1
 PAD1 pinmux. More...
 
uint32_t pinmux_pad2
 PAD2 pinmux. More...
 
uint32_t pinmux_pad3
 PAD3 pinmux. More...
 
bool receiver_enable
 Enable receiver. More...
 
bool run_in_standby
 If true the USART will be kept running in Standby sleep mode. More...
 
enum usart_stopbits stopbits
 Number of stop bits. More...
 
enum usart_transfer_mode transfer_mode
 USART in asynchronous or synchronous mode. More...
 
bool transmitter_enable
 Enable transmitter. More...
 
bool use_external_clock
 States whether to use the external clock applied to the XCK pin. More...
 

uint32_t usart_config::baudrate
enum usart_character_size usart_config::character_size
bool usart_config::clock_polarity_inverted

USART Clock Polarity.

If true, data changes on falling XCK edge and is sampled at rising edge. If false, data changes on rising XCK edge and is sampled at falling edge.

Referenced by _usart_set_config(), and usart_get_config_defaults().

enum usart_dataorder usart_config::data_order

USART bit order (MSB or LSB first)

Referenced by _usart_set_config(), and usart_get_config_defaults().

uint32_t usart_config::ext_clock_freq

External clock frequency in synchronous mode.

This must be set if use_external_clock is true.

Referenced by _usart_set_config(), and usart_get_config_defaults().

enum gclk_generator usart_config::generator_source

GCLK generator source.

Referenced by usart_get_config_defaults(), and usart_init().

enum usart_signal_mux_settings usart_config::mux_setting
enum usart_parity usart_config::parity

USART parity.

Referenced by _usart_set_config(), and usart_get_config_defaults().

uint32_t usart_config::pinmux_pad0

PAD0 pinmux.

If current USARTx has several alternative multiplexing I/O pins for PAD0, then only one peripheral multiplexing I/O can be enabled for current USARTx PAD0 function. Make sure that no other alternative multiplexing I/O is associated with the same USARTx PAD0.

Referenced by cdc_uart_init(), test_system_init(), usart_get_config_defaults(), and usart_init().

uint32_t usart_config::pinmux_pad1

PAD1 pinmux.

If current USARTx has several alternative multiplexing I/O pins for PAD1, then only one peripheral multiplexing I/O can be enabled for current USARTx PAD1 function. Make sure that no other alternative multiplexing I/O is associated with the same USARTx PAD1.

Referenced by cdc_uart_init(), test_system_init(), usart_get_config_defaults(), and usart_init().

uint32_t usart_config::pinmux_pad2

PAD2 pinmux.

If current USARTx has several alternative multiplexing I/O pins for PAD2, then only one peripheral multiplexing I/O can be enabled for current USARTx PAD2 function. Make sure that no other alternative multiplexing I/O is associated with the same USARTx PAD2.

Referenced by cdc_uart_init(), test_system_init(), usart_get_config_defaults(), and usart_init().

uint32_t usart_config::pinmux_pad3

PAD3 pinmux.

If current USARTx has several alternative multiplexing I/O pins for PAD3, then only one peripheral multiplexing I/O can be enabled for current USARTx PAD3 function. Make sure that no other alternative multiplexing I/O is associated with the same USARTx PAD3.

Referenced by cdc_uart_init(), test_system_init(), usart_get_config_defaults(), and usart_init().

bool usart_config::receiver_enable

Enable receiver.

Referenced by _usart_set_config(), usart_get_config_defaults(), and usart_init().

bool usart_config::run_in_standby

If true the USART will be kept running in Standby sleep mode.

Referenced by _usart_set_config(), and usart_get_config_defaults().

enum usart_stopbits usart_config::stopbits

Number of stop bits.

Referenced by _usart_set_config(), and usart_get_config_defaults().

enum usart_transfer_mode usart_config::transfer_mode

USART in asynchronous or synchronous mode.

Referenced by _usart_set_config(), and usart_get_config_defaults().

bool usart_config::transmitter_enable

Enable transmitter.

Referenced by _usart_set_config(), usart_get_config_defaults(), and usart_init().

bool usart_config::use_external_clock

States whether to use the external clock applied to the XCK pin.

In synchronous mode the shift register will act directly on the XCK clock. In asynchronous mode the XCK will be the input to the USART hardware module.

Referenced by _usart_set_config(), and usart_get_config_defaults().