Watchdog Timer (WDT) example for SAM4L.
Copyright (c) 2012-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include "conf_example.h"
Macros | |
#define | BLINK_PERIOD 500 |
LED blink time in millisecond. More... | |
#define | WDT_RESTART_PERIOD 2000 |
Watchdog period in millisecond. More... | |
Functions | |
static void | configure_console (void) |
Configure serial console. More... | |
int | main (void) |
static void | set_toggle_flag (void) |
Interrupt handler for EIC interrupt. More... | |
void | SysTick_Handler (void) |
Handler for System Tick interrupt. More... | |
Variables | |
volatile uint8_t | g_b_button_event = 0 |
Push button event. 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... | |
struct wdt_config | g_wdt_cfg |
WDT configuration. More... | |
struct wdt_dev_inst | g_wdt_inst |
WDT instance. More... | |
#define BLINK_PERIOD 500 |
LED blink time in millisecond.
Referenced by main().
#define WDT_RESTART_PERIOD 2000 |
Watchdog period in millisecond.
Referenced by main().
|
static |
Configure serial console.
References uart_rs232_options::baudrate, and stdio_serial_init().
Referenced by main().
int main | ( | void | ) |
References BLINK_PERIOD, board_init(), BOARD_NAME, configure_console(), eic_line_config::eic_async, EIC_ASYNCH_MODE, eic_line_config::eic_edge, EIC_EDGE_FALLING_EDGE, eic_enable(), eic_line_config::eic_filter, EIC_FILTER_DISABLED, eic_line_config::eic_level, EIC_LEVEL_LOW_LEVEL, eic_line_enable(), eic_line_set_callback(), eic_line_set_config(), eic_line_config::eic_mode, EIC_MODE_EDGE_TRIGGERED, EXAMPLE_LED_GPIO, g_b_button_event, g_b_systick_event, g_ul_ms_ticks, g_wdt_cfg, g_wdt_inst, ioport_toggle_pin_level(), set_toggle_flag(), sysclk_get_cpu_hz(), sysclk_init(), wdt_config::timeout_period, wdt_clear(), wdt_enable(), wdt_get_config_defaults(), wdt_init(), WDT_PERIOD_524288_CLK, and WDT_RESTART_PERIOD.
|
static |
Interrupt handler for EIC interrupt.
References eic_line_clear_interrupt(), eic_line_interrupt_is_pending(), and g_b_button_event.
Referenced by main().
void SysTick_Handler | ( | void | ) |
Handler for System Tick interrupt.
References g_b_systick_event, and g_ul_ms_ticks.
volatile uint8_t g_b_button_event = 0 |
Push button event.
Referenced by main(), and set_toggle_flag().
System Tick event flag.
Referenced by main(), and SysTick_Handler().
volatile uint32_t g_ul_ms_ticks = 0 |
System tick increased by 1 every millisecond.
struct wdt_config g_wdt_cfg |
WDT configuration.
Referenced by main().
struct wdt_dev_inst g_wdt_inst |
WDT instance.
Referenced by main().