2020-12-15 19:32:50 -07:00
|
|
|
#pragma once
|
|
|
|
#include "durations.h"
|
|
|
|
|
|
|
|
class Pulse {
|
|
|
|
public:
|
|
|
|
Pulse(unsigned long period);
|
|
|
|
|
|
|
|
/** Ticked tells you if a period has elapsed. */
|
|
|
|
bool Ticked();
|
2020-12-19 16:46:43 -07:00
|
|
|
bool Ticked(unsigned long now);
|
2020-12-15 19:32:50 -07:00
|
|
|
|
|
|
|
/** Until sets the duration of the next period. */
|
|
|
|
void Until(unsigned long next);
|
|
|
|
void Until(unsigned long next, unsigned long now);
|
|
|
|
|
|
|
|
unsigned long period;
|
|
|
|
unsigned long nextEventMillis;
|
|
|
|
};
|