Merge branch 'ST7781_driver' of https://github.com/kakaroto33/TFT_eSPI into ST7781_driver
This commit is contained in:
commit
b9f44848de
|
|
@ -3,10 +3,11 @@
|
|||
** Grabbed from Adafruit_GFX library and enhanced to handle any label font
|
||||
***************************************************************************************/
|
||||
TFT_eSPI_Button::TFT_eSPI_Button(void) {
|
||||
_gfx = 0;
|
||||
_gfx = nullptr;
|
||||
_xd = 0;
|
||||
_yd = 0;
|
||||
_textdatum = MC_DATUM;
|
||||
_label[9] = '\0';
|
||||
}
|
||||
|
||||
// Classic initButton() function: pass center & size
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class TFT_eSPI_Button {
|
|||
|
||||
public:
|
||||
TFT_eSPI_Button(void);
|
||||
// "Classic" initButton() uses center & size
|
||||
// "Classic" initButton() uses centre & size
|
||||
void initButton(TFT_eSPI *gfx, int16_t x, int16_t y,
|
||||
uint16_t w, uint16_t h, uint16_t outline, uint16_t fill,
|
||||
uint16_t textcolor, char *label, uint8_t textsize);
|
||||
|
|
@ -34,7 +34,7 @@ class TFT_eSPI_Button {
|
|||
private:
|
||||
TFT_eSPI *_gfx;
|
||||
int16_t _x1, _y1; // Coordinates of top-left corner of button
|
||||
int16_t _xd, _yd; // Button text datum offsets (wrt center of button)
|
||||
int16_t _xd, _yd; // Button text datum offsets (wrt centre of button)
|
||||
uint16_t _w, _h; // Width and height of button
|
||||
uint8_t _textsize, _textdatum; // Text size multiplier and text datum for button
|
||||
uint16_t _outlinecolor, _fillcolor, _textcolor;
|
||||
|
|
|
|||
|
|
@ -453,12 +453,6 @@
|
|||
// Write 32 bits
|
||||
#define tft_Write_32(C) TFT_WRITE_BITS(C, 32)
|
||||
|
||||
// Write two address coordinates
|
||||
#define tft_Write_16C(C,D) TFT_WRITE_BITS((uint16_t)(D)<<8 | (C), 16)
|
||||
|
||||
// Write same value twice
|
||||
#define tft_Write_16D(C) TFT_WRITE_BITS((uint16_t)(C)<<8 | (C), 16)
|
||||
|
||||
// Write two address coordinates
|
||||
#define tft_Write_32C(C,D) TFT_WRITE_BITS((uint16_t)((D)<<8 | (D)>>8)<<16 | (uint16_t)((C)<<8 | (C)>>8), 32)
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Write strobe timing setup
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#if defined (ILI9341_DRIVER) || defined (ST7796_DRIVER) || defined (ILI9486_DRIVER) // WRX twc spec is <=66ns = 15.15MHz
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER) || defined (ST7796_DRIVER) || defined (ILI9486_DRIVER) // WRX twc spec is <=66ns = 15.15MHz
|
||||
|
||||
// Extra write pulse low time (delay for data setup)
|
||||
#if defined (STM32F1xx)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
#if defined (ILI9341_DRIVER)
|
||||
{
|
||||
writecommand(0xEF);
|
||||
writedata(0x03);
|
||||
|
|
@ -122,3 +123,126 @@
|
|||
writecommand(ILI9341_DISPON); //Display on
|
||||
|
||||
}
|
||||
|
||||
#elif defined (ILI9341_2_DRIVER) // Alternative init sequence, see https://github.com/Bodmer/TFT_eSPI/issues/1172
|
||||
|
||||
{
|
||||
writecommand(0xCF);
|
||||
writedata(0x00);
|
||||
writedata(0XC1);
|
||||
writedata(0X30);
|
||||
|
||||
writecommand(0xED);
|
||||
writedata(0x64);
|
||||
writedata(0x03);
|
||||
writedata(0X12);
|
||||
writedata(0X81);
|
||||
|
||||
writecommand(0xE8);
|
||||
writedata(0x85);
|
||||
writedata(0x00);
|
||||
writedata(0x78);
|
||||
|
||||
writecommand(0xCB);
|
||||
writedata(0x39);
|
||||
writedata(0x2C);
|
||||
writedata(0x00);
|
||||
writedata(0x34);
|
||||
writedata(0x02);
|
||||
|
||||
writecommand(0xF7);
|
||||
writedata(0x20);
|
||||
|
||||
writecommand(0xEA);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
|
||||
writecommand(ILI9341_PWCTR1); //Power control
|
||||
writedata(0x10); //VRH[5:0]
|
||||
|
||||
writecommand(ILI9341_PWCTR2); //Power control
|
||||
writedata(0x00); //SAP[2:0];BT[3:0]
|
||||
|
||||
writecommand(ILI9341_VMCTR1); //VCM control
|
||||
writedata(0x30);
|
||||
writedata(0x30);
|
||||
|
||||
writecommand(ILI9341_VMCTR2); //VCM control2
|
||||
writedata(0xB7); //--
|
||||
|
||||
writecommand(ILI9341_PIXFMT);
|
||||
writedata(0x55);
|
||||
|
||||
writecommand(0x36); // Memory Access Control
|
||||
writedata(0x08); // Rotation 0 (portrait mode)
|
||||
|
||||
writecommand(ILI9341_FRMCTR1);
|
||||
writedata(0x00);
|
||||
writedata(0x1A);
|
||||
|
||||
writecommand(ILI9341_DFUNCTR); // Display Function Control
|
||||
writedata(0x08);
|
||||
writedata(0x82);
|
||||
writedata(0x27);
|
||||
|
||||
writecommand(0xF2); // 3Gamma Function Disable
|
||||
writedata(0x00);
|
||||
|
||||
writecommand(0x26); //Gamma curve selected
|
||||
writedata(0x01);
|
||||
|
||||
writecommand(0xE0); //Set Gamma
|
||||
writedata(0x0F);
|
||||
writedata(0x2A);
|
||||
writedata(0x28);
|
||||
writedata(0x08);
|
||||
writedata(0x0E);
|
||||
writedata(0x08);
|
||||
writedata(0x54);
|
||||
writedata(0xA9);
|
||||
writedata(0x43);
|
||||
writedata(0x0A);
|
||||
writedata(0x0F);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
|
||||
writecommand(0XE1); //Set Gamma
|
||||
writedata(0x00);
|
||||
writedata(0x15);
|
||||
writedata(0x17);
|
||||
writedata(0x07);
|
||||
writedata(0x11);
|
||||
writedata(0x06);
|
||||
writedata(0x2B);
|
||||
writedata(0x56);
|
||||
writedata(0x3C);
|
||||
writedata(0x05);
|
||||
writedata(0x10);
|
||||
writedata(0x0F);
|
||||
writedata(0x3F);
|
||||
writedata(0x3F);
|
||||
writedata(0x0F);
|
||||
|
||||
writecommand(0x2B);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
writedata(0x3f);
|
||||
|
||||
writecommand(0x2A);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0xef);
|
||||
|
||||
writecommand(ILI9341_SLPOUT); //Exit Sleep
|
||||
|
||||
end_tft_write();
|
||||
delay(120);
|
||||
begin_tft_write();
|
||||
|
||||
writecommand(ILI9341_DISPON); //Display on
|
||||
}
|
||||
#endif
|
||||
|
|
@ -5,14 +5,6 @@
|
|||
#define TFT_HEIGHT 128
|
||||
#endif
|
||||
|
||||
#ifndef tft_Write_16D
|
||||
#define tft_Write_16C(C) tft_Write_8(C); tft_Write_8(C);
|
||||
#endif
|
||||
|
||||
#ifndef tft_Write_16C
|
||||
#define tft_Write_16C(C,D) tft_Write_8(C); tft_Write_8(D);
|
||||
#endif
|
||||
|
||||
// Delay between some initialisation commands
|
||||
#define TFT_INIT_DELAY 0x80
|
||||
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ void TFT_eSPI::init(uint8_t tc)
|
|||
tc = tc; // Supress warning
|
||||
|
||||
// This loads the driver specific initialisation code <<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVERS TO THE LIST HERE <<<<<<<<<<<<<<<<<<<<<<<
|
||||
#if defined (ILI9341_DRIVER)
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER)
|
||||
#include "TFT_Drivers/ILI9341_Init.h"
|
||||
|
||||
#elif defined (ST7735_DRIVER)
|
||||
|
|
@ -696,7 +696,7 @@ void TFT_eSPI::setRotation(uint8_t m)
|
|||
begin_tft_write();
|
||||
|
||||
// This loads the driver specific rotation code <<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVERS TO THE LIST HERE <<<<<<<<<<<<<<<<<<<<<<<
|
||||
#if defined (ILI9341_DRIVER)
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER)
|
||||
#include "TFT_Drivers/ILI9341_Rotation.h"
|
||||
|
||||
#elif defined (ST7735_DRIVER)
|
||||
|
|
@ -961,7 +961,7 @@ uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
|
|||
// Fetch the 16 bit BRG pixel
|
||||
//uint16_t rgb = (readByte() << 8) | readByte();
|
||||
|
||||
#if defined (ILI9341_DRIVER) | defined (ILI9488_DRIVER) | defined (SSD1963_DRIVER)// Read 3 bytes
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER) || defined (ILI9488_DRIVER) || defined (SSD1963_DRIVER)// Read 3 bytes
|
||||
|
||||
// Read window pixel 24 bit RGB values and fill in LS bits
|
||||
uint16_t rgb = ((readByte() & 0xF8) << 8) | ((readByte() & 0xFC) << 3) | (readByte() >> 3);
|
||||
|
|
@ -1079,7 +1079,7 @@ void TFT_eSPI::readRect(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t *da
|
|||
// Set masked pins D0- D7 to input
|
||||
busDir(dir_mask, INPUT);
|
||||
|
||||
#if defined (ILI9341_DRIVER) | defined (ILI9488_DRIVER) // Read 3 bytes
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER) || defined (ILI9488_DRIVER) // Read 3 bytes
|
||||
// Dummy read to throw away don't care value
|
||||
readByte();
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@
|
|||
//#define RPI_DISPLAY_TYPE // 20MHz maximum SPI
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
#define ILI9341_DRIVER
|
||||
#define ILI9341_DRIVER // Generic driver for common displays
|
||||
//#define ILI9341_2_DRIVER // Alternative ILI9341 driver, see https://github.com/Bodmer/TFT_eSPI/issues/1172
|
||||
//#define ST7735_DRIVER // Define additional parameters below for this display
|
||||
//#define ILI9163_DRIVER // Define additional parameters below for this display
|
||||
//#define S6D02A1_DRIVER
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@
|
|||
#endif
|
||||
|
||||
// Load the right driver definition - do not tinker here !
|
||||
#if defined (ILI9341_DRIVER)
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER)
|
||||
#include <TFT_Drivers/ILI9341_Defines.h>
|
||||
#define TFT_DRIVER 0x9341
|
||||
#elif defined (ST7735_DRIVER)
|
||||
|
|
|
|||
Loading…
Reference in New Issue