aboutsummaryrefslogtreecommitdiffstats
path: root/main.h
blob: aaec162f8fc90e0b484f0e9f48faacc565b63d5f (plain)
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
// Initialize variables for date time and alarms
unsigned int sec = 30;
unsigned int min = 42;
unsigned int hour = 21;
unsigned int dayOfWeek = 1;
unsigned int date = 27;
unsigned int month = 7;
unsigned int year = 19;
unsigned int century = 20;
unsigned int alarm1_sec, alarm1_min, alarm1_hour;
unsigned int alarm2_min, alarm2_hour;
unsigned int status_reg, alarm1_status, alarm2_status;
unsigned int control_reg;

// Initialize variables for temperature
unsigned int temperature_lsb = 0;
int temperature_msb = 0;
unsigned char temp_sign = ' ';

// Initialize variable for week day
char* weekday;

// Initialize variable for detecting seconds change
unsigned int sec_chg = 0;

// Initialize variables for splitting decimal digits to characters
unsigned char sec_0, sec_1;
unsigned char min_0, min_1;
unsigned char hour_0, hour_1;
unsigned char day_0, day_1;
unsigned char month_0, month_1;
unsigned char year_0, year_1;
unsigned char temp_0, temp_1, temp_2;
unsigned char alarm1_sec_0, alarm1_sec_1, alarm1_min_0, alarm1_min_1,
alarm1_hour_0, alarm1_hour_1;
unsigned char alarm2_min_0, alarm2_min_1, alarm2_hour_0, alarm2_hour_1;

#ifdef DEBUG
// Initialize a variable to use as a buffer for sprintf
char buf[40];
#endif

// Format unsigned int to unsigned chars
void format_DateTimeChars(void);

// Format msb and lsb for temperature display
void format_Temperature(void);

// Determine day of week from DS3231
void getWeekDay(unsigned int);

// Determine Alarm status from control registers
void Get_Alarm_Status(void);

void display_Intro(void);
void display_Lcd_Layout(void);

void update_Display(void);