Microchip® Advanced Software Framework

watchdog.c File Reference
#include "watchdog.h"
#include "asf.h"
#include "wdt.h"
#include "leds.h"

Macros

#define WDT_CLEAR   *((uint8_t *)0x40001008U)
 
#define WDT_CLEAR_MAGIC   0xA5
 
#define WDT_PERIOD_125   WDT_PERIOD_4096CLK
 
#define WDT_PERIOD_17   WDT_PERIOD_512CLK
 Copyright (c) 2015 Microchip Technology Inc and 2012 – 2013, Thingsquare, http://www.thingsquare.com/. More...
 
#define WDT_PERIOD_250   WDT_PERIOD_8192CLK
 
#define WDT_PERIOD_34   WDT_PERIOD_1024CLK
 
#define WDT_PERIOD_500   WDT_PERIOD_16384CLK
 
#define WDT_PERIOD_68   WDT_PERIOD_2048CLK
 

Enumerations

enum  wdt_state {
  NOT_INITED = 0,
  ACTIVE = 1,
  INACTIVE = 2
}
 

Functions

void watchdog_init (void)
 Initiate the Watchdog timer, but does not start it. More...
 
void watchdog_periodic (void)
 Reset the Watchdog timer count. More...
 
void watchdog_reboot (void)
 Reboot the device. More...
 

Variables

static volatile int status = NOT_INITED
 

#define WDT_CLEAR   *((uint8_t *)0x40001008U)
#define WDT_CLEAR_MAGIC   0xA5

Referenced by watchdog_periodic().

#define WDT_PERIOD_125   WDT_PERIOD_4096CLK
#define WDT_PERIOD_17   WDT_PERIOD_512CLK

Copyright (c) 2015 Microchip Technology Inc and 2012 – 2013, Thingsquare, http://www.thingsquare.com/.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Atmel nor the name of Thingsquare nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
  4. This software may only be redistributed and used in connection with an Atmel microcontroller or Atmel wireless product.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#define WDT_PERIOD_250   WDT_PERIOD_8192CLK
#define WDT_PERIOD_34   WDT_PERIOD_1024CLK
#define WDT_PERIOD_500   WDT_PERIOD_16384CLK
#define WDT_PERIOD_68   WDT_PERIOD_2048CLK

enum wdt_state
Enumerator
NOT_INITED 
ACTIVE 
INACTIVE 

void watchdog_init ( void  )
void watchdog_periodic ( void  )

Reset the Watchdog timer count.

References ACTIVE, status, WDT_CLEAR, and WDT_CLEAR_MAGIC.

void watchdog_reboot ( void  )

Reboot the device.

References INACTIVE, NOT_INITED, status, watchdog_init(), watchdog_start(), and WDT_CLEAR.

volatile int status = NOT_INITED
static