Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
fang::chrono::PollingTimer Class Reference

#include <polling_timer.hpp>

Public Member Functions

 PollingTimer ()
 
void setDuration (Microseconds duration)
 
void restart ()
 
bool isFinished () const
 
Microseconds getTimePastAlarm () const
 
Microseconds getTimePastAlarmAndReset ()
 
Microseconds getTimeLeft () const
 
void reset ()
 

Detailed Description

This is designed to be able to compare between elapsed time in polling loops. So you can have an event timed around a delay without having to stop execution

such as if (pollingTimer.isFinished) { doThis(); compensateDuration(pollingTimer.getTimePastAlarmAndReset()); }

Can time stuff up to 71 days within microsecond precision or 47 minutes double check modm

Constructor & Destructor Documentation

◆ PollingTimer()

fang::chrono::PollingTimer::PollingTimer ( )

Automatically sets current moment to that of its creation :) Sounds a bit mystical imo

Member Function Documentation

◆ getTimeLeft()

Microseconds fang::chrono::PollingTimer::getTimeLeft ( ) const

This will provide a negative value if it has finished

This will allow you to compensate.

◆ getTimePastAlarm()

Microseconds fang::chrono::PollingTimer::getTimePastAlarm ( ) const

This will provide a negative value if it has not finished

This will allow you to compensate.

◆ getTimePastAlarmAndReset()

Microseconds fang::chrono::PollingTimer::getTimePastAlarmAndReset ( )

This is a special call that will allow you to precisely reset the timer AND get the time past alarm without uncounted delay it usees the unique implementation of SimplerTimer's getDurationAndReset

◆ isFinished()

bool fang::chrono::PollingTimer::isFinished ( ) const

true if the timer has elapsed >= comparison

◆ reset()

void fang::chrono::PollingTimer::reset ( )

Resets the count

◆ restart()

void fang::chrono::PollingTimer::restart ( )

Has the timer to begin timing now

◆ setDuration()

void fang::chrono::PollingTimer::setDuration ( Microseconds  duration)

The duration for the timer to wait.

The default duration is zero. Hopefully, this won't crash anything.


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