-
Notifications
You must be signed in to change notification settings - Fork 1
/
screen_test.c
152 lines (123 loc) · 3.49 KB
/
screen_test.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
/**
* Screen test routines
*/
#include <stdio.h>
/* Scheduler includes. */
#include "FreeRTOS.h"
#include "task.h"
//#include "semphr.h"
//#include "queue.h"
#include "setup.h"
#include "assert.h"
#include "GLCD.h"
//#include "stm3210c_eval_ioe.h"
#include "global.h"
#include "screen.h"
/**
*task for testing screen
*/
void lcdTestTask(void *params) {
int response;
int i;
unsigned int lineNo = Line0;
unsigned int textCol = Black;
unsigned char menuText1[16] = "Activate\0";
unsigned char menuText2[16] = "Config\0";
unsigned char menuText3[16] = "Exit\0";
unsigned char testText[16] = "Hejhopp Line 0\0";
unsigned char enterCode[20] = "Enter code:\0";
char touched[32];
unsigned char uTouched[32];
//start with a delay, to make the original diplay appear
//vTaskDelay(3000 / portTICK_RATE_MS);
for (;;) {
//clear display
screenClear();
response = screenMenu2(menuText1, menuText2);
sprintf(touched, "Response menu: %d\0", response);
i = 0;
while (touched[i] != 0 && i < 32) {
uTouched[i] = touched[i];
i++;
}
uTouched[i] = 0;
screenOutputTextLine(Navy, Line9, uTouched);
vTaskDelay(2000 / portTICK_RATE_MS);
//clear display
screenClear ();
//display lines with text
textCol = Black;
lineNo = Line0;
testText[0] = 'H';
testText[14] = '0';
//output one line
screenOutputTextLine(textCol, lineNo, testText);
//change attributes of line
textCol = Black;
lineNo = Line1;
testText[0] = 'h';
testText[14] = '1';
//output second line
screenOutputTextLine(textCol, lineNo, testText);
//a third line
testText[14] = '2';
screenOutputTextLine(Green, Line2, testText);
//a fourth line
testText[14] = '3';
screenOutputTextLine(Yellow, Line3, testText);
//the ninth line
testText[14] = '4';
screenOutputTextLine(Red, Line4, testText);
//the ninth line
testText[14] = '5';
screenOutputTextLine(Olive, Line5, testText);
//the ninth line
testText[14] = '6';
screenOutputTextLine(White, Line6, testText);
//the ninth line
testText[14] = '7';
screenOutputTextLine(Blue, Line7, testText);
//the ninth line
testText[14] = '8';
screenOutputTextLine(Cyan, Line8, testText);
//the ninth line
testText[14] = '9';
screenOutputTextLine(Magenta, Line9, testText);
vTaskDelay(5000 / portTICK_RATE_MS);
//display text and numbers
response = screenQueryNumber(Blue, enterCode, 4);
sprintf(touched, "%d\0", response);
i = 0;
while (touched[i] != 0 && i < 32) {
uTouched[i] = touched[i];
i++;
}
uTouched[i] = 0;
screenOutputTextLine(Navy, Line9, uTouched);
vTaskDelay(3000 / portTICK_RATE_MS);
//diplay text and characters
screenQueryChars(Blue, enterCode, 20, uTouched);
screenOutputTextLine(Navy, Line9, uTouched);
vTaskDelay(3000 / portTICK_RATE_MS);
//clear display
screenClear();
response = screenMenu3(menuText1, menuText2, menuText3);
sprintf(touched, "Response menu: %d\0", response);
i = 0;
while (touched[i] != 0 && i < 32) {
uTouched[i] = touched[i];
i++;
}
uTouched[i] = 0;
screenOutputTextLine(Navy, Line9, uTouched);
vTaskDelay(2000 / portTICK_RATE_MS);
}
}
/**
*create task for testing screen
*/
void lcdTest() {
//start a separate task for display test
xTaskCreate(lcdTestTask, "lcdTestTask", 100, NULL, 1, NULL);
}
/*-----------------------------------------------------------*/