-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDCS_CDU_DISPLAY.ino
More file actions
109 lines (91 loc) · 2.75 KB
/
DCS_CDU_DISPLAY.ino
File metadata and controls
109 lines (91 loc) · 2.75 KB
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
/*
Tell DCS-BIOS to use a serial connection and use the default Arduino Serial
library. This will work on the vast majority of Arduino-compatible boards,
but you can get corrupted data if you have too many or too slow outputs
(e.g. when you have multiple character displays), because the receive
buffer can fill up if the sketch spends too much time updating them.
If you can, use the IRQ Serial connection instead.
*/
#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"
#include <Adafruit_GFX.h>
#include <UTFTGLUE.h>
UTFTGLUE myGLCD(0x9488,A2,A1,A3,A4,A0);
void printChar(int row, int col, unsigned char c) {
int16_t x = 13 + col * 19;
int16_t y = row * 32 + 6;
myGLCD.drawChar(x, y, c, 0x07E0, 0x0, 3);
}
/* paste code snippets from the reference documentation here */
void onCduLine0Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(0, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine0Buffer(0x11c0, onCduLine0Change);
void onCduLine1Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(1, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine1Buffer(0x11d8, onCduLine1Change);
void onCduLine2Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(2, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine2Buffer(0x11f0, onCduLine2Change);
void onCduLine3Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(3, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine3Buffer(0x1208, onCduLine3Change);
void onCduLine4Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(4, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine4Buffer(0x1220, onCduLine4Change);
void onCduLine5Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(5, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine5Buffer(0x1238, onCduLine5Change);
void onCduLine6Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(6, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine6Buffer(0x1250, onCduLine6Change);
void onCduLine7Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(7, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine7Buffer(0x1268, onCduLine7Change);
void onCduLine8Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(8, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine8Buffer(0x1280, onCduLine8Change);
void onCduLine9Change(char* newValue) {
for(int i = 0; i < 24; i++){
printChar(9, i, newValue[i]);
}
}
DcsBios::StringBuffer<24> cduLine9Buffer(0x1298, onCduLine9Change);
void setup() {
DcsBios::setup();
// Setup the LCD
myGLCD.InitLCD();
myGLCD.clrScr();
myGLCD.setTextSize(3);
myGLCD.setColor(0, 0, 255);
myGLCD.drawRect(10, 0, 469, 319);
}
void loop() {
DcsBios::loop();
}