src/display.h

changeset 53
74e85b34d26b
parent 51
d8042bff0e00
child 54
f6774bd0d570
equal deleted inserted replaced
52:098124b730eb 53:74e85b34d26b
30 const unsigned char* font; 30 const unsigned char* font;
31 char buffer[MAX_BUFF+1]; 31 char buffer[MAX_BUFF+1];
32 } DSP; 32 } DSP;
33 33
34 34
35
36 static DSP table[] = 35 static DSP table[] =
37 { // cmd, fg, bg, x0, y0, fmt, maxsize, width, font 36 { // cmd, fg, bg, x0, y0, fmt, maxsize, width, font
38 { 0x00, 0xF, 0x0, 0, 0, FMT_ASCII, MAX_BUFF, 245, Mono19x27}, // main display 37 { 0x00, 0xF, 0x0, 0, 0, FMT_ASCII, MAX_BUFF, 255, Mono19x27}, // main display
39 { 0x0C, 0xF, 0x0,196, 34, FMT_ASCII, 3, 45, Mono15x22}, // channels display 38 { 0x0C, 0xF, 0x0,194, 38, FMT_ASCII, 3, 45, Mono15x22}, // channels display
40 { 0x0A, 0xF, 0x0, 0, 57, FMT_FLAGS, 4, 0, Terminal6x8}, // flags + bits 39 { 0x0A, 0xF, 0x0, 0, 57, FMT_FLAGS, 4, 0, Terminal6x8}, // flags + bits
41 }; 40 };
42 41
43 // 9x10 42 // 9x10
44 const unsigned char icon_alarm[] __attribute__((aligned (2))) = 43 const unsigned char icon_alarm[] __attribute__((aligned (2))) =
45 { 44 {
73 { 72 {
74 uint8_t flag; 73 uint8_t flag;
75 uint8_t x; 74 uint8_t x;
76 uint8_t y; 75 uint8_t y;
77 bool reverse; 76 bool reverse;
77 bool dimm;
78 const char* msg; 78 const char* msg;
79 const unsigned char* icon; 79 const unsigned char* icon;
80 } FLAG; 80 } FLAG;
81 81
82 typedef struct _FRAME 82 typedef struct _FRAME
83 { 83 {
84 uint16_t flag; 84 uint8_t flag;
85 uint8_t x0; 85 uint8_t x0;
86 uint8_t y0; 86 uint8_t y0;
87 uint8_t x1; 87 uint8_t x1;
88 uint8_t y1; 88 uint8_t y1;
89 } FRAME; 89 } FRAME;
90 90
91
92
91 static const FLAG flags[] = 93 static const FLAG flags[] =
92 { 94 {
93 // flag, x0, y0, reverse, msg, icon 95 // flag, x0, y0, reverse, dimm, msg, icon
94 // right-side icons area 96 // right-side icons area
95 // flag is the bit index in the 4 bytes viewed as a 32bits value 97 // flag is the bit index in the 4 bytes viewed as a 32bits value
96 { 0x00, 246, 0, false, NULL, icon_alarm}, // F1.0 01 00 00 00 98 { 0x00, 246, 27, false, false, NULL, icon_alarm}, // F1.0 01 00 00 00
97 { 0x01, 246, 11, false, NULL, icon_curve}, // F1.1 02 00 00 00 99 { 0x01, 246, 38, false, false, NULL, icon_curve}, // F1.1 02 00 00 00
98 // F1.2 04 00 00 00 - Channel frame 100 // F1.2 04 00 00 00 - Channel frame
99 { 0x03, 197, 27, false, "CHANNEL"}, // F1.3 08 00 00 00 101 { 0x03, 195, 29, false, false, "CHANNEL"}, // F1.3 08 00 00 00
100 // F1.7 80 00 00 00 - Alarm frame 102 // F1.7 80 00 00 00 - Alarm frame
101 { 0x1c, 0, 28+8, false, "MON"}, // F4.4 00 00 00 10 103 { 0x1c, 0, 38, false, false, "MON"}, // F4.4 00 00 00 10
102 { 0x1b, 0, 28+16, false, "VIEW"}, // F4.3 00 00 00 08 104 { 0x1b, 0, 47, false, false, "VIEW"}, // F4.3 00 00 00 08
103 { 0x1d, 0, 28, true, "SCAN"}, // F4.5 00 00 00 20 105 { 0x1d, 0, 29, true, false, "SCAN"}, // F4.5 00 00 00 20
104 { 0x1e, 0, 28+25, true, "CONFIG"}, // F4.6 00 00 00 40 106 { 0x1e, 0, 56, true, false, "CONFIG"}, // F4.6 00 00 00 40
105 107
106 { 0x1a, 40, 52, false, "*"}, // F4.2 00 00 00 04 108 { 0x1a, 40, 56, false, false, "*"}, // F4.2 00 00 00 04
107 { 0x19, 50, 52, false, "ADRS"}, // F4.1 00 00 00 02 109 { 0x19, 50, 56, false, false, "ADRS"}, // F4.1 00 00 00 02
108 { 0x18, 80, 52, false, "RMT"}, // F4.0 00 00 00 01 110 { 0x18, 80, 56, false, false, "RMT"}, // F4.0 00 00 00 01
109 { 0x17, 104, 52, true, "ERROR"}, // F3.7 00 00 80 00 111 { 0x17, 104, 56, true, false, "ERROR"}, // F3.7 00 00 80 00
110 112
111 { 0x16, 140, 52, false, "EXT"}, // F3.6 00 00 40 00 113 { 0x16, 86, 38, false, false, "EXT"}, // F3.6 00 00 40 00
112 { 0x15, 164, 52, false, "ONCE"}, // F3.5 00 00 20 00 114 { 0x15, 60, 38, false, false, "ONCE"}, // F3.5 00 00 20 00
113 115
114 { 0x13, 104, 28+16, false, "MEM"}, // F3.3 00 00 08 00 116 { 0x13, 40, 38, false, false, "MEM"}, // F3.3 00 00 08 00
115 117
116 118
117 // col 5 119 // col 5
118 { 0x0c, 244, 22, false, "4W"}, // F2.4 00 10 00 00 120 { 0x0c, 244, 47, false, false, "4W"}, // F2.4 00 10 00 00
119 { 0x0d, 244, 30, false, "OC"}, // F2.5 00 20 00 00 121 { 0x0d, 244, 56, false, false, "OC"}, // F2.5 00 20 00 00
120 { 0x12, 129, 28+16, false, "LAST"}, // F3.2 00 00 04 00
121 { 0x11, 129, 28+16, false, "MIN"}, // F3.1 00 00 02 00
122 { 0x10, 129, 28+16, false, "MAX"}, // F3.0 00 00 01 00
123 { 0x0f, 129, 28+16, false, "AVG"}, // F2.7 00 80 00 00
124 122
125 { 0x05, 154+0, 17+10, false, "Alarm"}, // F1.5 20 00 00 00 123 { 0x12, 40, 47, false, true, "LAST"}, // F3.2 00 00 04 00
126 { 0x08, 154+0, 17+20, false, "H"}, // F1.6 40 00 00 00 124 { 0x11, 66, 47, false, true, "MIN"}, // F3.1 00 00 02 00
127 { 0x07, 154+6, 17+20, false, "1"}, // F2.3 00 08 00 00 125 { 0x10, 86, 47, false, true, "MAX"}, // F3.0 00 00 01 00
128 { 0x06, 154+12, 17+20, false, "2"}, // F2.0 00 01 00 00 126 { 0x0f, 106, 47, false, true, "AVG"}, // F2.7 00 80 00 00
129 { 0x04, 154+18, 17+20, false, "3"}, // F2.2 00 04 00 00
130 { 0x09, 154+24, 17+20, false, "4"}, // F2.1 00 02 00 00
131 { 0x0a, 154+30, 17+20, false, "L"}, // F1.4 00 10 00 00
132 127
133 { 0x80, 224, 54, true, "SHIFT"}, // not an actual command, managed by the front panel 128 { 0x05, 152+0, 29, false, false, "Alarm"}, // F1.5 20 00 00 00
129 { 0x08, 152+0, 39, false, false, "H"}, // F1.6 40 00 00 00
130 { 0x07, 152+6, 39, false, false, "1"}, // F2.3 00 08 00 00
131 { 0x06, 152+12, 39, false, false, "2"}, // F2.0 00 01 00 00
132 { 0x04, 152+18, 39, false, false, "3"}, // F2.2 00 04 00 00
133 { 0x09, 152+24, 39, false, false, "4"}, // F2.1 00 02 00 00
134 { 0x0a, 152+30, 39, false, false, "L"}, // F1.4 00 10 00 00
135
136 { 0x80, 152, 56, true, false, "SHIFT"}, // not an actual command, managed by the front panel
134 }; 137 };
135 138
136 static const FRAME zones[] =
137 { // flag, x0, y0, x1, y1
138 { 0x001, 0, 0, 245, 27}, // main display area
139 { 0x002, 246, 0, 255, 27}, // right notif area
140 { 0x004, 208, 35, 254, 62}, // channels display area
141 { 0x008, 160, 28, 202, 54}, // alarms area
142 { 0x010, 0, 28, 32, 54}, // flags col1
143 { 0x020, 33, 28, 70, 54}, // flags col2
144 { 0x040, 71, 28, 103, 54}, // flags col3
145 { 0x080, 104, 28, 128, 54}, // flags col4
146 { 0x100, 129, 28, 159, 54}, // flags col5
147
148 // { 0x8000, 0, 55, 255, 63}, // flags bits display area
149 };
150 139
151 static const FRAME frames[] = 140 static const FRAME frames[] =
152 { 141 {
153 { 0x02, 194, 30, 243, 53}, // F1.2 - channel frame 142 { 0x02, 192, 32, 240, 60}, // F1.2 - channel frame
154 { 0x0b, 151, 30, 192, 46}, // F1.7 - alarm frame 143 { 0x0b, 149, 32, 190, 50}, // F1.7 - alarm frame
155 }; 144 };
145
146
147 typedef enum {
148 FLAG_OFF,
149 FLAG_ON,
150 FLAG_DIM
151 } flag_status_t;
152
153 typedef struct _FLAG_STATUS
154 {
155 uint8_t flag;
156 flag_status_t status;
157 } FLAG_STATUS;
156 158
157 159
158 class Display: public SSD1322 160 class Display: public SSD1322
159 { 161 {
160 public: 162 public:

mercurial