Microchip® Advanced Software Framework

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 STRING_EOL
Definition: main_sam4l.c:85
#define BOARD_NAME
Name string macro.
Definition: sam4l_xplained_pro.h:86

Referenced by main().

static void configure_console ( void  )
static
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(), BUTTON_0_NAME, configure_button(), configure_console(), configure_tc(), g_b_led0_active, LED0, LED_Toggle, 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
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.

Referenced by mdelay(), and SysTick_Handler().