Microchip® Advanced Software Framework

usart_simulator_example1.c File Reference

USART Example application for AVR UC3 USART driver.

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

#include <stdint.h>
#include "usart.h"
#include "board.h"
#include "sysclk.h"
#include "gpio.h"
#include "conf_board.h"
#include "conf_clock.h"
#include "conf_example.h"

Functions

int main (void)
 Application main loop. More...
 

Variables

static const gpio_map_t usart_gpio_map
 USART configuration options. More...
 
static const usart_options_t usart_options
 USART options for enabling local loopback mode. More...
 

int main ( void  )

Application main loop.

The main function does the following:

  • Configures the USART module
  • Performs loopback transfer of data
  • Enters an infinite loop on completion of example
Note
Use no compiler optimization to be able to watch test_in in the watch window.
Note
Call to sysclk_init() will disable all non-vital peripheral clocks, except for the peripheral clocks explicitly enabled in conf_clock.h.

References cpu_relax, EXAMPLE_USART, gpio_enable_module(), i, sysclk_enable_peripheral_clock(), sysclk_get_pba_hz(), sysclk_init(), usart_getchar(), usart_init_rs232(), and usart_putchar().

const gpio_map_t usart_gpio_map
static
Initial value:
= {
}
#define EXAMPLE_USART_RX_PIN
Definition: rtc_example.c:97
#define EXAMPLE_USART_TX_PIN
Definition: rtc_example.c:99
#define EXAMPLE_USART_RX_FUNCTION
Definition: rtc_example.c:98
#define EXAMPLE_USART_TX_FUNCTION
Definition: rtc_example.c:100

USART configuration options.

This struct contains the configuration options for the USART module in use by the example application.GPIO mapping for USART1 module

Referenced by main().

const usart_options_t usart_options
static
Initial value:
= {
.baudrate = EXAMPLE_USART_BAUD,
.charlength = 8,
.paritytype = USART_NO_PARITY,
.stopbits = USART_1_STOPBIT,
.channelmode = USART_LOCAL_LOOPBACK
}
#define USART_LOCAL_LOOPBACK
Local loopback.
Definition: usart.h:98
#define USART_NO_PARITY
Don&#39;t use a parity bit.
Definition: usart.h:81
#define USART_1_STOPBIT
Use 1 stop bit.
Definition: usart.h:88

USART options for enabling local loopback mode.