mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-24 00:00:44 +01:00
29 lines
509 B
C++
29 lines
509 B
C++
#ifndef ESCHER_TIMER_H
|
|
#define ESCHER_TIMER_H
|
|
|
|
#include <stdint.h>
|
|
|
|
/* Timers we'll need
|
|
* - Blink cursor timer
|
|
* - Dim Screen timer
|
|
* - Power down timer
|
|
* - Watchdog timer ?
|
|
* - Battery level timer
|
|
* - LED blink timer
|
|
*/
|
|
|
|
class Timer {
|
|
public:
|
|
static constexpr int TickDuration = 300; // In Miliseconds
|
|
Timer(uint32_t period); // Period is in ticks
|
|
bool tick();
|
|
void reset();
|
|
protected:
|
|
virtual bool fire() = 0;
|
|
private:
|
|
uint32_t m_period;
|
|
uint32_t m_numberOfTicksBeforeFire;
|
|
};
|
|
|
|
#endif
|