-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.c
169 lines (142 loc) · 5.17 KB
/
display.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
//------------------------------------------------------------------------------
//
// Description: This file contains functions for making the car do a circle,
// figure 8, and triangle
//
//
// Cameron Koegel
// Jan 2020
// Built with IAR Embedded Workbench Version: V7.12.4
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#include "functions.h"
#include "msp430.h"
#include "macros.h"
#include <string.h>
// Function Protoypes
void Clear_Disp(void);
void Disp_Wait(void);
void Disp_Intercept(void);
void Disp_Stopped(void);
void Disp_Turn(void);
void Disp_Time(void);
void Disp_Circle(void);
void Disp_Cal_1(void);
void Disp_Cal_2(void);
void Disp_Cal_3(void);
void Final_Text(void);
void Disp_L_Det(void);
void Disp_R_Det(void);
void Disp_TW_Det(void);
// Global Variables
extern char display_line[DISP_ROW_FOUR][DISP_COL_ELEVEN];
extern char *display[DISP_ROW_FOUR];
extern unsigned char display_mode;
extern volatile unsigned char display_changed;
extern volatile unsigned char update_display;
extern volatile unsigned int update_display_count;
extern char thousands;
extern char hundreds;
extern char tens;
extern char ones;
void Clear_Disp(void) {
strcpy(display_line[DISP_ROW_ZERO], " ");
update_string(display_line[DISP_ROW_ZERO], DISP_ROW_ZERO);
strcpy(display_line[DISP_ROW_ONE], " ");
update_string(display_line[DISP_ROW_ONE], DISP_ROW_ONE);
strcpy(display_line[DISP_ROW_TWO], " ");
update_string(display_line[DISP_ROW_TWO], DISP_ROW_TWO);
strcpy(display_line[DISP_ROW_THREE], " ");
update_string(display_line[DISP_ROW_THREE], DISP_ROW_THREE);
}
void Disp_Wait(void) {
strcpy(display_line[DISP_ROW_THREE], "S: WAITING");
}
void Disp_Intercept(void) {
strcpy(display_line[DISP_ROW_THREE], "S:INTERCPT");
}
void Disp_Stopped(void) {
strcpy(display_line[DISP_ROW_THREE], "S: STOPPED");
}
void Disp_Turn(void) {
strcpy(display_line[DISP_ROW_THREE], "S: TURNING");
}
void Disp_Time(void) {
display_line[DISP_ROW_THREE][DISP_COL_TWO] = thousands;
display_line[DISP_ROW_THREE][DISP_COL_THREE] = hundreds;
display_line[DISP_ROW_THREE][DISP_COL_FOUR] = tens;
display_line[DISP_ROW_THREE][DISP_COL_FIVE] = '.';
display_line[DISP_ROW_THREE][DISP_COL_SIX] = ones;
}
void Disp_Circle(void) {
strcpy(display_line[DISP_ROW_THREE], "S:CIRCLING");
}
void Disp_Cal_1(void) {
strcpy(display_line[DISP_ROW_TWO], "CAL. WHITE");
strcpy(display_line[DISP_ROW_THREE], " PRESS S2 ");
}
void Disp_Cal_2(void) {
strcpy(display_line[DISP_ROW_TWO], "CAL. BLACK");
strcpy(display_line[DISP_ROW_THREE], " PRESS S2 ");
}
void Final_Text(void) {
Clear_Disp();
strcpy(display_line[DISP_ROW_ONE], " -DONE- ");
update_string(display_line[DISP_ROW_ONE], DISP_ROW_ONE);
}
void Disp_L_Det(void) {
display_line[DISP_ROW_ZERO][DISP_COL_TWO] = thousands;
display_line[DISP_ROW_ZERO][DISP_COL_THREE] = hundreds;
display_line[DISP_ROW_ZERO][DISP_COL_FOUR] = tens;
display_line[DISP_ROW_ZERO][DISP_COL_FIVE] = ones;
display_line[DISP_ROW_ZERO][DISP_COL_TEN] = RESET_STATE;
update_string(display_line[DISP_ROW_ZERO], DISP_ROW_ZERO);
display_changed = TRUE;
}
void Disp_R_Det(void) {
display_line[DISP_ROW_ONE][DISP_COL_TWO] = thousands;
display_line[DISP_ROW_ONE][DISP_COL_THREE] = hundreds;
display_line[DISP_ROW_ONE][DISP_COL_FOUR] = tens;
display_line[DISP_ROW_ONE][DISP_COL_FIVE] = ones;
display_line[DISP_ROW_ONE][DISP_COL_TEN] = RESET_STATE;
update_string(display_line[DISP_ROW_ONE], DISP_ROW_ONE);
display_changed = TRUE;
}
void Disp_TW_Det(void) {
display_line[DISP_ROW_TWO][DISP_COL_TWO] = thousands;
display_line[DISP_ROW_TWO][DISP_COL_THREE] = hundreds;
display_line[DISP_ROW_TWO][DISP_COL_FOUR] = tens;
display_line[DISP_ROW_TWO][DISP_COL_FIVE] = ones;
display_line[DISP_ROW_TWO][DISP_COL_TEN] = RESET_STATE;
update_string(display_line[DISP_ROW_TWO], DISP_ROW_TWO);
display_changed = TRUE;
}
void Disp_Baud_460(void) {
strcpy(display_line[DISP_ROW_TWO], "BR: 460800");
update_string(display_line[DISP_ROW_TWO], DISP_ROW_TWO);
display_changed = TRUE;
}
void Disp_Baud_115(void) {
strcpy(display_line[DISP_ROW_TWO], "BR: 115200");
update_string(display_line[DISP_ROW_TWO], DISP_ROW_TWO);
display_changed = TRUE;
}
void Disp_Baud_96(void) {
strcpy(display_line[DISP_ROW_TWO], "BR: 9600 ");
update_string(display_line[DISP_ROW_TWO], DISP_ROW_TWO);
display_changed = TRUE;
}
void Disp_Msg_Rec(void) {
strcpy(display_line[DISP_ROW_ZERO], " RECEIVED ");
update_string(display_line[DISP_ROW_ZERO], DISP_ROW_ZERO);
strcpy(display_line[DISP_ROW_ONE], " ");
update_string(display_line[DISP_ROW_ONE], DISP_ROW_ONE);
display_changed = TRUE;
}
void Disp_Msg_Trans(void) {
strcpy(display_line[DISP_ROW_ZERO], " TRANSMIT ");
update_string(display_line[DISP_ROW_ZERO], DISP_ROW_ZERO);
strcpy(display_line[DISP_ROW_THREE], " ");
update_string(display_line[DISP_ROW_THREE], DISP_ROW_THREE);
display_changed = TRUE;
}