-
Notifications
You must be signed in to change notification settings - Fork 0
/
clock.cpp
40 lines (32 loc) · 828 Bytes
/
clock.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
#include "clock.h"
Clock::Clock() {
}
void Clock::init() {
Wire.begin();
clockModule.setClockMode(false);
}
void Clock::setTime(int hour, int minute, int second) {
clockModule.setHour(hour);
clockModule.setMinute(minute);
clockModule.setSecond(second);
}
int Clock::getTime(int *hour, int *minute, int *second) {
currentMilis = millis();
if (currentMilis - previousMilis >= 1000){
previousMilis = currentMilis;
*hour = clockModule.getHour(h12Flag, pmFlag);
*minute = clockModule.getMinute();
*second = clockModule.getSecond();
}
}
bool Clock::isWeekend() {
int dayOfWeek = getDayOfWeek();
if (dayOfWeek > 5) return true;
else return false;
}
void Clock::setDayOfWeek(byte DayOfWeek) {
clockModule.setDoW(DayOfWeek);
}
byte Clock::getDayOfWeek() {
return clockModule.getDoW();
}