PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Public Member Functions | Static Public Member Functions | List of all members
PropWare::WatchDog Class Reference

Simple WatchDog object for resetting the chip if it stops responding. More...

#include <PropWare/concurrent/watchdog.h>

+ Inheritance diagram for PropWare::WatchDog:
+ Collaboration diagram for PropWare::WatchDog:

Public Member Functions

template<size_t N>
 WatchDog (const uint32_t(&stack)[N], const unsigned int timeout, const unsigned int monitorFrequency=MICROSECOND<< 7)
 Constructor. More...
 
void reset ()
 Reset the timer.
 
void run ()
 Invoked in the new cog, this method should be the root of the business logic.
 

Static Public Member Functions

template<class T >
static int8_t invoke (T &runnable)
 Start a new cog running the given object. More...
 

Detailed Description

Simple WatchDog object for resetting the chip if it stops responding.

Examples
WatchDog_Demo.cpp.

Definition at line 37 of file watchdog.h.

Constructor & Destructor Documentation

◆ WatchDog()

template<size_t N>
PropWare::WatchDog::WatchDog ( const uint32_t(&)  stack[N],
const unsigned int  timeout,
const unsigned int  monitorFrequency = MICROSECOND << 7 
)

Constructor.

Parameters
[in]stack[]A small stack for a few variables
[in]timeoutLength of time (in clock ticks) before the Propeller should be reset
[in]monitorFrequencyLength of time to sleep between each check for the timeout (default value of 128us is recommended)

Definition at line 48 of file watchdog.h.

Member Function Documentation

◆ invoke()

template<class T >
static int8_t PropWare::Runnable::invoke ( T &  runnable)
staticinherited

Start a new cog running the given object.

Parameters
[in]runnableObject that should be invoked in a new cog
Returns
If the cog was successfully started, the new cog ID is returned. Otherwise, -1 is returned

Definition at line 85 of file runnable.h.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: