MIDI Control Surface library for Arduino
|
Go to the documentation of this file.
7 #include <AH/Arduino-Wrapper.h> // millis, micros
10 #include <AH/Settings/NamespaceSettings.hpp>
27 template <timefunction time = micros>
35 Timer(
unsigned long interval) : interval(interval) {
41 void begin() { previous = time() - interval; }
45 explicit operator bool() {
47 if (now - previous >= interval) {
57 void setInterval(
unsigned long interval) { this->interval = interval; }
61 unsigned long previous = 0;
Timer(unsigned long interval)
Constructor.
A class for easily managing timed events.
void beginNextPeriod()
Initialize or reset the timer. The timer will fire after one period.
#define AH_DIAGNOSTIC_POP()
void begin()
Initialize or reset the timer. The timer will fire immediately.
void setInterval(unsigned long interval)
Set the interval of the timer.
unsigned long getInterval() const
Get the interval of the timer.
unsigned long(*)() timefunction
A function type that returns a time value.
#define AH_DIAGNOSTIC_EXTERNAL_HEADER()
#define AH_DIAGNOSTIC_WERROR()
#define BEGIN_AH_NAMESPACE