13 #include <hal/cpp/fpga_clock.h>
14 #include <wpi/SafeThread.h>
15 #include <wpi/StringMap.h>
16 #include <wpi/StringRef.h>
38 Watchdog(
double timeout, std::function<
void()> callback);
101 hal::fpga_clock::time_point m_startTime;
102 std::chrono::microseconds m_timeout;
103 hal::fpga_clock::time_point m_expirationTime;
104 std::function<void()> m_callback;
107 bool m_isExpired =
false;
112 bool operator>(
const Watchdog& rhs);
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
void Enable()
Enables the watchdog timer.
double GetTimeout() const
Returns the watchdog's timeout in seconds.
bool IsExpired() const
Returns true if the watchdog timer has expired.
void Reset()
Resets the watchdog timer.
double GetTime() const
Returns the time in seconds since the watchdog was last fed.
void PrintEpochs()
Prints list of epochs added so far and their times.
void SetTimeout(double timeout)
Sets the watchdog's timeout.
void Disable()
Disables the watchdog timer.
A class that's a wrapper around a watchdog timer.
Definition: Watchdog.h:29
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Watchdog(double timeout, std::function< void()> callback)
Watchdog constructor.
void AddEpoch(wpi::StringRef epochName)
Adds time since last epoch to the list printed by PrintEpochs().