|
1 #ifndef DISPLAY_H |
|
2 #define DISPLAY_H |
|
3 |
|
4 #include "Terminal6x8.h" |
|
5 #include "Mono19x27.h" |
|
6 #include "Mono15x22.h" |
|
7 #include "Arial12x12.h" |
|
8 #include "SSD1322.h" |
|
9 #include "hp34comm.h" |
|
10 |
|
11 typedef struct _DSP |
|
12 { |
|
13 uint8_t cmd; |
|
14 uint8_t color; |
|
15 uint8_t bgcolor; |
|
16 uint8_t x0; |
|
17 uint8_t y0; |
|
18 uint8_t fmt; // 0x01=>ascii, 0x02=>hex, 0x04=>bits, 0x08=>flags, 0x80=>ignore |
|
19 uint8_t maxsize; |
|
20 uint8_t width; |
|
21 const unsigned char* font; |
|
22 char buffer[MAX_BUFF+1]; |
|
23 } DSP; |
|
24 |
|
25 static DSP table[] = |
|
26 { |
|
27 { 0x00, 0xF, 0x0, 0, 0, 0x01, MAX_BUFF, 245, Mono19x27}, // main display |
|
28 { 0x0C, 0xF, 0x0,196, 34, 0x01, 3, 45, Mono15x22}, // channels display |
|
29 { 0x0A, 0xF, 0x0, 0, 57, 0x08, 4, 0, Terminal6x8}, // flags + bits |
|
30 }; |
|
31 |
|
32 // 9x10 |
|
33 const unsigned char icon_alarm[] __attribute__((aligned (2))) = |
|
34 { |
|
35 0x1c, 0x0, |
|
36 0x3e, 0x0, |
|
37 0x7f, 0x0, |
|
38 0x7f, 0x0, |
|
39 0x7f, 0x0, |
|
40 0x7f, 0x0, |
|
41 0x7f, 0x0, |
|
42 0x7f, 0x0, |
|
43 0xff, 0x80, |
|
44 0x10, 0x0 |
|
45 }; |
|
46 |
|
47 const unsigned char icon_curve[] __attribute__((aligned (2))) = |
|
48 { |
|
49 0x80, 0x0, |
|
50 0x80, 0x0, |
|
51 0x80, 0x80, |
|
52 0x81, 0x0, |
|
53 0x9e, 0x0, |
|
54 0xa0, 0x0, |
|
55 0xc0, 0x0, |
|
56 0x80, 0x0, |
|
57 0x80, 0x0, |
|
58 0xff, 0x80 |
|
59 }; |
|
60 |
|
61 typedef struct _FLAG |
|
62 { |
|
63 uint8_t flag; |
|
64 uint8_t x; |
|
65 uint8_t y; |
|
66 bool reverse; |
|
67 const char* msg; |
|
68 const unsigned char* icon; |
|
69 } FLAG; |
|
70 |
|
71 typedef struct _FRAME |
|
72 { |
|
73 uint16_t flag; |
|
74 uint8_t x0; |
|
75 uint8_t y0; |
|
76 uint8_t x1; |
|
77 uint8_t y1; |
|
78 } FRAME; |
|
79 |
|
80 static const FLAG flags[] = |
|
81 { |
|
82 // flag, zone, x0, y0, reverse, msg, icon |
|
83 // right-side icons area |
|
84 { 0x00, 246, 0, false, NULL, icon_alarm}, // F1.0 |
|
85 { 0x01, 246, 11, false, NULL, icon_curve}, // F1.1 |
|
86 |
|
87 // F1.2 == Channel frame |
|
88 { 0x03, 197, 27, false, "Channel"}, // F1.3 |
|
89 // F1.7 == Alarm frame |
|
90 |
|
91 { 0x34, 0, 28+8, false, "MON"}, // F4.4 |
|
92 { 0x33, 0, 28+16, false, "VIEW"}, // F4.3 |
|
93 { 0x35, 0, 28, true, "SCAN"}, // F4.5 |
|
94 { 0x36, 0, 28+25, true, "CONFIG"}, // F4.6 |
|
95 |
|
96 { 0x32, 40, 52, false, "*"}, // F4.2 |
|
97 { 0x31, 50, 52, false, "ADRS"}, // F4.1 |
|
98 { 0x30, 80, 52, false, "RMT"}, // F4.0 |
|
99 { 0x27, 104, 52, true, "ERROR"}, // F3.7 |
|
100 |
|
101 { 0x26, 140, 52, false, "EXT"}, // F3.6 |
|
102 { 0x25, 164, 52, false, "ONCE"}, // F3.5 |
|
103 |
|
104 { 0x23, 104, 28+16, false, "MEM"}, // F3.3 |
|
105 |
|
106 |
|
107 // col 5 |
|
108 { 0x14, 244, 22, false, "4W"}, // F2.4 |
|
109 { 0x15, 244, 30, false, "OC"}, // F2.5 |
|
110 { 0x22, 129, 28+16, false, "LAST"}, // F3.2 |
|
111 { 0x21, 129, 28+16, false, "MIN"}, // F3.1 |
|
112 { 0x20, 129, 28+16, false, "MAX"}, // F3.0 |
|
113 { 0x17, 129, 28+16, false, "AVG"}, // F2.7 |
|
114 |
|
115 { 0x05, 154+0, 17+10, false, "Alarm"}, // F1.5 |
|
116 { 0x06, 154+0, 17+20, false, "H"}, // F1.6 |
|
117 { 0x13, 154+6, 17+20, false, "1"}, // F2.3 |
|
118 { 0x10, 154+12, 17+20, false, "2"}, // F2.0 |
|
119 { 0x12, 154+18, 17+20, false, "3"}, // F2.2 |
|
120 { 0x11, 154+24, 17+20, false, "4"}, // F2.1 |
|
121 { 0x04, 154+30, 17+20, false, "L"}, // F1.4 |
|
122 |
|
123 }; |
|
124 |
|
125 static const FRAME zones[] = |
|
126 { // flag, x0, y0, x1, y1 |
|
127 { 0x001, 0, 0, 245, 27}, // main display area |
|
128 { 0x002, 246, 0, 255, 27}, // right notif area |
|
129 { 0x004, 208, 35, 254, 62}, // channels display area |
|
130 { 0x008, 160, 28, 202, 54}, // alarms area |
|
131 { 0x010, 0, 28, 32, 54}, // flags col1 |
|
132 { 0x020, 33, 28, 70, 54}, // flags col2 |
|
133 { 0x040, 71, 28, 103, 54}, // flags col3 |
|
134 { 0x080, 104, 28, 128, 54}, // flags col4 |
|
135 { 0x100, 129, 28, 159, 54}, // flags col5 |
|
136 |
|
137 // { 0x8000, 0, 55, 255, 63}, // flags bits display area |
|
138 }; |
|
139 |
|
140 static const FRAME frames[] = |
|
141 { |
|
142 { 0x02, 194, 30, 243, 53}, // F1.2 - channel frame |
|
143 { 0x07, 151, 30, 192, 46}, // F1.7 - alarm frame |
|
144 }; |
|
145 |
|
146 |
|
147 class Display: public SSD1322 |
|
148 { |
|
149 public: |
|
150 Display(int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC, |
|
151 const char* name); |
|
152 |
|
153 virtual ~Display(); |
|
154 |
|
155 void test_dsp(); |
|
156 void show(uint8_t, const char*, uint8_t); |
|
157 void show_splashscreen(); |
|
158 |
|
159 private: |
|
160 uint8_t must_refresh; |
|
161 |
|
162 }; |
|
163 |
|
164 #endif |