Microchip® Advanced Software Framework

getting-started/main_sam4l.c File Reference

Getting Started Application.

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

#include "asf.h"

Macros

#define BLINK_PERIOD   1000
 LED0 blink time, in ms. More...
 
#define STRING_EOL   "\r"
 
#define STRING_HEADER
 

Functions

static void configure_button (void)
 Configure push button 0 to generate an EIC interrupt. More...
 
static void configure_console (void)
 Configure UART console. More...
 
static void configure_tc (void)
 Configure Timer Counter 0 to generate an interrupt every 200ms. More...
 
int main (void)
 getting-started Application entry point. More...
 
static void mdelay (uint32_t ul_dly_ticks)
 Waits for the given number of milliseconds (using the g_ul_ms_ticks generated by the SAM's microcontrollers's system tick). More...
 
static void set_toggle_flag (void)
 Interrupt handler for EIC interrupt. More...
 
void SysTick_Handler (void)
 Handler for System Tick interrupt. More...
 
void TC00_Handler (void)
 Interrupt handler for TC00 interrupt. More...
 

Variables

volatile uint32_t g_b_led0_active = 1
 LED0 blinking control. More...
 
volatile uint32_t g_ul_ms_ticks = 0
 Global g_ul_ms_ticks in milliseconds since start of application. More...
 

#define BLINK_PERIOD   1000

LED0 blink time, in ms.

Referenced by main().

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"-- Getting Started Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Definition: inc/app_init.h:140
#define STRING_EOL
Definition: getting-started/main_sam4l.c:85

Referenced by main().

static void configure_console ( void  )
static

Configure UART console.

References uart_rs232_options::baudrate, and stdio_serial_init().

Referenced by main().

static void configure_tc ( void  )
static

Configure Timer Counter 0 to generate an interrupt every 200ms.

References sysclk_enable_peripheral_clock(), sysclk_get_cpu_hz(), tc_enable_interrupt(), tc_find_mck_divisor(), tc_init(), tc_start(), and tc_write_rc().

Referenced by main().

int main ( void  )

getting-started Application entry point.

Returns
Unused (ANSI-C compatibility).

References BLINK_PERIOD, board_init(), configure_button(), configure_console(), configure_tc(), g_b_led0_active, mdelay(), STRING_HEADER, sysclk_get_cpu_hz(), and sysclk_init().

static void mdelay ( uint32_t  ul_dly_ticks)
static

Waits for the given number of milliseconds (using the g_ul_ms_ticks generated by the SAM's microcontrollers's system tick).

Parameters
ul_dly_ticksDelay to wait for, in milliseconds.

References g_ul_ms_ticks.

Referenced by main().

static void set_toggle_flag ( void  )
static

Interrupt handler for EIC interrupt.

References eic_line_clear_interrupt(), eic_line_interrupt_is_pending(), and g_b_led0_active.

Referenced by configure_button().

void SysTick_Handler ( void  )

Handler for System Tick interrupt.

Process System Tick Event Increments the g_ul_ms_ticks counter.

References g_ul_ms_ticks.

void TC00_Handler ( void  )

Interrupt handler for TC00 interrupt.

References tc_get_status(), and UNUSED.

volatile uint32_t g_b_led0_active = 1

LED0 blinking control.

Referenced by main(), and set_toggle_flag().

volatile uint32_t g_ul_ms_ticks = 0

Global g_ul_ms_ticks in milliseconds since start of application.