-
Notifications
You must be signed in to change notification settings - Fork 0
/
CTimer.h
36 lines (32 loc) · 912 Bytes
/
CTimer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef CTIMER_H
#define CTIMER_H
#include <Arduino.h>
#include "phmeter.h"
#include "PushButton.h"
//#include "config.h"
#include <U8g2lib.h> //fonts https://lopaka.app/
#include <U8x8lib.h>
enum TimerState { Stopped, Running, Finished };
class CTimer {
private:
unsigned long countdownTime;
unsigned long lastUpdateTime;
unsigned long lastSetCountdownTime;
unsigned long initialCountdownTime;
TimerState state;
U8G2_SSD1309_128X64_NONAME2_F_HW_I2C* display;
public:
CTimer();
CTimer(unsigned long duration, U8G2_SSD1309_128X64_NONAME2_F_HW_I2C& displayRef);
void start();
void stop();
void reset();
void update();
void addTime(unsigned long additionalTime);
void subtractTime(unsigned long subtractTime);
bool isRunning();
void updateLastSetTime(unsigned long time);
unsigned long getCountdownTime() const;
unsigned long getLastSetTime() const;
};
#endif // CTIMER_H