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.
References PUSHBUTTON_ID, and PUSHBUTTON_MASK.
Referenced by configure_button().
|
static |
Configure the Pushbutton.
References button_handler(), pio_configure(), pio_handler_set(), pio_set_debounce_filter(), pmc_enable_periph_clk(), PUSHBUTTON_ATTR, PUSHBUTTON_FILTER_GLITCH_VAULE, PUSHBUTTON_ID, PUSHBUTTON_MASK, PUSHBUTTON_PIO, and PUSHBUTTON_TYPE.
Referenced by main().
|
static |
Configure the Console UART.
References uart_rs232_options::baudrate, CONF_UART, CONF_UART_BAUDRATE, CONF_UART_CHAR_LENGTH, CONF_UART_PARITY, CONF_UART_STOP_BITS, CONSOLE_UART_ID, 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(), LED0_GPIO, LED_Toggle, pio_enable_interrupt(), pio_handler_set_priority(), PUSHBUTTON_IRQn, PUSHBUTTON_MASK, PUSHBUTTON_PIO, PUSHBUTTON_STRING, 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.