@@ -30,7 +30,7 @@ inline uint16_t swapcolor(uint16_t x) {
30
30
31
31
// Constructor when using software SPI. All output pins are configurable.
32
32
Adafruit_ST7735::Adafruit_ST7735 (uint8_t cs, uint8_t rs, uint8_t sid,
33
- uint8_t sclk, uint8_t rst) : Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
33
+ uint8_t sclk, uint8_t rst) : Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
34
34
{
35
35
_cs = cs;
36
36
_rs = rs;
@@ -44,7 +44,7 @@ Adafruit_ST7735::Adafruit_ST7735(uint8_t cs, uint8_t rs, uint8_t sid,
44
44
// Constructor when using hardware SPI. Faster, but must use SPI pins
45
45
// specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.)
46
46
Adafruit_ST7735::Adafruit_ST7735 (uint8_t cs, uint8_t rs, uint8_t rst) :
47
- Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
47
+ Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
48
48
{
49
49
_cs = cs;
50
50
_rs = rs;
@@ -229,7 +229,66 @@ PROGMEM static prog_uchar
229
229
ST7735_NORON , DELAY, // 3: Normal display on, no args, w/delay
230
230
10 , // 10 ms delay
231
231
ST7735_DISPON , DELAY, // 4: Main screen turn on, no args w/delay
232
- 100 }; // 100 ms delay
232
+ 100 }, // 100 ms delay
233
+ Gcmd[] = { // Initialization commands for 7735B screens
234
+ 19 , // 18 commands in list:
235
+ ST7735_SWRESET, DELAY, // 1: Software reset, no args, w/delay
236
+ 50 , // 50 ms delay
237
+ ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, no args, w/delay
238
+ 100 , // 255 = 500 ms delay
239
+ 0x26 , 1 , // 3: Set default gamma
240
+ 0x04 , // 16-bit color
241
+ 0xb1 , 2 , // 4: Frame Rate
242
+ 0x0b ,
243
+ 0x14 ,
244
+ 0xc0 , 2 , // 5: VRH1[4:0] & VC[2:0]
245
+ 0x08 ,
246
+ 0x00 ,
247
+ 0xc1 , 1 , // 6: BT[2:0]
248
+ 0x05 ,
249
+ 0xc5 , 2 , // 7: VMH[6:0] & VML[6:0]
250
+ 0x41 ,
251
+ 0x30 ,
252
+ 0xc7 , 1 , // 8: LCD Driving control
253
+ 0xc1 ,
254
+ 0xEC , 1 , // 9: Set pumping color freq
255
+ 0x1b ,
256
+ 0x3a , 1 + DELAY, // 10: Set color format
257
+ 0x55 , // 16-bit color
258
+ 100 ,
259
+ 0x2a , 4 , // 11: Set Column Address
260
+ 0x00 ,
261
+ 0x00 ,
262
+ 0x00 ,
263
+ 0x7f ,
264
+ 0x2b , 4 , // 12: Set Page Address
265
+ 0x00 ,
266
+ 0x00 ,
267
+ 0x00 ,
268
+ 0x9f ,
269
+ 0x36 , 1 , // 12+1: Set Scanning Direction
270
+ 0xc8 ,
271
+ 0xb7 , 1 , // 14: Set Source Output Direciton
272
+ 0x00 ,
273
+ 0xf2 , 1 , // 15: Enable Gamma bit
274
+ 0x00 ,
275
+ 0xe0 , 15 + DELAY, // 16: magic
276
+ 0x28 , 0x24 , 0x22 , 0x31 ,
277
+ 0x2b , 0x0e , 0x53 , 0xa5 ,
278
+ 0x42 , 0x16 , 0x18 , 0x12 ,
279
+ 0x1a , 0x14 , 0x03 ,
280
+ 50 ,
281
+ 0xe1 , 15 + DELAY, // 17: more magic
282
+ 0x17 , 0x1b , 0x1d , 0x0e ,
283
+ 0x14 , 0x11 , 0x2c , 0xa5 ,
284
+ 0x3d , 0x09 , 0x27 , 0x2d ,
285
+ 0x25 , 0x2b , 0x3c ,
286
+ 50 ,
287
+ ST7735_NORON , DELAY, // 17: Normal display on, no args, w/delay
288
+ 10 , // 10 ms delay
289
+ ST7735_DISPON , DELAY, // 18: Main screen turn on, no args, w/delay
290
+ 255 }; // 255 = 500 ms delay
291
+
233
292
234
293
235
294
// Companion code to the above tables. Reads and issues
@@ -261,7 +320,7 @@ void Adafruit_ST7735::commandList(uint8_t *addr) {
261
320
// Initialization code common to both 'B' and 'R' type displays
262
321
void Adafruit_ST7735::commonInit (uint8_t *cmdList) {
263
322
264
- colstart = rowstart = 0 ; // May be overridden in init func
323
+ colstart = rowstart = 0 ; // May be overridden in init func
265
324
266
325
pinMode (_rs, OUTPUT);
267
326
pinMode (_cs, OUTPUT);
@@ -312,6 +371,12 @@ void Adafruit_ST7735::initB(void) {
312
371
}
313
372
314
373
374
+ // Initialization for ST7735B screens
375
+ void Adafruit_ST7735::initG (void ) {
376
+ commonInit (Gcmd);
377
+ }
378
+
379
+
315
380
// Initialization for ST7735R screens (green or red tabs)
316
381
void Adafruit_ST7735::initR (uint8_t options) {
317
382
commonInit (Rcmd1);
0 commit comments