Microchip® Advanced Software Framework

usart.c File Reference

SAM SERCOM USART Driver.

Copyright (c) 2012-2020 Microchip Technology Inc. and its subsidiaries.

#include "usart.h"
#include <pinmux.h>
#include "usart_interrupt.h"

Functions

static enum status_code _usart_set_config (struct usart_module *const module, const struct usart_config *const config)
 
enum status_code usart_init (struct usart_module *const module, Sercom *const hw, const struct usart_config *const config)
 Initializes the device. More...
 
enum status_code usart_read_buffer_wait (struct usart_module *const module, uint8_t *rx_data, uint16_t length)
 Receive a buffer of length characters via the USART. More...
 
enum status_code usart_read_wait (struct usart_module *const module, uint16_t *const rx_data)
 Receive a character via the USART. More...
 
enum status_code usart_write_buffer_wait (struct usart_module *const module, const uint8_t *tx_data, uint16_t length)
 Transmit a buffer of characters via the USART. More...
 
enum status_code usart_write_wait (struct usart_module *const module, const uint16_t tx_data)
 Transmit a character via the USART. More...
 

static enum status_code _usart_set_config ( struct usart_module *const  module,
const struct usart_config *const  config 
)
static

Set Configuration of the USART module

References _sercom_get_async_baud_val(), _sercom_get_sercom_inst_index(), _sercom_get_sync_baud_val(), Assert, usart_config::baudrate, usart_config::character_size, usart_config::clock_polarity_inverted, usart_config::collision_detection_enable, usart_config::data_order, iso7816_config_t::enable_inverse, iso7816_config_t::enabled, usart_config::encoding_format_enable, usart_config::ext_clock_freq, FEATURE_USART_ISO7816, FEATURE_USART_START_FRAME_DECTION, iso7816_config_t::guard_time, usart_config::immediate_buffer_overflow_notification, iso7816_config_t::inhibit_nack, usart_config::iso7816_config, ISO7816_PROTOCOL_T_0, ISO7816_PROTOCOL_T_1, usart_config::lin_break_length, usart_config::lin_header_delay, LIN_INVALID_MODE, usart_config::lin_node, usart_config::lin_slave_enable, iso7816_config_t::max_iterations, mode, usart_config::mux_setting, usart_config::parity, iso7816_config_t::protocol_t, usart_config::receive_pulse_length, usart_config::receiver_enable, usart_config::rs485_guard_time, usart_config::run_in_standby, usart_config::sample_adjustment, usart_config::sample_rate, SERCOM_ASYNC_OPERATION_MODE_ARITHMETIC, SERCOM_ASYNC_OPERATION_MODE_FRACTIONAL, SERCOM_ASYNC_SAMPLE_NUM_16, SERCOM_ASYNC_SAMPLE_NUM_3, SERCOM_ASYNC_SAMPLE_NUM_8, usart_config::start_frame_detection_enable, STATUS_OK, usart_config::stopbits, iso7816_config_t::successive_recv_nack, system_gclk_chan_get_hz(), system_is_debugger_present(), usart_config::transfer_mode, usart_config::transmitter_enable, USART_CHARACTER_SIZE_8BIT, USART_PARITY_NONE, USART_SAMPLE_RATE_16X_ARITHMETIC, USART_SAMPLE_RATE_16X_FRACTIONAL, USART_SAMPLE_RATE_3X_ARITHMETIC, USART_SAMPLE_RATE_8X_ARITHMETIC, USART_SAMPLE_RATE_8X_FRACTIONAL, USART_STOPBITS_1, USART_TRANSFER_ASYNCHRONOUSLY, USART_TRANSFER_SYNCHRONOUSLY, usart_config::use_external_clock, and x1.

Referenced by usart_init().