-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.h
More file actions
65 lines (37 loc) · 1.51 KB
/
Copy pathclock.h
File metadata and controls
65 lines (37 loc) · 1.51 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// this is a base <data provider> class, this class will not access any
// of the other, this class will provide time data and it will set an
#ifndef CLOCK_H
#define CLOCK_H
#include <Arduino.h>
#include <Wire.h>
#include "Libraries/Rtc_Pcf8563/Rtc_Pcf8563.h"
namespace Clock {
// data types
typedef void (*TimeCallback)(int seconds, int minutes, int hours);
typedef void (*DateCallback)(int day, int month, int year);
typedef void (*AlarmCallback)();
extern int is_alarm_active;
void init(); // initation function
void loop(); // loop this is required to be run
// functions to get the time
byte get_seconds();
byte get_mintues();
byte get_hour();
// functions to get the date
byte get_day();
byte get_month();
byte get_year();
// functions to get the alarm time that is already set
byte get_alarm_mintues();
byte get_alarm_hour();
// functions to set the time, date and alarm
void set_time(byte seconds, byte mintues, byte hours);
void set_date(byte day, byte months, byte fullYear);
void set_alarm(byte mintues, byte hours);
void reset_alarm(); // this reset the alaram really import to run after the alarm is triggered
// call back register function for the event system
void register_time_callback(TimeCallback callback);
void register_date_callback(DateCallback callback);
void register_alarm_callback(AlarmCallback callback);
}
#endif