forked from Ho-Ro/ComponentTester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathST7565R.h
217 lines (141 loc) · 5.33 KB
/
ST7565R.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
/* ************************************************************************
*
* ST7565R graphic display controller
*
* (c) 2015-2017 by Markus Reschke
*
* ************************************************************************ */
/* ************************************************************************
* LCD commands
* ************************************************************************ */
/*
* switch display on/off
*/
#define CMD_DISPLAY 0b10101110 /* switch display on/off */
#define FLAG_DISPLAY_OFF 0b00000000 /* display off */
#define FLAG_DISPLAY_ON 0b00000001 /* display on */
/*
* set start line
* - valid range: 0 - 63
*/
#define CMD_START_LINE 0b01000000 /* set start line */
/*
* set page
* - valid range: 0 - 8
*/
#define CMD_PAGE 0b10110000 /* set page */
/*
* set column MSB
* - valid range: 0 - 131
*/
#define CMD_COLUMN_H 0b00010000 /* set MSB (upper nibble) of column */
/*
* set column LSB
* - valid range: 0 - 131
*/
#define CMD_COLUMN_L 0b00000000 /* set LSB (lower nibble) of column */
/*
* segment driver direction (horizontal direction)
*/
#define CMD_SEGMENT_DIR 0b10100000 /* set segment driver direction (horizontal direction) */
#define FLAG_ADC_NORMAL 0b00000000 /* normal */
#define FLAG_ADC_REVERSE 0b00000001 /* reversed/flipped */
/*
* display image mode
*/
#define CMD_IMAGE_MODE 0b10100110 /* set display image mode */
#define FLAG_IMAGE_NORMAL 0b00000000 /* normal / positive */
#define FLAG_IMAGE_REVERSE 0b00000001 /* reverse / negative */
/*
* all points mode
*/
#define CMD_ALL_POINTS 0b10100100 /* set "all points" mode */
#define FLAG_POINTS_OFF 0b00000000 /* normal mode */
#define FLAG_POINTS_ON 0b00000001 /* display all points */
/*
* bias ratio of LCD drive voltage
*/
#define CMD_LCD_BIAS 0b10100010 /* set bias ratio of LCD drive voltage */
#define FLAG_BIAS_19 0b00000000 /* 1/9 */
#define FLAG_BIAS_17 0b00000001 /* 1/7 */
/*
* enter read-modify-write mode
*/
#define CMC_R_M_W 0b11100000 /* enter read-modify-write mode */
/*
* end read-modify-write mode
*/
#define CMD_END 0b11101110 /* end read-modify-write mode */
/*
* internal reset
*/
#define CMD_RESET 0b11100010 /* perform internal reset */
/*
* common driver direction (vertical direction)
*/
#define CMD_COMMON_DIR 0b11000000 /* set common driver direction (vertical direction) */
#define FLAG_COM_NORMAL 0b00000000 /* normal */
#define FLAG_COM_REVERSE 0b00001000 /* reversed/flipped */
/*
* power supply operation mode
*/
#define CMD_POWER_MODE 0b00101000 /* select power supply operation mode */
#define FLAG_FOLOWER_OFF 0b00000000 /* voltage folower circuit off */
#define FLAG_FOLOWER_ON 0b00000001 /* voltage folower circuit on */
#define FLAG_REGULATOR_OFF 0b00000000 /* voltage regulator off */
#define FLAG_REGULATOR_ON 0b00000010 /* voltage regulator on */
#define FLAG_BOOSTER_OFF 0b00000000 /* booster circuit off */
#define FLAG_BOOSTER_ON 0b00000100 /* booster circuit on */
/*
* V0 regulator resistor ratio (1 + Rb/Ra)
*/
#define CMD_V0_RATIO 0b00100000 /* select resistor ratio for V0/contrast voltage regulator */
#define FLAG_RATIO_30 0b00000000 /* ratio 3.0 */
#define FLAG_RATIO_35 0b00000001 /* ratio 3.5 */
#define FLAG_RATIO_40 0b00000010 /* ratio 4.0 */
#define FLAG_RATIO_45 0b00000011 /* ratio 4.5 */
#define FLAG_RATIO_50 0b00000100 /* ratio 5.0 */
#define FLAG_RATIO_55 0b00000101 /* ratio 5.5 */
#define FLAG_RATIO_60 0b00000110 /* ratio 6.0 */
#define FLAG_RATIO_65 0b00000111 /* ratio 6.5 */
/*
* set contrast
* - 2 byte command
* - valid range: 63 - 0
*/
/* byte #1: command */
#define CMD_V0_MODE 0b10000001 /* enable V0/contrast value set mode */
/* byte #2: V0/contrast value */
/* valid range: 63 (00000) - 0 (11111) */
/*
* indicator state
* - 2 byte command when enabling
*/
/* byte #1: command */
#define CMD_INDICATOR_MODE 0b10101100 /* enable/disable indicator */
/* byte #2: indicator state */
#define FLAG_INDICATOR_OFF 0b00000000 /* off */
#define FLAG_INDICATOR_1HZ 0b00000001 /* blinking at 1Hz */
#define FLAG_INDICATOR_05HZ 0b00000010 /* blinking at 0.5Hz */
#define FLAG_INDICATOR_ON 0b00000011 /* on (permanently) */
/*
* booster ratio
* - 2 byte command
*/
/* byte #1: command */
#define CMD_BOOSTER_MODE 0b11111000 /* enable booster ratio set mode */
/* byte #2: booster ratio */
#define FLAG_BOOSTER_234 0b00000000 /* 2x, 3x, 4x */
#define FLAG_BOOSTER_5 0b00000001 /* 5x */
#define FLAG_BOOSTER_6 0b00000010 /* 6x */
/*
* no operation
*/
#define CMD_NOP 0b11100011 /* no operation */
/*
* test
*/
#define CMD_TEST 0b11111100 /* test chip (don't use this cmd!) */
/* ************************************************************************
* EOF
* ************************************************************************ */