Microchip® Advanced Software Framework

qs_usart_callback.c File Reference

SAM USART Quick Start.

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

#include <asf.h>
#include <stdio.h>

Macros

#define MAX_RX_BUFFER_LENGTH   5
 [module_inst] More...
 

Functions

void configure_usart (void)
 [callback_funcs] More...
 
void configure_usart_callbacks (void)
 
int main (void)
 [setup] More...
 
void usart_read_callback (struct usart_module *const usart_module)
 [rx_buffer_var] More...
 
void usart_write_callback (struct usart_module *const usart_module)
 

Variables

volatile uint8_t rx_buffer [MAX_RX_BUFFER_LENGTH]
 
struct usart_module usart_instance
 [module_inst] More...
 

#define MAX_RX_BUFFER_LENGTH   5

[module_inst]

[rx_buffer_var]

Referenced by main(), and usart_read_callback().

static void configure_usart ( void  )

[callback_funcs]

Initialize USART to communicate with on board EDBG - SERCOM with the following settings.

[module_inst]

[setup]

  • 8-bit asynchronous USART
  • No parity
  • One stop bit
  • 115200 baud

[setup_config]

[setup_config] [setup_config_defaults]

[setup_config_defaults]

[setup_change_config]

[setup_set_config]

[setup_set_config]

[setup_enable]

[setup_enable]

References usart_config::baudrate, usart_config::mux_setting, usart_config::pinmux_pad0, usart_config::pinmux_pad1, usart_config::pinmux_pad2, usart_config::pinmux_pad3, STATUS_OK, usart_enable(), usart_get_config_defaults(), usart_init(), and usart_instance.

void configure_usart_callbacks ( void  )

[setup_register_callbacks]

[setup_register_callbacks]

[setup_enable_callbacks]

[setup_enable_callbacks]

References USART_CALLBACK_BUFFER_RECEIVED, USART_CALLBACK_BUFFER_TRANSMITTED, usart_enable_callback(), usart_instance, usart_read_callback(), usart_register_callback(), and usart_write_callback().

Referenced by main().

int main ( void  )

[setup]

[setup_init]

[setup_init]

[main] [enable_global_interrupts]

[enable_global_interrupts]

[main_send_string]

[main_send_string]

[main_loop]

[main_loop] [main_read]

[main_read]

[main]

References configure_usart(), configure_usart_callbacks(), MAX_RX_BUFFER_LENGTH, rx_buffer, system_init(), system_interrupt_enable_global(), usart_instance, usart_read_buffer_job(), and usart_write_buffer_wait().

void usart_read_callback ( struct usart_module *const  usart_module)

[rx_buffer_var]

[callback_funcs]

References MAX_RX_BUFFER_LENGTH, rx_buffer, usart_instance, and usart_write_buffer_job().

Referenced by configure_usart_callbacks().

void usart_write_callback ( struct usart_module *const  usart_module)

volatile uint8_t rx_buffer[MAX_RX_BUFFER_LENGTH]

Referenced by main(), and usart_read_callback().

struct usart_module usart_instance

[module_inst]