src/display.h

Thu, 12 Nov 2020 20:26:35 +0100

author
David Douard <david.douard@sdf3.org>
date
Thu, 12 Nov 2020 20:26:35 +0100
changeset 53
74e85b34d26b
parent 51
d8042bff0e00
child 54
f6774bd0d570
permissions
-rw-r--r--

Reorganize the display + improvements for dimmed flags

- the whole upper zone is now dediacated to the main character line
- make sure eash flag has a dedicated non-overlaping area
- improve support for dimmed flags (not yet properly functionning since this
dimm state is actually stateful, so some major refactorings are needed to
properly handle this).

37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
1 #ifndef DISPLAY_H
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
2 #define DISPLAY_H
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
3
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
4 #include "Terminal6x8.h"
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
5 #include "Mono19x27.h"
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
6 #include "Mono15x22.h"
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
7 #include "Arial12x12.h"
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
8 #include "SSD1322.h"
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
9 #include "hp34comm.h"
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
10
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
11 //typedef enum {
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
12 #define FMT_ASCII 0x01
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
13 #define FMT_HEX 0x02
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
14 #define FMT_BITS 0x04
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
15 #define FMT_FLAGS 0x08
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
16 #define FMT_IGNORE 0x80
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
17 //} dsp_format_t;
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
18
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
19
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
20 typedef struct _DSP
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
21 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
22 uint8_t cmd;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
23 uint8_t color;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
24 uint8_t bgcolor;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
25 uint8_t x0;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
26 uint8_t y0;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
27 uint8_t fmt; // 0x01=>ascii, 0x02=>hex, 0x04=>bits, 0x08=>flags, 0x80=>ignore
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
28 uint8_t maxsize;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
29 uint8_t width;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
30 const unsigned char* font;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
31 char buffer[MAX_BUFF+1];
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
32 } DSP;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
33
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
34
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
35 static DSP table[] =
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
36 { // cmd, fg, bg, x0, y0, fmt, maxsize, width, font
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
37 { 0x00, 0xF, 0x0, 0, 0, FMT_ASCII, MAX_BUFF, 255, Mono19x27}, // main display
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
38 { 0x0C, 0xF, 0x0,194, 38, FMT_ASCII, 3, 45, Mono15x22}, // channels display
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
39 { 0x0A, 0xF, 0x0, 0, 57, FMT_FLAGS, 4, 0, Terminal6x8}, // flags + bits
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
40 };
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
41
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
42 // 9x10
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
43 const unsigned char icon_alarm[] __attribute__((aligned (2))) =
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
44 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
45 0x1c, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
46 0x3e, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
47 0x7f, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
48 0x7f, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
49 0x7f, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
50 0x7f, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
51 0x7f, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
52 0x7f, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
53 0xff, 0x80,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
54 0x10, 0x0
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
55 };
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
56
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
57 const unsigned char icon_curve[] __attribute__((aligned (2))) =
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
58 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
59 0x80, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
60 0x80, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
61 0x80, 0x80,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
62 0x81, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
63 0x9e, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
64 0xa0, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
65 0xc0, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
66 0x80, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
67 0x80, 0x0,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
68 0xff, 0x80
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
69 };
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
70
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
71 typedef struct _FLAG
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
72 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
73 uint8_t flag;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
74 uint8_t x;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
75 uint8_t y;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
76 bool reverse;
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
77 bool dimm;
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
78 const char* msg;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
79 const unsigned char* icon;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
80 } FLAG;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
81
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
82 typedef struct _FRAME
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
83 {
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
84 uint8_t flag;
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
85 uint8_t x0;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
86 uint8_t y0;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
87 uint8_t x1;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
88 uint8_t y1;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
89 } FRAME;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
90
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
91
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
92
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
93 static const FLAG flags[] =
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
94 {
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
95 // flag, x0, y0, reverse, dimm, msg, icon
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
96 // right-side icons area
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
97 // flag is the bit index in the 4 bytes viewed as a 32bits value
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
98 { 0x00, 246, 27, false, false, NULL, icon_alarm}, // F1.0 01 00 00 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
99 { 0x01, 246, 38, false, false, NULL, icon_curve}, // F1.1 02 00 00 00
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
100 // F1.2 04 00 00 00 - Channel frame
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
101 { 0x03, 195, 29, false, false, "CHANNEL"}, // F1.3 08 00 00 00
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
102 // F1.7 80 00 00 00 - Alarm frame
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
103 { 0x1c, 0, 38, false, false, "MON"}, // F4.4 00 00 00 10
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
104 { 0x1b, 0, 47, false, false, "VIEW"}, // F4.3 00 00 00 08
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
105 { 0x1d, 0, 29, true, false, "SCAN"}, // F4.5 00 00 00 20
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
106 { 0x1e, 0, 56, true, false, "CONFIG"}, // F4.6 00 00 00 40
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
107
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
108 { 0x1a, 40, 56, false, false, "*"}, // F4.2 00 00 00 04
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
109 { 0x19, 50, 56, false, false, "ADRS"}, // F4.1 00 00 00 02
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
110 { 0x18, 80, 56, false, false, "RMT"}, // F4.0 00 00 00 01
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
111 { 0x17, 104, 56, true, false, "ERROR"}, // F3.7 00 00 80 00
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
112
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
113 { 0x16, 86, 38, false, false, "EXT"}, // F3.6 00 00 40 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
114 { 0x15, 60, 38, false, false, "ONCE"}, // F3.5 00 00 20 00
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
115
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
116 { 0x13, 40, 38, false, false, "MEM"}, // F3.3 00 00 08 00
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
117
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
118
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
119 // col 5
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
120 { 0x0c, 244, 47, false, false, "4W"}, // F2.4 00 10 00 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
121 { 0x0d, 244, 56, false, false, "OC"}, // F2.5 00 20 00 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
122
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
123 { 0x12, 40, 47, false, true, "LAST"}, // F3.2 00 00 04 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
124 { 0x11, 66, 47, false, true, "MIN"}, // F3.1 00 00 02 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
125 { 0x10, 86, 47, false, true, "MAX"}, // F3.0 00 00 01 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
126 { 0x0f, 106, 47, false, true, "AVG"}, // F2.7 00 80 00 00
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
127
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
128 { 0x05, 152+0, 29, false, false, "Alarm"}, // F1.5 20 00 00 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
129 { 0x08, 152+0, 39, false, false, "H"}, // F1.6 40 00 00 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
130 { 0x07, 152+6, 39, false, false, "1"}, // F2.3 00 08 00 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
131 { 0x06, 152+12, 39, false, false, "2"}, // F2.0 00 01 00 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
132 { 0x04, 152+18, 39, false, false, "3"}, // F2.2 00 04 00 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
133 { 0x09, 152+24, 39, false, false, "4"}, // F2.1 00 02 00 00
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
134 { 0x0a, 152+30, 39, false, false, "L"}, // F1.4 00 10 00 00
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
135
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
136 { 0x80, 152, 56, true, false, "SHIFT"}, // not an actual command, managed by the front panel
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
137 };
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
138
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
139
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
140 static const FRAME frames[] =
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
141 {
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
142 { 0x02, 192, 32, 240, 60}, // F1.2 - channel frame
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
143 { 0x0b, 149, 32, 190, 50}, // F1.7 - alarm frame
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
144 };
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
145
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
146
53
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
147 typedef enum {
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
148 FLAG_OFF,
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
149 FLAG_ON,
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
150 FLAG_DIM
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
151 } flag_status_t;
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
152
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
153 typedef struct _FLAG_STATUS
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
154 {
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
155 uint8_t flag;
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
156 flag_status_t status;
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
157 } FLAG_STATUS;
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
158
74e85b34d26b Reorganize the display + improvements for dimmed flags
David Douard <david.douard@sdf3.org>
parents: 51
diff changeset
159
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
160 class Display: public SSD1322
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
161 {
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
162 public:
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
163 Display(int Hz, PinName mosi, PinName miso, PinName sclk, PinName CS, PinName reset, PinName DC,
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
164 const char* name);
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
165
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
166 virtual ~Display();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
167
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
168 void test_dsp();
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
169 void show(uint8_t, const char*, uint8_t);
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
170 void dimm_char(uint8_t);
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
171 void show_splashscreen();
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
172 void show_byescreen();
51
d8042bff0e00 Add support for dimmed flag display
David Douard <david.douard@sdf3.org>
parents: 46
diff changeset
173 void set_flag(uint8_t flag, bool show=true, bool dimm=false);
44
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
174 void show_flag(uint8_t flag) {set_flag(flag, true);};
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
175 void hide_flag(uint8_t flag) {set_flag(flag, false);};
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
176 void shift_on() {set_flag(0x80, true);};
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
177 void shift_off() {set_flag(0x80, false);};
b3c3d54d2c7c Many improvements
David Douard <david.douard@sdf3.org>
parents: 37
diff changeset
178
37
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
179
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
180 private:
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
181 uint8_t must_refresh;
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
182
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
183 };
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
184
07e8ca2bdf6d Extracted the display related functions in a Display class
David Douard <david.douard@sdf3.org>
parents:
diff changeset
185 #endif

mercurial