Microchip® Advanced Software Framework

wdt_example.c File Reference

Watchdog Timer (WDT) example for SAM.

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

#include "asf.h"
#include "conf_board.h"
#include "led.h"
#include <stdio.h>

Macros

#define BLINK_PERIOD   300
 LED blink time 300ms. More...
 
#define PUSHBUTTON_FILTER_GLITCH_VAULE   10
 PIO debounce filter parameters 10 Hz. More...
 
#define STRING_EOL   "\r"
 
#define STRING_HEADER
 
#define WDT_PERIOD   3000
 Watchdog period 3000ms. More...
 
#define WDT_RESTART_PERIOD   2000
 Watchdog restart 2000ms. More...
 

Functions

static void button_handler (uint32_t id, uint32_t mask)
 Handler for Button 1 rising edge interrupt. More...
 
static void configure_button (void)
 Configure the Pushbutton. More...
 
static void configure_console (void)
 Configure the Console UART. More...
 
static void configure_led (void)
 Configure LED. More...
 
int main (void)
 Application entry point for WDT example. More...
 
void SysTick_Handler (void)
 Handler for System Tick interrupt. More...
 
void WDT_Handler (void)
 Handler for watchdog interrupt. More...
 

Variables

volatile bool g_b_button_event = false
 Pushbutton event flag. More...
 
volatile bool g_b_systick_event = false
 System Tick event flag. More...
 
volatile uint32_t g_ul_ms_ticks = 0
 System tick increased by 1 every millisecond. More...
 

#define BLINK_PERIOD   300

LED blink time 300ms.

Referenced by main().

#define PUSHBUTTON_FILTER_GLITCH_VAULE   10

PIO debounce filter parameters 10 Hz.

Referenced by configure_button().

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"--Watchdog with IRQ Interrupt Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define STRING_EOL
Definition: wdt_example.c:102
#define BOARD_NAME
Name of the board.
Definition: same70_xplained.h:75

Referenced by main().

#define WDT_PERIOD   3000

Watchdog period 3000ms.

Referenced by main().

#define WDT_RESTART_PERIOD   2000

Watchdog restart 2000ms.

Referenced by main().

static void button_handler ( uint32_t  id,
uint32_t  mask 
)
static

Handler for Button 1 rising edge interrupt.

References PUSHBUTTON_ID, and PUSHBUTTON_MASK.

Referenced by configure_button().

static void configure_console ( void  )
static
static void configure_led ( void  )
static

Configure LED.

References LED_ATTR, LED_MASK, LED_PIO, LED_TYPE, and pio_configure().

Referenced by main().

void SysTick_Handler ( void  )

Handler for System Tick interrupt.

void WDT_Handler ( void  )

Handler for watchdog interrupt.

References wdt_get_status(), and wdt_restart().

volatile bool g_b_button_event = false

Pushbutton event flag.

volatile bool g_b_systick_event = false

System Tick event flag.

volatile uint32_t g_ul_ms_ticks = 0

System tick increased by 1 every millisecond.