WPILibC++  2018.4.1-20180821013237-1172-g8d8f120
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
frc::Watchdog Class Reference

A class that's a wrapper around a watchdog timer. More...

#include <Watchdog.h>

Public Member Functions

 Watchdog (double timeout, std::function< void()> callback=[]{})
 Watchdog constructor. More...
 
 Watchdog (const Watchdog &)=delete
 
Watchdogoperator= (const Watchdog &)=delete
 
double GetTime () const
 Get the time in seconds since the watchdog was last fed.
 
bool IsExpired () const
 Returns true if the watchdog timer has expired.
 
void AddEpoch (wpi::StringRef epochName)
 Adds time since last epoch to the list printed by PrintEpochs(). More...
 
void PrintEpochs ()
 Prints list of epochs added so far and their times.
 
void Reset ()
 Resets the watchdog timer. More...
 
void Enable ()
 Enables the watchdog timer.
 
void Disable ()
 Disable the watchdog.
 

Detailed Description

A class that's a wrapper around a watchdog timer.

When the timer expires, a message is printed to the console and an optional user-provided callback is invoked.

The watchdog is initialized disabled, so the user needs to call Enable() before use.

Constructor & Destructor Documentation

frc::Watchdog::Watchdog ( double  timeout,
std::function< void()>  callback = []{} 
)
explicit

Watchdog constructor.

Parameters
timeoutThe watchdog's timeout in seconds.
callbackThis function is called when the timeout expires.

Member Function Documentation

void frc::Watchdog::AddEpoch ( wpi::StringRef  epochName)

Adds time since last epoch to the list printed by PrintEpochs().

Parameters
epochNameThe name to associate with the epoch.
void frc::Watchdog::Reset ( )

Resets the watchdog timer.

This also enables the timer if it was previously disabled.


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