-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimer.cpp
44 lines (38 loc) · 959 Bytes
/
Timer.cpp
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
37
38
39
40
41
42
43
44
#include "Timer.h"
Timer::Timer(uint32_t _timing, Button* _plus, Button* _minus, OutManager* _outmanager, Clock* _clok){
init();
setInterval(100);
timing = _timing;
plus = _plus;
minus = _minus;
outmanager = _outmanager;
clok = _clok;
clok->setNumber(timing/100);
}
void Timer::increase(uint32_t delta){
if(timing + delta <= __TIMER_H_MAX_INTER){
timing += delta;
} else {
timing = __TIMER_H_MAX_INTER;
}
clok->setNumber(timing/100);
}
void Timer::decrease(uint32_t delta){
if(timing - delta > __TIMER_H_MIN_INTER){
timing -= delta;
} else {
timing = __TIMER_H_MIN_INTER;
}
clok->setNumber(timing/100);
}
void Timer::task(){
if(plus->isClicked()){
increase(__TIMER_H_FIXED_DELTA);
}
if(minus->isClicked()){
decrease(__TIMER_H_FIXED_DELTA);
}
outmanager->setInterval(timing);
}
void Timer::taskBoot(){}
void Timer::taskShutdown(){}