mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2024-09-21 02:17:13 +00:00
Add R61581 driver as detailed in #238
Not tested by Bodmer, tested by s60sc as in #238
This commit is contained in:
parent
046e48f8c3
commit
beda811a3a
42
TFT_Drivers/R61581_Defines.h
Normal file
42
TFT_Drivers/R61581_Defines.h
Normal file
@ -0,0 +1,42 @@
|
||||
// Change the width and height if required (defined in portrait mode)
|
||||
// or use the constructor to over-ride defaults
|
||||
#define TFT_WIDTH 320
|
||||
#define TFT_HEIGHT 480
|
||||
|
||||
|
||||
// Delay between some initialisation commands
|
||||
#define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked
|
||||
|
||||
|
||||
// Generic commands used by TFT_eSPI.cpp
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#define TFT_SLPIN 0x10
|
||||
#define TFT_SLPOUT 0x11
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
#define TFT_DISPOFF 0x28
|
||||
#define TFT_DISPON 0x29
|
||||
|
||||
#define TFT_CASET 0x2A
|
||||
#define TFT_PASET 0x2B
|
||||
#define TFT_RAMWR 0x2C
|
||||
|
||||
#define TFT_RAMRD 0x2E
|
||||
|
||||
#define TFT_MADCTL 0x36
|
||||
|
||||
#define TFT_MAD_MY 0x80
|
||||
#define TFT_MAD_MX 0x40
|
||||
#define TFT_MAD_MV 0x20
|
||||
#define TFT_MAD_ML 0x10
|
||||
#define TFT_MAD_RGB 0x00
|
||||
#define TFT_MAD_BGR 0x08
|
||||
#define TFT_MAD_MH 0x04
|
||||
#define TFT_MAD_SS 0x02
|
||||
#define TFT_MAD_GS 0x01
|
||||
|
||||
#define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read
|
80
TFT_Drivers/R61581_Init.h
Normal file
80
TFT_Drivers/R61581_Init.h
Normal file
@ -0,0 +1,80 @@
|
||||
|
||||
// This is the command sequence that initialises the R61581 driver
|
||||
//
|
||||
// This setup information uses simple 8 bit SPI writecommand() and writedata() functions
|
||||
//
|
||||
// See ST7735_Setup.h file for an alternative format
|
||||
|
||||
|
||||
// Configure R61581 display
|
||||
|
||||
writecommand(TFT_SLPOUT);
|
||||
delay(20);
|
||||
|
||||
writecommand(0xB0);
|
||||
writedata(0x00);
|
||||
|
||||
writecommand(0xD0);
|
||||
writedata(0x07);
|
||||
writedata(0x42);
|
||||
writedata(0x18);
|
||||
|
||||
writecommand(0xD1);
|
||||
writedata(0x00);
|
||||
writedata(0x07);
|
||||
writedata(0x10);
|
||||
|
||||
writecommand(0xD2);
|
||||
writedata(0x01);
|
||||
writedata(0x02);
|
||||
|
||||
writecommand(0xC0);
|
||||
writedata(0x12);
|
||||
writedata(0x3B);
|
||||
writedata(0x00);
|
||||
writedata(0x02);
|
||||
writedata(0x11);
|
||||
|
||||
writecommand(0xC5);
|
||||
writedata(0x03);
|
||||
|
||||
writecommand(0xC8);
|
||||
writedata(0x00);
|
||||
writedata(0x32);
|
||||
writedata(0x36);
|
||||
writedata(0x45);
|
||||
writedata(0x06);
|
||||
writedata(0x16);
|
||||
writedata(0x37);
|
||||
writedata(0x75);
|
||||
writedata(0x77);
|
||||
writedata(0x54);
|
||||
writedata(0x0C);
|
||||
writedata(0x00);
|
||||
|
||||
writecommand(TFT_MADCTL);
|
||||
writedata(0x0A);
|
||||
|
||||
writecommand(0x3A);
|
||||
writedata(0x55);
|
||||
|
||||
writecommand(TFT_CASET);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
writedata(0x3F);
|
||||
|
||||
writecommand(TFT_PASET);
|
||||
writedata(0x00);
|
||||
writedata(0x00);
|
||||
writedata(0x01);
|
||||
writedata(0xDF);
|
||||
|
||||
delay(120);
|
||||
writecommand(TFT_DISPON);
|
||||
|
||||
delay(25);
|
||||
// End of R61581 display configuration
|
||||
|
||||
|
||||
|
27
TFT_Drivers/R61581_Rotation.h
Normal file
27
TFT_Drivers/R61581_Rotation.h
Normal file
@ -0,0 +1,27 @@
|
||||
// This is the command sequence that rotates the R61581 driver coordinate frame
|
||||
|
||||
writecommand(TFT_MADCTL);
|
||||
rotation = m % 4;
|
||||
switch (rotation) {
|
||||
case 0: // Portrait
|
||||
writedata(TFT_MAD_BGR | TFT_MAD_MX);
|
||||
_width = TFT_WIDTH;
|
||||
_height = TFT_HEIGHT;
|
||||
break;
|
||||
case 1: // Landscape (Portrait + 90)
|
||||
writedata(TFT_MAD_MV | TFT_MAD_BGR);
|
||||
_width = TFT_HEIGHT;
|
||||
_height = TFT_WIDTH;
|
||||
break;
|
||||
case 2: // Inverter portrait
|
||||
writedata(TFT_MAD_BGR | TFT_MAD_GS);
|
||||
_width = TFT_WIDTH;
|
||||
_height = TFT_HEIGHT;
|
||||
break;
|
||||
case 3: // Inverted landscape
|
||||
writedata(TFT_MAD_MV | TFT_MAD_BGR | TFT_MAD_MX | TFT_MAD_GS);
|
||||
_width = TFT_HEIGHT;
|
||||
_height = TFT_WIDTH;
|
||||
break;
|
||||
}
|
||||
|
@ -361,6 +361,9 @@ void TFT_eSPI::init(uint8_t tc)
|
||||
#elif defined (ST7789_DRIVER)
|
||||
#include "TFT_Drivers/ST7789_Init.h"
|
||||
|
||||
#elif defined (R61581_DRIVER)
|
||||
#include "TFT_Drivers/R61581_Init.h"
|
||||
|
||||
#endif
|
||||
|
||||
spi_end();
|
||||
@ -409,6 +412,9 @@ void TFT_eSPI::setRotation(uint8_t m)
|
||||
#elif defined (ST7789_DRIVER)
|
||||
#include "TFT_Drivers/ST7789_Rotation.h"
|
||||
|
||||
#elif defined (R61581_DRIVER)
|
||||
#include "TFT_Drivers/R61581_Rotation.h"
|
||||
|
||||
#endif
|
||||
|
||||
delayMicroseconds(10);
|
||||
|
@ -330,7 +330,7 @@
|
||||
SET_PERI_REG_MASK(SPI_CMD_REG(SPI_NUM), SPI_USR); \
|
||||
while (READ_PERI_REG(SPI_CMD_REG(SPI_NUM))&SPI_USR);
|
||||
|
||||
// Write 16 bits (used for ESP32_PARALLEL or ILI9488_DRIVER)
|
||||
// Write 16 bits
|
||||
#define tft_Write_16S(C) \
|
||||
WRITE_PERI_REG(SPI_MOSI_DLEN_REG(SPI_NUM), 16-1); \
|
||||
WRITE_PERI_REG(SPI_W0_REG(SPI_NUM), C); \
|
||||
|
@ -25,6 +25,7 @@
|
||||
//#define ILI9486_DRIVER
|
||||
//#define ILI9488_DRIVER
|
||||
//#define ST7789_DRIVER // Define the screen size below for this display
|
||||
//#define R61581_DRIVER
|
||||
|
||||
// Some displays support SPI reads via the MISO pin, if the display has a single
|
||||
// bi-directional SDA pin the library will try to use bit banging to read the line
|
||||
|
@ -25,13 +25,14 @@
|
||||
//#include <User_Setups/Setup2_ST7735.h> // Setup file configured for my ST7735
|
||||
//#include <User_Setups/Setup3_ILI9163.h> // Setup file configured for my ILI9163
|
||||
//#include <User_Setups/Setup4_S6D02A1.h> // Setup file configured for my S6D02A1
|
||||
//#include <User_Setups/Setup5_RPi_ILI9486.h> // Setup file configured for my stock RPi TFT
|
||||
//#include <User_Setups/Setup6_RPi_Wr_ILI9486.h> // Setup file configured for my modified RPi TFT
|
||||
//#include <User_Setups/Setup7_ST7735_128x128.h> // Setup file configured for my ST7735 128x128 display
|
||||
//#include <User_Setups/Setup8_ILI9163_128x128.h> // Setup file configured for my ILI9163 128x128 display
|
||||
//#include <User_Setups/Setup9_ST7735_Overlap.h> // Setup file configured for my ST7735
|
||||
//#include <User_Setups/Setup10_RPi_touch_ILI9486.h> // Setup file configured for ESP8266 and RPi TFT with touch
|
||||
//#include <User_Setups/Setup11_RPi_touch_ILI9486.h> // Setup file configured for ESP32 and RPi TFT with touch
|
||||
//#include <User_Setups/Setup5_RPi_ILI9486.h> // Setup file configured for my stock RPi TFT
|
||||
//#include <User_Setups/Setup6_RPi_Wr_ILI9486.h> // Setup file configured for my modified RPi TFT
|
||||
//#include <User_Setups/Setup7_ST7735_128x128.h> // Setup file configured for my ST7735 128x128 display
|
||||
//#include <User_Setups/Setup8_ILI9163_128x128.h> // Setup file configured for my ILI9163 128x128 display
|
||||
//#include <User_Setups/Setup9_ST7735_Overlap.h> // Setup file configured for my ST7735
|
||||
//#include <User_Setups/Setup10_RPi_touch_ILI9486.h> // Setup file configured for ESP8266 and RPi TFT with touch
|
||||
|
||||
//#include <User_Setups/Setup11_RPi_touch_ILI9486.h> // Setup file configured for ESP32 and RPi TFT with touch
|
||||
//#include <User_Setups/Setup12_M5Stack.h> // Setup file for the ESP32 based M5Stack
|
||||
//#include <User_Setups/Setup13_ILI9481_Parallel.h> // Setup file for the ESP32 with parallel bus TFT
|
||||
//#include <User_Setups/Setup14_ILI9341_Parallel.h> // Setup file for the ESP32 with parallel bus TFT
|
||||
@ -102,6 +103,9 @@
|
||||
#elif defined (ST7789_DRIVER)
|
||||
#include "TFT_Drivers/ST7789_Defines.h"
|
||||
#define TFT_DRIVER 0x7789
|
||||
#elif defined (R61581_DRIVER)
|
||||
#include "TFT_Drivers/R61581_Defines.h"
|
||||
#define TFT_DRIVER 0x6158
|
||||
#elif defined (XYZZY_DRIVER) // <<<<<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVER HERE
|
||||
#include "TFT_Drivers/XYZZY_Defines.h"
|
||||
#define TFT_DRIVER 0x0000
|
||||
|
@ -25,6 +25,7 @@
|
||||
//#define ILI9486_DRIVER
|
||||
//#define ILI9488_DRIVER
|
||||
//#define ST7789_DRIVER // Define the screen size below for this display
|
||||
//#define R61581_DRIVER
|
||||
|
||||
// Some displays support SPI reads via the MISO pin, if the display has a single
|
||||
// bi-directional SDA pin the library will try to use bit banging to read the line
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "TFT_eSPI",
|
||||
"version": "1.3.4",
|
||||
"version": "1.3.5",
|
||||
"keywords": "tft, ePaper, display, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789",
|
||||
"description": "A TFT and ePaper SPI graphics library for ESP8266 and ESP32",
|
||||
"repository":
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=TFT_eSPI
|
||||
version=1.3.4
|
||||
version=1.3.5
|
||||
author=Bodmer
|
||||
maintainer=Bodmer
|
||||
sentence=A fast TFT graphics library for ESP8266 and ESP32 processors for the Arduino IDE
|
||||
|
Loading…
Reference in New Issue
Block a user