-
Notifications
You must be signed in to change notification settings - Fork 0
/
displaySubsystem.c
49 lines (40 loc) · 951 Bytes
/
displaySubsystem.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
#include "tpl_os.h"
#include "endStopSubsystem.h"
#include "motorSubsystem.h"
#include "oled.h"
#include "controller.h"
char *state[] = { "ON ", "OFF" };
TASK(display)
{
OLEDSetTextCursor(0, 0);
OLEDPrintString("RES: ");
OLEDPrintString(state[redEndStop()]);
OLEDSetTextCursor(0, 1);
OLEDPrintString("GES: ");
OLEDPrintString(state[grayEndStop()]);
OLEDSetTextCursor(0, 2);
OLEDPrintString("MOD: ");
OLEDPrintString((char *)currentMode());
OLEDSetTextCursor(0, 3);
OLEDPrintString("POS: ");
OLEDPrintInt(position(),8);
OLEDSetTextCursor(60, 0);
if (direction() == 0) {
OLEDPrintString("towards GRAY");
}
else {
OLEDPrintString("towards RED ");
}
TickType dummy;
OLEDSetTextCursor(60, 1);
if (GetAlarm(motorRun, &dummy) == E_OK) {
OLEDPrintString("RUN ");
}
else {
OLEDPrintString("STOP");
}
OLEDSetTextCursor(70, 3);
OLEDPrintString("SLOT: ");
OLEDPrintInt(slot(), 1);
TerminateTask();
}