forked from Ho-Ro/ComponentTester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSTE2007.h
358 lines (253 loc) · 9.58 KB
/
STE2007.h
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
/* ************************************************************************
*
* STE2007 graphic display controller
*
* (c) 2019-2020 by Markus Reschke
*
* ************************************************************************ */
/* ************************************************************************
* I2C
* ************************************************************************ */
/*
* I2C slave addreses
*/
#define STE2007_I2C_ADDR_0 0b00111100 /* SA1=0 SA0=0 0x3c */
#define STE2007_I2C_ADDR_1 0b00111101 /* SA1=0 SA0=1 0x3d */
#define STE2007_I2C_ADDR_2 0b00111110 /* SA1=1 SA0=0 0x3e */
#define STE2007_I2C_ADDR_3 0b00111111 /* SA1=1 SA0=1 0x3f */
/*
* I2C master code (optional)
* - send in standard or fast mode to enable high speed mode
* - frame: <start><master code><not-acknowledge>
* - STE2007 doesn't require master code for high speed mode
*/
#define LCD_MASTER_CODE 0b00001000 /* master code */
/*
* I2C control byte
*/
#define LCD_CONTROL_BYTE 0b00000000 /* 0x00 */
/* continuation flag */
#define FLAG_CTRL_MULTI 0b00000000 /* stream of bytes follows */
#define FLAG_CTRL_SINGLE 0b10000000 /* only 1 byte follows */
/* D/C */
#define FLAG_CTRL_CMD 0b00000000 /* command follows */
#define FLAG_CTRL_DATA 0b01000000 /* data follows */
/* ************************************************************************
* LCD commands
* ************************************************************************ */
/*
* set display: on/off
* - 1 byte cmd
*/
#define CMD_DISPLAY 0b10101110 /* display on/off */
#define FLAG_DISPLAY_OFF 0b00000000 /* display off */
#define FLAG_DISPLAY_ON 0b00000001 /* display on */
/*
* set display mode: normal/reversed
* - 1 byte cmd
*/
#define CMD_DISP_MODE 0b10100110 /* display normal/reversed */
#define FLAG_DISP_NORMAL 0b00000000 /* normal display */
#define FLAG_DISP_REVERSED 0b00000001 /* reversed display */
/*
* set pixel mode: normal/all-on
* - 1 byte cmd
*/
#define CMD_PIXEL_MODE 0b10100100 /* pixel mode */
#define FLAG_PIXEL_NORMAL 0b00000000 /* normal */
#define FLAG_PIXEL_ALL 0b00000001 /* all pixels on */
/*
* set page address
* - 1 byte cmd
* - valid range: 0 - 8
* - last page is 4 pixels high
*/
#define CMD_PAGE 0b10110000 /* set page address */
/*
* set column address
* - 2 commands (1 byte each)
* - valid range: 0 - 95)
*/
/* set upper nibble of column address (bits 4-6): bits 0-2 */
#define CMD_COLUMN_H 0b00010000 /* set upper nibble */
/* set lower nibble of column address (bits 0-3): bits 0-3 */
#define CMD_COLUMN_L 0b00000000 /* set lower nibble */
/*
* set start line address
* - 1 byte cmd
* - valid range: 0 - 63
*/
#define CMD_STARTLINE 0b01000000 /* set start line address */
/*
* select segment driver direction
* - 1 byte cmd
*/
#define CMD_SEG_DIR 0b10100000 /* set segment driver direction */
#define FLAG_SEG_NORMAL 0b00000000 /* normal */
#define FLAG_SEG_REVERSED 0b00000001 /* reversed */
/*
* select common driver direction
* - 1 byte cmd
*/
#define CMD_COM_DIR 0b11000000 /* set common driver direction */
#define FLAG_COM_NORMAL 0b00000000 /* normal */
#define FLAG_COM_REVERSED 0b00001000 /* reversed */
/*
* read ID
* - 1 byte cmd + 1 byte data (read)
* - after issuing this command STE2007 sends the indentification byte
*/
#define CMD_READ_ID 0b11011011 /* read ID */
/*
* set power control
* - 1 byte cmd
* - booster, voltage regulator and voltage folower
*/
#define CMD_PWR_CONTROL 0b00101000 /* set power control */
#define FLAG_PWR_OFF 0b00000000 /* all off */
#define FLAG_PWR_ON 0b00000111 /* all on */
/*
* set voltage range (V0R)
* - 1 byte cmd
*/
#define CMD_V0R 0b00100000 /* set V0R */
#define FLAG_V0R_0300 0b00000000 /* 3.00V */
#define FLAG_V0R_0428 0b00000001 /* 4.28V */
#define FLAG_V0R_0556 0b00000010 /* 5.56V */
#define FLAG_V0R_0684 0b00000011 /* 6.84V */
#define FLAG_V0R_0812 0b00000100 /* 8.12V (default) */
#define FLAG_V0R_0940 0b00000101 /* 9.40V */
#define FLAG_V0R_1068 0b00000110 /* 10.68V */
#define FLAG_V0R_1196 0b00000111 /* 11.96V */
/*
* adjust contrast setting (VOP)
* - 2 byte command
*/
/* byte #1: command */
#define CMD_VOP 0b11100001 /* set VOP */
/* byte #2: contrast value */
#define FLAG_VOP_P000 0b00000000 /* 0 (default) */
#define FLAG_VOP_P001 0b00000001 /* +1 */
/* ... */
#define FLAG_VOP_P127 0b01111111 /* +127 */
#define FLAG_VOP_M000 0b10000000 /* 0 */
#define FLAG_VOP_M001 0b10000001 /* -1 */
/* ... */
#define FLAG_VOP_M127 0b11111111 /* -127 */
/*
* set electronic volume (EV)
* - 1 byte cmd
* - contrast setting for user
* - valid range: 0 - 31
*/
#define CMD_EV 0b10000000 /* set EV */
/*
* initialize/reset driver
* - 1 byte cmd
*/
#define CMD_RESET 0b11100010 /* reset driver */
/*
* no operation (NOP)
* - 1 byte cmd
*/
#define CMD_NOP 0b11100011 /* NOP */
/*
* set image location (initial row)
* - 2 byte command
*/
/* byte #1: command */
#define CMD_IMG_LOC 0b10101100 /* set image location */
/* byte #2: image location value */
#define FLAG_IMG_LOC_00 0b00000000 /* 0 lines */
#define FLAG_IMG_LOC_08 0b00000001 /* 8 lines */
#define FLAG_IMG_LOC_16 0b00000010 /* 16 lines */
#define FLAG_IMG_LOC_24 0b00000011 /* 24 lines */
#define FLAG_IMG_LOC_32 0b00000100 /* 32 lines */
#define FLAG_IMG_LOC_48 0b00000101 /* 48 lines */
#define FLAG_IMG_LOC_56 0b00000110 /* 56 lines */
#define FLAG_IMG_LOC_64 0b00000111 /* 64 lines */
/*
* set bias ratio
* - 1 byte cmd
*/
#define CMD_BIAS_RATIO 0b00110000 /* set bias ratio */
#define FLAG_BIAS_RATIO_10 0b00000000 /* 1/10 - 81 lines */
#define FLAG_BIAS_RATIO_09 0b00000001 /* 1/9 - 65 lines */
#define FLAG_BIAS_RATIO_08 0b00000010 /* 1/8 - 49 lines */
#define FLAG_BIAS_RATIO_07 0b00000011 /* 1/7 - 33 lines */
#define FLAG_BIAS_RATIO_06 0b00000100 /* 1/6 - 25 lines */
#define FLAG_BIAS_RATIO_05 0b00000101 /* 1/5 - 17 lines */
#define FLAG_BIAS_RATIO_04 0b00000110 /* 1/4 - 9 lines */
/*
* set temperature compensation coefficient
* - 2 byte command
*/
/* byte #1: command */
#define CMD_TEMP_COMP 0b00111000 /* set temperature compensation */
/* byte #2: coefficient */
#define FLAG_TEMP_COMP_0000 0b00000000 /* 0 ppm */
#define FLAG_TEMP_COMP_0300 0b00000001 /* -300 ppm */
#define FLAG_TEMP_COMP_0600 0b00000010 /* -600 ppm */
#define FLAG_TEMP_COMP_0900 0b00000011 /* -900 ppm */
#define FLAG_TEMP_COMP_1070 0b00000100 /* -1070 ppm */
#define FLAG_TEMP_COMP_1200 0b00000101 /* -1200 ppm */
#define FLAG_TEMP_COMP_1500 0b00000110 /* -1500 ppm */
#define FLAG_TEMP_COMP_1800 0b00000111 /* -1800 ppm */
/*
* set charge pump multiplication factor
* - 2 byte command
*/
/* byte #1: command */
#define CMD_CHARGE_PUMP 0b00111101 /* set charge pump */
/* byte #2: multiplicator */
#define FLAG_CHARGE_PUMP_5 0b00000000 /* 5x */
#define FLAG_CHARGE_PUMP_4 0b00000001 /* 4x */
#define FLAG_CHARGE_PUMP_3 0b00000010 /* 3x */
/*
* set refresh rate
* - 2 byte command
*/
/* byte #1: command */
#define CMD_REFRESH_RATE 0b11101111 /* set refresh rate */
/* byte #2: refresh rate */
#define FLAG_REFRESH_RATE_80 0b00000000 /* 80Hz */
#define FLAG_REFRESH_RATE_75 0b00000001 /* 75Hz */
#define FLAG_REFRESH_RATE_70 0b00000010 /* 70Hz */
#define FLAG_REFRESH_RATE_65 0b00000011 /* 65Hz */
/*
* set icon mode
* - 1 byte cmd
*/
#define CMD_ICON_MODE 0b11111000 /* set icon mode */
#define FLAG_ICON_OFF 0b00000000 /* off */
#define FLAG_ICON_ON 0b00000001 /* on */
/*
* N-line inversion
* - 2 byte command
*/
/* byte #1: command */
#define CMD_NLINE_INV 0b10101101 /* set n-line inversion */
/* byte #2: */
#define FLAG_NLINE_OFF 0b00000000 /* N-line inversion disabled (default) */
#define FLAG_NLINE_02 0b00000001 /* row 2 */
/* ... */
#define FLAG_NLINE_32 0b00011111 /* row 32 */
#define FLAG_XOR_OFF 0b00000000 /* XOR disabled */
#define FLAG_XOR_ON 0b00100000 /* XOR enabled */
/*
* number of lines
* - 1 byte cmd
* - multiplexing rate
*/
#define CMD_LINES 0b11010000 /* set number of lines */
#define FLAG_LINES_68 0b00000000 /* 68 lines (default) */
#define FLAG_LINES_65 0b00000001 /* 65 lines */
#define FLAG_LINES_49 0b00000010 /* 49 lines */
#define FLAG_LINES_33 0b00000011 /* 33 lines */
#define FLAG_LINES_P33 0b00000100 /* 33 lines partial display */
#define FLAG_LINES_P25 0b00000101 /* 25 lines partial display */
#define FLAG_LINES_P17 0b00000110 /* 17 lines partial display */
#define FLAG_LINES_P09 0b00000111 /* 9 lines partial display */
/* ************************************************************************
* EOF
* ************************************************************************ */