Microchip® Advanced Software Framework

rstc_example1.c File Reference

SAM Reset Controller (RSTC) Driver Example.

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

#include <asf.h>
#include <string.h>
#include <stdio_serial.h>
#include <conf_clock.h>
#include <conf_board.h>
#include <rstc_example1.h>

Macros

#define STRING_EOL   "\r"
 
#define STRING_HEADER
 
#define WDT_PERIOD   3000
 

Functions

static void configure_console (void)
 [reset_irq_variable] More...
 
static void configure_watchdog (void)
 Configure the watchdog timer. More...
 
static void display_menu (void)
 [reset_irq_handler] More...
 
static void display_reset_reason (void)
 Display the reset reason(s). More...
 
int main (void)
 SUPC RTC Wakeup Application entry point. More...
 
void RSTC_Handler (void)
 RSTC interrupt handler. More...
 
void SysTick_Handler (void)
 SysTick interrupt handler. More...
 
static void wait_for_message_gone (void)
 Wait for UART to finish transmitting. More...
 

Variables

static volatile bool reset_interrupt_triggered = false
 [reset_irq_variable] More...
 
static volatile uint32_t tick_count = 0U
 
static volatile bool watchdog_enabled = true
 

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"-- RSTC Reset Controller Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Definition: inc/app_init.h:140
#define STRING_EOL
Definition: rstc_example1.c:42

Referenced by main().

#define WDT_PERIOD   3000

Watchdog period 3000ms.

Referenced by configure_watchdog().

static void configure_console ( void  )
static
static void configure_watchdog ( void  )
static

Configure the watchdog timer.

References BOARD_FREQ_SLCK_XTAL, wdt_get_timeout_value(), wdt_init(), and WDT_PERIOD.

Referenced by main().

static void display_menu ( void  )
static

[reset_irq_handler]

Display the menu.

Referenced by main().

static void display_reset_reason ( void  )
static

Display the reset reason(s).

[reset_get_status]

[reset_get_status]

References RSTC_BACKUP_RESET, RSTC_GENERAL_RESET, rstc_get_status(), RSTC_SOFTWARE_RESET, RSTC_USER_RESET, and RSTC_WATCHDOG_RESET.

Referenced by main().

int main ( void  )

SUPC RTC Wakeup Application entry point.

Returns
Unused (ANSI-C compatibility).

[reset_irq_has_triggered]

[reset_irq_has_triggered]

[reset_enable_user_reset]

[reset_enable_user_reset]

[reset_disable_user_reset]

[reset_disable_user_reset]

[reset_enable_user_reset_interrupt]

[reset_enable_user_reset_interrupt]

[reset_disable_user_reset_interrupt]

[reset_disable_user_reset_interrupt]

[reset_assert_nrst]

[reset_assert_nrst]

References board_init(), configure_console(), configure_watchdog(), cpu_irq_enter_critical(), cpu_irq_leave_critical(), display_menu(), display_reset_reason(), reset_interrupt_triggered, rstc_disable_user_reset(), rstc_disable_user_reset_interrupt(), rstc_enable_user_reset(), rstc_enable_user_reset_interrupt(), rstc_reset_extern(), rstc_set_external_reset(), rstc_start_software_reset(), STRING_HEADER, sysclk_get_cpu_hz(), sysclk_init(), uart_read(), usart_read(), wait_for_message_gone(), and watchdog_enabled.

void RSTC_Handler ( void  )

RSTC interrupt handler.

[reset_irq_handler]

void SysTick_Handler ( void  )

SysTick interrupt handler.

References tick_count, watchdog_enabled, and wdt_restart().

static void wait_for_message_gone ( void  )
static

Wait for UART to finish transmitting.

References uart_is_tx_buf_empty().

Referenced by main().

volatile bool reset_interrupt_triggered = false
static

[reset_irq_variable]

Referenced by main().

volatile uint32_t tick_count = 0U
static
volatile bool watchdog_enabled = true
static

Referenced by main(), and SysTick_Handler().