1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-17 06:52:18 +01:00

added the support to the new display GREENTAB_L

This commit is contained in:
Fede85 2013-10-14 17:23:39 +02:00
parent 034cb91737
commit cb7b62f43e
3 changed files with 74 additions and 7 deletions

View File

@ -1,6 +1,6 @@
#include "TFT.h"
#if ARDUINO_AVR_ESPLORA // are we building for Esplora?
#if ARDUINO_AVR_ESPLORA
TFT EsploraTFT(7, 0, 1);
#endif
@ -14,6 +14,7 @@ TFT::TFT(uint8_t CS, uint8_t RS, uint8_t RST)
}
void TFT::begin() {
initR(INITR_REDTAB);
//initR(INITR_REDTAB);
initG();
setRotation(1);
}

View File

@ -30,7 +30,7 @@ inline uint16_t swapcolor(uint16_t x) {
// Constructor when using software SPI. All output pins are configurable.
Adafruit_ST7735::Adafruit_ST7735(uint8_t cs, uint8_t rs, uint8_t sid,
uint8_t sclk, uint8_t rst) : Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
uint8_t sclk, uint8_t rst) : Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
{
_cs = cs;
_rs = rs;
@ -44,7 +44,7 @@ Adafruit_ST7735::Adafruit_ST7735(uint8_t cs, uint8_t rs, uint8_t sid,
// Constructor when using hardware SPI. Faster, but must use SPI pins
// specific to each board type (e.g. 11,13 for Uno, 51,52 for Mega, etc.)
Adafruit_ST7735::Adafruit_ST7735(uint8_t cs, uint8_t rs, uint8_t rst) :
Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
Adafruit_GFX(ST7735_TFTWIDTH, ST7735_TFTHEIGHT)
{
_cs = cs;
_rs = rs;
@ -229,7 +229,66 @@ PROGMEM static prog_uchar
ST7735_NORON , DELAY, // 3: Normal display on, no args, w/delay
10, // 10 ms delay
ST7735_DISPON , DELAY, // 4: Main screen turn on, no args w/delay
100 }; // 100 ms delay
100 }, // 100 ms delay
Gcmd[] = { // Initialization commands for 7735B screens
19, // 18 commands in list:
ST7735_SWRESET, DELAY, // 1: Software reset, no args, w/delay
50, // 50 ms delay
ST7735_SLPOUT , DELAY, // 2: Out of sleep mode, no args, w/delay
100, // 255 = 500 ms delay
0x26 , 1, // 3: Set default gamma
0x04, // 16-bit color
0xb1, 2, // 4: Frame Rate
0x0b,
0x14,
0xc0, 2, // 5: VRH1[4:0] & VC[2:0]
0x08,
0x00,
0xc1, 1, // 6: BT[2:0]
0x05,
0xc5, 2, // 7: VMH[6:0] & VML[6:0]
0x41,
0x30,
0xc7, 1, // 8: LCD Driving control
0xc1,
0xEC, 1, // 9: Set pumping color freq
0x1b,
0x3a , 1 + DELAY, // 10: Set color format
0x55, // 16-bit color
100,
0x2a, 4, // 11: Set Column Address
0x00,
0x00,
0x00,
0x7f,
0x2b, 4, // 12: Set Page Address
0x00,
0x00,
0x00,
0x9f,
0x36, 1, // 12+1: Set Scanning Direction
0xc8,
0xb7, 1, // 14: Set Source Output Direciton
0x00,
0xf2, 1, // 15: Enable Gamma bit
0x00,
0xe0, 15 + DELAY, // 16: magic
0x28, 0x24, 0x22, 0x31,
0x2b, 0x0e, 0x53, 0xa5,
0x42, 0x16, 0x18, 0x12,
0x1a, 0x14, 0x03,
50,
0xe1, 15 + DELAY, // 17: more magic
0x17, 0x1b, 0x1d, 0x0e,
0x14, 0x11, 0x2c, 0xa5,
0x3d, 0x09, 0x27, 0x2d,
0x25, 0x2b, 0x3c,
50,
ST7735_NORON , DELAY, // 17: Normal display on, no args, w/delay
10, // 10 ms delay
ST7735_DISPON , DELAY, // 18: Main screen turn on, no args, w/delay
255 }; // 255 = 500 ms delay
// Companion code to the above tables. Reads and issues
@ -261,7 +320,7 @@ void Adafruit_ST7735::commandList(uint8_t *addr) {
// Initialization code common to both 'B' and 'R' type displays
void Adafruit_ST7735::commonInit(uint8_t *cmdList) {
colstart = rowstart = 0; // May be overridden in init func
colstart = rowstart = 0; // May be overridden in init func
pinMode(_rs, OUTPUT);
pinMode(_cs, OUTPUT);
@ -312,6 +371,12 @@ void Adafruit_ST7735::initB(void) {
}
// Initialization for ST7735B screens
void Adafruit_ST7735::initG(void) {
commonInit(Gcmd);
}
// Initialization for ST7735R screens (green or red tabs)
void Adafruit_ST7735::initR(uint8_t options) {
commonInit(Rcmd1);

View File

@ -1,4 +1,4 @@
/***************************************************
/***************************************************
This is a library for the Adafruit 1.8" SPI display.
This library works with the Adafruit 1.8" TFT Breakout w/SD card
----> http://www.adafruit.com/products/358
@ -102,6 +102,7 @@ class Adafruit_ST7735 : public Adafruit_GFX {
Adafruit_ST7735(uint8_t CS, uint8_t RS, uint8_t RST);
void initB(void), // for ST7735B displays
initG(void), // for ILI9163C displays
initR(uint8_t options = INITR_GREENTAB), // for ST7735R
setAddrWindow(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1),
pushColor(uint16_t color),