COSA
An Object-Oriented Platform for Arduino Programming
Watchdog Class Reference

#include <Watchdog.hh>

Collaboration diagram for Watchdog:
Collaboration graph

Classes

class  Clock
 
class  Scheduler
 

Static Public Member Functions

static bool is_initiated ()
 
static uint32_t millis ()
 
static void millis (uint32_t ms)
 
static uint16_t ms_per_tick ()
 
static void begin (uint16_t ms=16)
 
static void delay (uint32_t ms)
 
static void await ()
 
static uint32_t since (uint32_t start)
 
static void end ()
 
static void job (Watchdog::Scheduler *scheduler)
 
static Watchdog::Schedulerscheduler ()
 
static void wall (Clock *clock)
 
static Clockclock ()
 

Friends

void WDT_vect (void)
 

Detailed Description

The Watchdog is used as a low power timer for periodical events and delay. Please note that the accuracy is only 1-10% if not calibrated (typical drift is 16-32 ms per second).

Definition at line 35 of file Watchdog.hh.

Member Function Documentation

static void Watchdog::await ( )
inlinestatic

Wait for the next watchdog timeout.

Definition at line 96 of file Watchdog.hh.

void Watchdog::begin ( uint16_t  ms = 16)
static

Start watchdog with given period (milli-seconds). The given timeout period is mapped to 16 milli-seconds and double periods (32, 64, 128, etc to approx 8 seconds).

Parameters
[in]mstimeout period in milli-seconds (default 16 ms).

Definition at line 49 of file Watchdog.cpp.

static Clock* Watchdog::clock ( )
inlinestatic

Get the watchdog wall-clock.

Returns
clock.

Definition at line 201 of file Watchdog.hh.

void Watchdog::delay ( uint32_t  ms)
static

Delay using watchdog timeouts and sleep mode. Timeouts will be the nearest watchdog tick.

Parameters
[in]mssleep period in milli-seconds.

Definition at line 73 of file Watchdog.cpp.

static void Watchdog::end ( )
inlinestatic

Stop watchdog. Turn off timout callback. May be restarted with begin().

Definition at line 119 of file Watchdog.hh.

static bool Watchdog::is_initiated ( )
inlinestatic

Returns true(1) if initiated.

Returns
bool.

Definition at line 41 of file Watchdog.hh.

static void Watchdog::job ( Watchdog::Scheduler scheduler)
inlinestatic

Set the watchdog job scheduler. May be used to enable/disable job scheduler.

Parameters
[in]scheduler.
Note
atomic.

Definition at line 158 of file Watchdog.hh.

static uint32_t Watchdog::millis ( )
inlinestatic

Get watchdog clock in milli-seconds.

Returns
time in milli-seconds.
Note
atomic.

Definition at line 51 of file Watchdog.hh.

static void Watchdog::millis ( uint32_t  ms)
inlinestatic

Set watchdog clock in millis-seconds.

Parameters
[in]msmilli-seconds.
Note
atomic.

Definition at line 64 of file Watchdog.hh.

static uint16_t Watchdog::ms_per_tick ( )
inlinestatic

Get number of milli-seconds per tick.

Returns
milli-seconds.

Definition at line 73 of file Watchdog.hh.

static Watchdog::Scheduler* Watchdog::scheduler ( )
inlinestatic

Get the watchdog job scheduler.

Returns
scheduler.

Definition at line 167 of file Watchdog.hh.

static uint32_t Watchdog::since ( uint32_t  start)
inlinestatic

Returns number of milli-seconds from given start time.

Parameters
[in]starttime in milli-seconds.
Returns
milli-seconds.
Note
atomic.

Definition at line 108 of file Watchdog.hh.

static void Watchdog::wall ( Clock clock)
inlinestatic

Set the watchdog wall-clock.

Parameters
[in]clock.
Note
atomic.

Definition at line 192 of file Watchdog.hh.

Friends And Related Function Documentation

void WDT_vect ( void  )
friend

Interrupt Service Routine.


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