Watchdog Timer for the K64F. User can set timeout value from 1 to 356 seconds with a one second resolution.

Dependents:   Telliskivi2_2014 mbed-IBooth-ETH TwitterReader

Embed: (wiki syntax)

« Back to documentation index

Watchdog Class Reference

Watchdog Class Reference

Routines to set and kick the Watchdog timer for the K64F. More...

#include <Watchdog.h>

Public Member Functions

void kick (int WDTseconds)
 Create a Watchdog object and initialize timeout in seconds.
void kick ()
 Keep alive by kicking the Watchdog occasionally.

Detailed Description

Routines to set and kick the Watchdog timer for the K64F.

User inputs a value from 1 to 356 seconds when initializing the Watchdog timer. The user's input number is multiplied by a fixed value and then placed into the countdown timer.

The user is responsible for "kicking" the Watchdog before the timeout interval expires, otherwise the K64F will automatically reboot.

 #include "mbed.h"
 #include "Watchdog.h" 

 Watchdog wdt;

 int main() {
     //initialization code....
     wdt.kick(20);           //init the watchdog for a 20 second timeout
     while(1) {
         wait_ms(1000);      //do some code
         wdt.kick();         //kick the watchdog before 20 seconds is up
     }
 }

Definition at line 34 of file Watchdog.h.


Member Function Documentation

void kick ( int  WDTseconds )

Create a Watchdog object and initialize timeout in seconds.

Parameters:
inttimeout in seconds. Range (1 - 356)

Note: if value out of range, default value with be 356

Returns:
NONE

Definition at line 6 of file Watchdog.cpp.

void kick (  )

Keep alive by kicking the Watchdog occasionally.

Parameters:
NONE
Returns:
NONE

Definition at line 17 of file Watchdog.cpp.