FastLED 3.9.15
Loading...
Searching...
No Matches
CEveryNTime Class Reference

Detailed Description

Time interval checking class.

Keeps track of a time interval in order to limit how often code is executed.

Note
TIMETYPE is specific to the initialized class, and is in the units used by the time function. E.g. for EVERY_N_MILLIS it's uint32_t and milliseconds, for EVERY_N_HOURS it's uint8_t and hours, etc.
Warning
This specific class isn't actually part of the library! It's created using a preprocessor macro (INSTANTIATE_EVERY_N_TIME_PERIODS) as a new class for every different time unit. It has been recreated specifically for the documentation, so that the methods can be documented as usual.
See also
INSTANTIATE_EVERY_N_TIME_PERIODS

Definition at line 1120 of file lib8tion.h.

#include <lib8tion.h>

Public Member Functions

 CEveryNTime ()
 Default constructor.
 
 CEveryNTime (TIMETYPE period)
 Constructor.
 
TIMETYPE getElapsed ()
 Get the time elapsed since the last trigger event.
 
TIMETYPE getLastTriggerTime ()
 Get the timestamp of the most recent trigger event.
 
TIMETYPE getPeriod ()
 Get the time interval between triggers.
 
TIMETYPE getRemaining ()
 Get the time until the next trigger event.
 
TIMETYPE getTime ()
 Get the current time according to the class' timekeeper.
 
 operator bool ()
 Check if the time interval has elapsed.
 
bool ready ()
 Check if the time interval has elapsed.
 
void reset ()
 Reset the timestamp to the current time.
 
void setPeriod (TIMETYPE period)
 Set the time interval between triggers.
 
void trigger ()
 Reset the timestamp so it is ready() on next call.
 

Public Attributes

TIMETYPE mPeriod
 Timing interval to check.
 
TIMETYPE mPrevTrigger
 Timestamp of the last time the class was "ready".
 

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