src/display.h

changeset 44
b3c3d54d2c7c
parent 37
07e8ca2bdf6d
child 46
a4a007b3c42e
equal deleted inserted replaced
43:c850674a3101 44:b3c3d54d2c7c
5 #include "Mono19x27.h" 5 #include "Mono19x27.h"
6 #include "Mono15x22.h" 6 #include "Mono15x22.h"
7 #include "Arial12x12.h" 7 #include "Arial12x12.h"
8 #include "SSD1322.h" 8 #include "SSD1322.h"
9 #include "hp34comm.h" 9 #include "hp34comm.h"
10
11 //typedef enum {
12 #define FMT_ASCII 0x01
13 #define FMT_HEX 0x02
14 #define FMT_BITS 0x04
15 #define FMT_FLAGS 0x08
16 #define FMT_IGNORE 0x80
17 //} dsp_format_t;
18
10 19
11 typedef struct _DSP 20 typedef struct _DSP
12 { 21 {
13 uint8_t cmd; 22 uint8_t cmd;
14 uint8_t color; 23 uint8_t color;
20 uint8_t width; 29 uint8_t width;
21 const unsigned char* font; 30 const unsigned char* font;
22 char buffer[MAX_BUFF+1]; 31 char buffer[MAX_BUFF+1];
23 } DSP; 32 } DSP;
24 33
34
35
25 static DSP table[] = 36 static DSP table[] =
26 { 37 { // cmd, fg, bg, x0, y0, fmt, maxsize, width, font
27 { 0x00, 0xF, 0x0, 0, 0, 0x01, MAX_BUFF, 245, Mono19x27}, // main display 38 { 0x00, 0xF, 0x0, 0, 0, FMT_ASCII, MAX_BUFF, 245, Mono19x27}, // main display
28 { 0x0C, 0xF, 0x0,196, 34, 0x01, 3, 45, Mono15x22}, // channels display 39 { 0x0C, 0xF, 0x0,196, 34, FMT_ASCII, 3, 45, Mono15x22}, // channels display
29 { 0x0A, 0xF, 0x0, 0, 57, 0x08, 4, 0, Terminal6x8}, // flags + bits 40 { 0x0A, 0xF, 0x0, 0, 57, FMT_FLAGS, 4, 0, Terminal6x8}, // flags + bits
30 }; 41 };
31 42
32 // 9x10 43 // 9x10
33 const unsigned char icon_alarm[] __attribute__((aligned (2))) = 44 const unsigned char icon_alarm[] __attribute__((aligned (2))) =
34 { 45 {
77 uint8_t y1; 88 uint8_t y1;
78 } FRAME; 89 } FRAME;
79 90
80 static const FLAG flags[] = 91 static const FLAG flags[] =
81 { 92 {
82 // flag, zone, x0, y0, reverse, msg, icon 93 // flag, x0, y0, reverse, msg, icon
83 // right-side icons area 94 // right-side icons area
84 { 0x00, 246, 0, false, NULL, icon_alarm}, // F1.0 95 // flag is the bit index in the 4 bytes viewed as a 32bits value
85 { 0x01, 246, 11, false, NULL, icon_curve}, // F1.1 96 { 0x00, 246, 0, false, NULL, icon_alarm}, // F1.0 01 00 00 00
97 { 0x01, 246, 11, false, NULL, icon_curve}, // F1.1 02 00 00 00
98 // F1.2 04 00 00 00 - Channel frame
99 { 0x03, 197, 27, false, "CHANNEL"}, // F1.3 08 00 00 00
100 // F1.7 80 00 00 00 - Alarm frame
101 { 0x1c, 0, 28+8, false, "MON"}, // F4.4 00 00 00 10
102 { 0x1b, 0, 28+16, false, "VIEW"}, // F4.3 00 00 00 08
103 { 0x1d, 0, 28, true, "SCAN"}, // F4.5 00 00 00 20
104 { 0x1e, 0, 28+25, true, "CONFIG"}, // F4.6 00 00 00 40
86 105
87 // F1.2 == Channel frame 106 { 0x1a, 40, 52, false, "*"}, // F4.2 00 00 00 04
88 { 0x03, 197, 27, false, "Channel"}, // F1.3 107 { 0x19, 50, 52, false, "ADRS"}, // F4.1 00 00 00 02
89 // F1.7 == Alarm frame 108 { 0x18, 80, 52, false, "RMT"}, // F4.0 00 00 00 01
109 { 0x17, 104, 52, true, "ERROR"}, // F3.7 00 00 80 00
90 110
91 { 0x34, 0, 28+8, false, "MON"}, // F4.4 111 { 0x16, 140, 52, false, "EXT"}, // F3.6 00 00 40 00
92 { 0x33, 0, 28+16, false, "VIEW"}, // F4.3 112 { 0x15, 164, 52, false, "ONCE"}, // F3.5 00 00 20 00
93 { 0x35, 0, 28, true, "SCAN"}, // F4.5
94 { 0x36, 0, 28+25, true, "CONFIG"}, // F4.6
95 113
96 { 0x32, 40, 52, false, "*"}, // F4.2 114 { 0x13, 104, 28+16, false, "MEM"}, // F3.3 00 00 08 00
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 115
106 116
107 // col 5 117 // col 5
108 { 0x14, 244, 22, false, "4W"}, // F2.4 118 { 0x0c, 244, 22, false, "4W"}, // F2.4 00 10 00 00
109 { 0x15, 244, 30, false, "OC"}, // F2.5 119 { 0x0d, 244, 30, false, "OC"}, // F2.5 00 20 00 00
110 { 0x22, 129, 28+16, false, "LAST"}, // F3.2 120 { 0x12, 129, 28+16, false, "LAST"}, // F3.2 00 00 04 00
111 { 0x21, 129, 28+16, false, "MIN"}, // F3.1 121 { 0x11, 129, 28+16, false, "MIN"}, // F3.1 00 00 02 00
112 { 0x20, 129, 28+16, false, "MAX"}, // F3.0 122 { 0x10, 129, 28+16, false, "MAX"}, // F3.0 00 00 01 00
113 { 0x17, 129, 28+16, false, "AVG"}, // F2.7 123 { 0x0f, 129, 28+16, false, "AVG"}, // F2.7 00 80 00 00
114 124
115 { 0x05, 154+0, 17+10, false, "Alarm"}, // F1.5 125 { 0x05, 154+0, 17+10, false, "Alarm"}, // F1.5 20 00 00 00
116 { 0x06, 154+0, 17+20, false, "H"}, // F1.6 126 { 0x06, 154+0, 17+20, false, "H"}, // F1.6 40 00 00 00
117 { 0x13, 154+6, 17+20, false, "1"}, // F2.3 127 { 0x0b, 154+6, 17+20, false, "1"}, // F2.3 00 08 00 00
118 { 0x10, 154+12, 17+20, false, "2"}, // F2.0 128 { 0x08, 154+12, 17+20, false, "2"}, // F2.0 00 01 00 00
119 { 0x12, 154+18, 17+20, false, "3"}, // F2.2 129 { 0x0a, 154+18, 17+20, false, "3"}, // F2.2 00 04 00 00
120 { 0x11, 154+24, 17+20, false, "4"}, // F2.1 130 { 0x09, 154+24, 17+20, false, "4"}, // F2.1 00 02 00 00
121 { 0x04, 154+30, 17+20, false, "L"}, // F1.4 131 { 0x04, 154+30, 17+20, false, "L"}, // F1.4 00 10 00 00
122 132
133 { 0x80, 224, 54, true, "SHIFT"}, // not an actual command, managed by the front panel
123 }; 134 };
124 135
125 static const FRAME zones[] = 136 static const FRAME zones[] =
126 { // flag, x0, y0, x1, y1 137 { // flag, x0, y0, x1, y1
127 { 0x001, 0, 0, 245, 27}, // main display area 138 { 0x001, 0, 0, 245, 27}, // main display area
152 163
153 virtual ~Display(); 164 virtual ~Display();
154 165
155 void test_dsp(); 166 void test_dsp();
156 void show(uint8_t, const char*, uint8_t); 167 void show(uint8_t, const char*, uint8_t);
168 void dimm_char(uint8_t);
157 void show_splashscreen(); 169 void show_splashscreen();
170 void show_byescreen();
171 void set_flag(uint8_t flag, bool show);
172 void show_flag(uint8_t flag) {set_flag(flag, true);};
173 void hide_flag(uint8_t flag) {set_flag(flag, false);};
174 void shift_on() {set_flag(0x80, true);};
175 void shift_off() {set_flag(0x80, false);};
176
158 177
159 private: 178 private:
160 uint8_t must_refresh; 179 uint8_t must_refresh;
161 180
162 }; 181 };

mercurial