aboutsummaryrefslogtreecommitdiffstats
path: root/main.h
blob: 92f369da47c3088ae89810270287fb55605b9585 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "lcd.h"                           //Declaratons for LCD
#include "i2c.h"
#include "ds3231.h"                        //Declarations for RTC

#ifdef ADC
#include "adc.h"                           //Declarations for ADC
#endif

#include "beep.h"                          //Declarations for BEEP

#ifdef DEBUG
#include "uart.h"                          //Declarations for UART
#include "term.h"                          //Declarations for Escape codes
#endif

#ifdef ADC
// Declare variable for LDR
unsigned int ldr;
#endif

// Declare variables for VFD brightness level
#define brtlvl ldr/256
unsigned int brtlvl_chg;

// Update to 1 if RB0 interrupt occurs, otherwise 0
unsigned int update;

// Boolean if setting time manually with user input
unsigned int edit_datetime;

// Declare variables for date time and alarms
unsigned int sec;
unsigned int min;
unsigned int hour;
unsigned int day;
unsigned int date;
unsigned int month;
unsigned int year;
unsigned int century;
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;

// Declare variables for temperature
unsigned int temperature_lsb;
int temperature_msb;
unsigned char temp_sign;

// Declare variables for splitting decimal digit to character
unsigned char temp_0;

// Define MSB / LSB
#define LSB(x) ((x % 10) + '0') // x >> 4
#define MSB(x) ((x / 10) + '0') // x & 0x0F

#ifdef DEBUG
#include <stdio.h>                         // included for sprintf
// Declare a variable to use as a buffer for sprintf
char buf[40];
#endif

void display_Digit(unsigned int);
void display_Intro(void);
void display_Lcd_Layout(void);

void edit_Date_Time(void);

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

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

void update_Display(void);