Watchdog Timer (WDT) example for SAM.
Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.
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 |
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 |
Handler for Button 1 rising edge interrupt.
Referenced by configure_button().
|
static |
Configure the Pushbutton.
References button_handler(), pio_configure(), pio_set_debounce_filter(), pmc_enable_periph_clk(), and PUSHBUTTON_FILTER_GLITCH_VAULE.
Referenced by main().
|
static |
Configure the Console UART.
References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().
Referenced by main().
|
static |
int main | ( | void | ) |
Application entry point for WDT example.
References BLINK_PERIOD, BOARD_FREQ_SLCK_XTAL, board_init(), configure_button(), configure_console(), configure_led(), pio_enable_interrupt(), STRING_HEADER, sysclk_get_cpu_hz(), sysclk_init(), wdt_get_timeout_value(), wdt_get_us_timeout_period(), wdt_init(), WDT_INVALID_ARGUMENT, WDT_PERIOD, wdt_restart(), and WDT_RESTART_PERIOD.
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 uint32_t g_ul_ms_ticks = 0 |
System tick increased by 1 every millisecond.