MIDI Control Surface library for Arduino
|
Go to the documentation of this file.
7 #include <Arduino.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; }
43 explicit operator bool() {
45 if (now - previous >= interval) {
55 void setInterval(
unsigned long interval) { this->interval = interval; }
59 unsigned long previous = 0;
Timer(unsigned long interval)
Constructor.
A class for easily managing timed events.
#define AH_DIAGNOSTIC_POP()
void begin()
Initialize the timer.
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