-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.c
141 lines (130 loc) · 4.12 KB
/
interface.c
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* ========================================
*
* Copyright YOUR COMPANY, THE YEAR
* All Rights Reserved
* UNPUBLISHED, LICENSED SOFTWARE.
*
* CONFIDENTIAL AND PROPRIETARY INFORMATION
* WHICH IS THE PROPERTY OF your company.
*
* ========================================
*/
/*** INCLUDED COMPONENTS ***/
#include "interface.h"
#include "uart_communication.h"
#include "lm75bd.h"
#include "mcp7940.h"
/*** VARIABLES ***/
/*** FUNCTIONS ***/
void MenuLCD(uint8 menu_index){
switch(menu_index){
case SHOW_TEMPERATURE:
LCD_ClearDisplay();
LCD_Position(0,0);
LCD_PrintString("Temp.");
LCD_Position(1,0);
LCD_PrintNumber(LM75BD_temperature/1000); // Temperature display routine by digits
LCD_PutChar('.');
LCD_PrintNumber(LM75BD_temperature/100%10);
LCD_PrintNumber(LM75BD_temperature/10%10);
LCD_PrintNumber(LM75BD_temperature%10);
LCD_PutChar(LCD_CUSTOM_0);
LCD_PutChar('C');
break;
case SHOW_TIME:
LCD_Position(0,11);
switch(time.weekday){
case 1:
LCD_PrintString("Monday");
break;
case 2:
LCD_PrintString("Tuesday");
break;
case 3:
LCD_PrintString("Wednesday");
break;
case 4:
LCD_PrintString("Thursday");
break;
case 5:
LCD_PrintString("Friday");
break;
case 6:
LCD_PrintString("Saturday");
break;
case 7:
LCD_PrintString("Sunday");
break;
}
LCD_Position(1,12);
LCD_PrintNumber(time.date);
LCD_PutChar('/');
LCD_PrintNumber(time.month);
LCD_PutChar('/');
LCD_PrintNumber(time.year);
LCD_Position(2,10);
LCD_PrintNumber(time.hour);
LCD_PutChar(':');
LCD_PrintNumber(time.minutes);
LCD_PutChar(':');
LCD_PrintNumber(time.seconds);
LCD_Position(2,18);
switch(time.am_pm){
case 0:
LCD_PrintString("am");
break;
case 1:
LCD_PrintString("pm");
break;
}
switch(time.leap_year){
case 0:
LCD_Position(3,8);
LCD_PrintString("Leap Year:");
LCD_PrintString("No");
break;
case 1:
LCD_Position(3,7);
LCD_PrintString("Leap Year:");
LCD_PrintString("Yes");
break;
}
break;
case SHOW_PY_STATE:
LCD_Position(2,0);
LCD_PrintString("Python");
LCD_Position(3,0);
if (python_sync_up){
LCD_PrintString("ON");
}
else{
LCD_PrintString("OFF");
}
break;
}
}
void MenuUART(uint8 menu_index){
switch(menu_index){
case CONFIRM_UPDATE:
UART_PutChar(0xFF);
break;
case SEND_TIME:
UART_PutChar(time.am_pm);
UART_PutChar(time.hour);
UART_PutChar(time.minutes);
UART_PutChar(time.seconds);
break;
case SEND_DATE:
UART_PutChar(time.date);
UART_PutChar(time.month);
UART_PutChar(time.year);
break;
case SEND_TEMPERATURE:
UART_PutChar(LM75BD_temperature/1000);
UART_PutChar(LM75BD_temperature/100%10);
UART_PutChar(LM75BD_temperature/10%10);
UART_PutChar(LM75BD_temperature%10);
break;
}
}
/* [] END OF FILE */