aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rwxr-xr-xmain.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/main.c b/main.c
index 9c1020b..e93e992 100755
--- a/main.c
+++ b/main.c
@@ -1,7 +1,5 @@
#include <stdio.h> // included for sprintf
-#define DEBUG 0 // Enable/Disable debugging via UART
-
#include "conf.h" //Configuration settings
#include "main.h" //Declarations for main
#include "lcd.h" //Declaratons for LCD
@@ -9,7 +7,7 @@
#include "ds3231.h" //Declarations for RTC
#include "beep.h" //Declarations for BEEP
-#if DEBUG
+#ifdef DEBUG
#include "uart.h" //Declarations for UART
#include "term.h" //Declarations for Escape codes
#endif
@@ -21,7 +19,7 @@ int main() {
TRISD = 0x00; // Set PORTD as outputs
PORTD = 0x00; // Set all PORTD pins LOW
-#if DEBUG
+#ifdef DEBUG
Initialize_UART(); //Initialize UART module
UART_send_string(CLS); // Clear screen
UART_send_string(CURSOR(12, 23)); // Set cursor at line 12, column 23
@@ -31,7 +29,7 @@ int main() {
#endif
I2C_Master_Init(100000); // Init I2C Master with 100KHz Clock
-#if DEBUG
+#ifdef DEBUG
UART_send_string(CURSOR(13, 24)); // Set cursor at line 12, column 23
UART_send_string(GREEN); // Set Green
UART_send_string("I2C Module Initialized and active\r\n");
@@ -39,7 +37,7 @@ int main() {
#endif
Lcd_Init();
-#if DEBUG
+#ifdef DEBUG
UART_send_string(CURSOR(14, 24)); // Set cursor at line 12, column 23
UART_send_string(GREEN); // Set Green
UART_send_string("LCD Module Initialized and active\r\n");
@@ -76,26 +74,36 @@ int main() {
while (1) {
// Set time and date variables from DS3231
- //UART_send_string("Updating current date time from DS3231\r\n");
+#ifdef DEBUG
+ UART_send_string("Updating current date time from DS3231\r\n");
+#endif
Update_Current_Date_Time();
// Read temp
- //UART_send_string("Reading Alarms and Temperature");
+#ifdef DEBUG
+ UART_send_string("Reading Alarms and Temperature");
+#endif
Read_Alarms_Temp();
// Get Alarm Status
Get_Alarm_Status();
// Separate the int timedate variables into chars
- //UART_send_string("Formatting chars");
+#ifdef DEBUG
+ UART_send_string("Formatting chars");
+#endif
format_DateTimeChars();
// Format temperature
- //UART_send_string("Formating temperature");
+#ifdef DEBUG
+ UART_send_string("Formating temperature");
+#endif
format_Temperature();
// Determine day of the week
- //UART_send_string("Determining day of week");
+#ifdef DEBUG
+ UART_send_string("Determining day of week");
+#endif
getWeekDay(dayOfWeek);
// Enter loop and update display if sec changes from DS3231
@@ -106,7 +114,7 @@ int main() {
// Set temp_sec to current sec from DS3231
sec_chg = sec;
-#if DEBUG
+#ifdef DEBUG
UART_send_string(CURSOR(19, 1));
sprintf(buf, "%sTIME:%s\t%02d:%02d:%02d\r\n", YELLOW, CLRATTR,
hour, min, sec);