mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-07-31 19:24:46 +02:00
Add S6D02A1 and ILI9163 driver code
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# TFT_eSPI
|
||||
|
||||
An Arduino IDE compatible graphics and fonts library for ESP8266 processors with a driver for the ILI9341 and ST7735 based TFT displays.
|
||||
An Arduino IDE compatible graphics and fonts library for ESP8266 processors with a driver for the ILI9341, ILI9163, ST7735 and S6D02A1 based TFT displays.
|
||||
|
||||
The library contains proportional fonts, different sizes can be enabled/disabled at compile time to optimise the use of FLASH memory. The library has been tested with the NodeMCU (ESP8266 based)
|
||||
|
||||
|
62
TFT_Drivers/ILI9163_Defines.h
Normal file
62
TFT_Drivers/ILI9163_Defines.h
Normal file
@@ -0,0 +1,62 @@
|
||||
// Change the width and height if required (defined in portrait mode)
|
||||
// or use the constructor to over-ride defaults
|
||||
#define TFT_WIDTH 128
|
||||
#define TFT_HEIGHT 160
|
||||
|
||||
|
||||
// Color definitions for backwards compatibility with old sketches
|
||||
// use colour definitions like TFT_BLACK to make sketches more portable
|
||||
#define ILI9163_BLACK 0x0000 /* 0, 0, 0 */
|
||||
#define ILI9163_NAVY 0x000F /* 0, 0, 128 */
|
||||
#define ILI9163_DARKGREEN 0x03E0 /* 0, 128, 0 */
|
||||
#define ILI9163_DARKCYAN 0x03EF /* 0, 128, 128 */
|
||||
#define ILI9163_MAROON 0x7800 /* 128, 0, 0 */
|
||||
#define ILI9163_PURPLE 0x780F /* 128, 0, 128 */
|
||||
#define ILI9163_OLIVE 0x7BE0 /* 128, 128, 0 */
|
||||
#define ILI9163_LIGHTGREY 0xC618 /* 192, 192, 192 */
|
||||
#define ILI9163_DARKGREY 0x7BEF /* 128, 128, 128 */
|
||||
#define ILI9163_BLUE 0x001F /* 0, 0, 255 */
|
||||
#define ILI9163_GREEN 0x07E0 /* 0, 255, 0 */
|
||||
#define ILI9163_CYAN 0x07FF /* 0, 255, 255 */
|
||||
#define ILI9163_RED 0xF800 /* 255, 0, 0 */
|
||||
#define ILI9163_MAGENTA 0xF81F /* 255, 0, 255 */
|
||||
#define ILI9163_YELLOW 0xFFE0 /* 255, 255, 0 */
|
||||
#define ILI9163_WHITE 0xFFFF /* 255, 255, 255 */
|
||||
#define ILI9163_ORANGE 0xFD20 /* 255, 165, 0 */
|
||||
#define ILI9163_GREENYELLOW 0xAFE5 /* 173, 255, 47 */
|
||||
#define ILI9163_PINK 0xF81F
|
||||
|
||||
|
||||
// Delay between some initialisation commands
|
||||
#define TFT_INIT_DELAY 0x80
|
||||
#define DELAY 0x80
|
||||
|
||||
|
||||
// Generic commands used by TFT_eSPI.cpp
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#define TFT_CASET 0x2A
|
||||
#define TFT_PASET 0x2B
|
||||
#define TFT_RAMWR 0x2C
|
||||
|
||||
#define TFT_RAMRD 0x2E
|
||||
#define TFT_IDXRD 0x00 //0xDD // ILI9341 only, indexed control register read
|
||||
|
||||
#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_BGR 0x08
|
||||
#define TFT_MAD_MH 0x04
|
||||
#define TFT_MAD_RGB 0x00
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
|
||||
// All ILI9163 specific commands some are used by setRotation()
|
||||
#define ILI9163_RDID1 0xDA
|
||||
#define ILI9163_RDID2 0xDB
|
||||
#define ILI9163_RDID3 0xDC
|
37
TFT_Drivers/ILI9163_Init.h
Normal file
37
TFT_Drivers/ILI9163_Init.h
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
// This is the command sequence that initialises the ST7735 driver
|
||||
//
|
||||
// This setup information is in a format accecpted by the commandList() function
|
||||
// which reduces FLASH space, but on an ESP8266 there is plenty available!
|
||||
//
|
||||
// See ILI9341_Setup.h file for an alternative simpler format
|
||||
|
||||
{
|
||||
// Initialization commands for ILI9163 screens
|
||||
static const uint8_t ILI9163_cmds[] PROGMEM =
|
||||
{
|
||||
17, // 17 commands follow
|
||||
0x01, 0, // Software reset
|
||||
0x11, 0, // Exit sleep mode
|
||||
0x3A, 1, 0x05, // Set pixel format
|
||||
0x26, 1, 0x04, // Set Gamma curve
|
||||
0xF2, 1, 0x01, // Gamma adjustment enabled
|
||||
0xE0, 15, 0x3F, 0x25, 0x1C, 0x1E, 0x20, 0x12, 0x2A, 0x90,
|
||||
0x24, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, // Positive Gamma
|
||||
0xE1, 15, 0x20, 0x20, 0x20, 0x20, 0x05, 0x00, 0x15,0xA7,
|
||||
0x3D, 0x18, 0x25, 0x2A, 0x2B, 0x2B, 0x3A, // Negative Gamma
|
||||
0xB1, 2, 0x08, 0x08, // Frame rate control 1
|
||||
0xB4, 1, 0x07, // Display inversion
|
||||
0xC0, 2, 0x0A, 0x02, // Power control 1
|
||||
0xC1, 1, 0x02, // Power control 2
|
||||
0xC5, 2, 0x50, 0x5B, // Vcom control 1
|
||||
0xC7, 1, 0x40, // Vcom offset
|
||||
0x2A, 4+DELAY, 0x00, 0x00, 0x00, 0x7F, 250, // Set column address
|
||||
0x2B, 4, 0x00, 0x00, 0x00, 0x9F, // Set page address
|
||||
0x36, 1, 0xC8, // Set address mode
|
||||
0x29, 0, // Set display on
|
||||
};
|
||||
|
||||
commandList(ILI9163_cmds);
|
||||
|
||||
}
|
28
TFT_Drivers/ILI9163_Rotation.h
Normal file
28
TFT_Drivers/ILI9163_Rotation.h
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
// This is the command sequence that rotates the ILI9341 driver coordinate frame
|
||||
|
||||
rotation = m % 4;
|
||||
|
||||
writecommand(TFT_MADCTL);
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = TFT_WIDTH;
|
||||
_height = TFT_HEIGHT;
|
||||
break;
|
||||
case 1:
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = TFT_HEIGHT;
|
||||
_height = TFT_WIDTH;
|
||||
break;
|
||||
case 2:
|
||||
writedata(TFT_MAD_BGR);
|
||||
_width = TFT_WIDTH;
|
||||
_height = TFT_HEIGHT;
|
||||
break;
|
||||
case 3:
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR);
|
||||
_width = TFT_HEIGHT;
|
||||
_height = TFT_WIDTH;
|
||||
break;
|
||||
}
|
62
TFT_Drivers/S6D02A1_Defines.h
Normal file
62
TFT_Drivers/S6D02A1_Defines.h
Normal file
@@ -0,0 +1,62 @@
|
||||
// Change the width and height if required (defined in portrait mode)
|
||||
// or use the constructor to over-ride defaults
|
||||
#define TFT_WIDTH 128
|
||||
#define TFT_HEIGHT 160
|
||||
|
||||
|
||||
// Color definitions for backwards compatibility with old sketches
|
||||
// use colour definitions like TFT_BLACK to make sketches more portable
|
||||
#define S6D02A1_BLACK 0x0000 /* 0, 0, 0 */
|
||||
#define S6D02A1_NAVY 0x000F /* 0, 0, 128 */
|
||||
#define S6D02A1_DARKGREEN 0x03E0 /* 0, 128, 0 */
|
||||
#define S6D02A1_DARKCYAN 0x03EF /* 0, 128, 128 */
|
||||
#define S6D02A1_MAROON 0x7800 /* 128, 0, 0 */
|
||||
#define S6D02A1_PURPLE 0x780F /* 128, 0, 128 */
|
||||
#define S6D02A1_OLIVE 0x7BE0 /* 128, 128, 0 */
|
||||
#define S6D02A1_LIGHTGREY 0xC618 /* 192, 192, 192 */
|
||||
#define S6D02A1_DARKGREY 0x7BEF /* 128, 128, 128 */
|
||||
#define S6D02A1_BLUE 0x001F /* 0, 0, 255 */
|
||||
#define S6D02A1_GREEN 0x07E0 /* 0, 255, 0 */
|
||||
#define S6D02A1_CYAN 0x07FF /* 0, 255, 255 */
|
||||
#define S6D02A1_RED 0xF800 /* 255, 0, 0 */
|
||||
#define S6D02A1_MAGENTA 0xF81F /* 255, 0, 255 */
|
||||
#define S6D02A1_YELLOW 0xFFE0 /* 255, 255, 0 */
|
||||
#define S6D02A1_WHITE 0xFFFF /* 255, 255, 255 */
|
||||
#define S6D02A1_ORANGE 0xFD20 /* 255, 165, 0 */
|
||||
#define S6D02A1_GREENYELLOW 0xAFE5 /* 173, 255, 47 */
|
||||
#define S6D02A1_PINK 0xF81F
|
||||
|
||||
|
||||
// Delay between some initialisation commands
|
||||
#define TFT_INIT_DELAY 0x80
|
||||
#define DELAY 0x80
|
||||
|
||||
|
||||
// Generic commands used by TFT_eSPI.cpp
|
||||
#define TFT_NOP 0x00
|
||||
#define TFT_SWRST 0x01
|
||||
|
||||
#define TFT_CASET 0x2A
|
||||
#define TFT_PASET 0x2B
|
||||
#define TFT_RAMWR 0x2C
|
||||
|
||||
#define TFT_RAMRD 0x2E
|
||||
#define TFT_IDXRD 0x00 //0xDD // ILI9341 only, indexed control register read
|
||||
|
||||
#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_BGR 0x08
|
||||
#define TFT_MAD_MH 0x04
|
||||
#define TFT_MAD_RGB 0x00
|
||||
|
||||
#define TFT_INVOFF 0x20
|
||||
#define TFT_INVON 0x21
|
||||
|
||||
|
||||
// All S6D02A1 specific commands some are used by setRotation()
|
||||
#define S6D02A1_RDID1 0xDA
|
||||
#define S6D02A1_RDID2 0xDB
|
||||
#define S6D02A1_RDID3 0xDC
|
47
TFT_Drivers/S6D02A1_Init.h
Normal file
47
TFT_Drivers/S6D02A1_Init.h
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
// This is the command sequence that initialises the S6D02A1 driver
|
||||
//
|
||||
// This setup information is in a format accecpted by the commandList() function
|
||||
// which reduces FLASH space, but on an ESP8266 there is plenty available!
|
||||
//
|
||||
// See S6D02A1_Setup.h file for an alternative simpler format
|
||||
|
||||
{
|
||||
// Initialization commands for S6D02A1 screens
|
||||
static const uint8_t S6D02A1_cmds[] PROGMEM =
|
||||
{
|
||||
29,
|
||||
0xf0, 2, 0x5a, 0x5a, // Excommand2
|
||||
0xfc, 2, 0x5a, 0x5a, // Excommand3
|
||||
0x26, 1, 0x01, // Gamma set
|
||||
0xfa, 15, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3d, 0x02, 0x01, // Positive gamma control
|
||||
0xfb, 15, 0x21, 0x00, 0x02, 0x04, 0x07, 0x0a, 0x0b, 0x0c, 0x0c, 0x16, 0x1e, 0x30, 0x3f, 0x01, 0x02, // Negative gamma control
|
||||
0xfd, 11, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x01, 0x01, 0x00, 0x1f, 0x1f, // Analog parameter control
|
||||
0xf4, 15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, // Power control
|
||||
0xf5, 13, 0x00, 0x70, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x66, 0x06, // VCOM control
|
||||
0xf6, 11, 0x02, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x01, 0x00, // Source control
|
||||
0xf2, 17, 0x00, 0x01, 0x03, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x08, 0x08, //Display control
|
||||
0xf8, 1, 0x11, // Gate control
|
||||
0xf7, 4, 0xc8, 0x20, 0x00, 0x00, // Interface control
|
||||
0xf3, 2, 0x00, 0x00, // Power sequence control
|
||||
0x11, DELAY, 50, // Wake
|
||||
0xf3, 2+DELAY, 0x00, 0x01, 50, // Power sequence control
|
||||
0xf3, 2+DELAY, 0x00, 0x03, 50, // Power sequence control
|
||||
0xf3, 2+DELAY, 0x00, 0x07, 50, // Power sequence control
|
||||
0xf3, 2+DELAY, 0x00, 0x0f, 50, // Power sequence control
|
||||
0xf4, 15+DELAY, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, 50, // Power control
|
||||
0xf3, 2+DELAY, 0x00, 0x1f, 50, // Power sequence control
|
||||
0xf3, 2+DELAY, 0x00, 0x7f, 50, // Power sequence control
|
||||
0xf3, 2+DELAY, 0x00, 0xff, 50, // Power sequence control
|
||||
0xfd, 11, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x00, 0x01, 0x00, 0x16, 0x16, // Analog parameter control
|
||||
0xf4, 15, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, // Power control
|
||||
0x36, 1, 0xC8, // Memory access data control
|
||||
0x35, 1, 0x00, // Tearing effect line on
|
||||
0x3a, 1+DELAY, 0x05, 150, // Interface pixel control
|
||||
0x29, 0, // Display on
|
||||
0x2c, 0 // Memory write
|
||||
};
|
||||
|
||||
commandList(S6D02A1_cmds);
|
||||
|
||||
}
|
28
TFT_Drivers/S6D02A1_Rotation.h
Normal file
28
TFT_Drivers/S6D02A1_Rotation.h
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
// This is the command sequence that rotates the S6D02A1 driver coordinate frame
|
||||
|
||||
rotation = m % 4;
|
||||
|
||||
writecommand(TFT_MADCTL);
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = TFT_WIDTH;
|
||||
_height = TFT_HEIGHT;
|
||||
break;
|
||||
case 1:
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = TFT_HEIGHT;
|
||||
_height = TFT_WIDTH;
|
||||
break;
|
||||
case 2:
|
||||
writedata(TFT_MAD_BGR);
|
||||
_width = TFT_WIDTH;
|
||||
_height = TFT_HEIGHT;
|
||||
break;
|
||||
case 3:
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR);
|
||||
_width = TFT_HEIGHT;
|
||||
_height = TFT_WIDTH;
|
||||
break;
|
||||
}
|
12
TFT_eSPI.cpp
12
TFT_eSPI.cpp
@@ -178,6 +178,11 @@ void TFT_eSPI::init(void)
|
||||
#elif defined (ST7735_DRIVER)
|
||||
#include "TFT_Drivers\ST7735_Init.h"
|
||||
|
||||
#elif defined (ILI9163_DRIVER)
|
||||
#include "TFT_Drivers\ILI9163_Init.h"
|
||||
|
||||
#elif defined (S6D02A1_DRIVER)
|
||||
#include "TFT_Drivers\S6D02A1_Init.h"
|
||||
#endif
|
||||
|
||||
spi_end();
|
||||
@@ -200,6 +205,13 @@ void TFT_eSPI::setRotation(uint8_t m)
|
||||
|
||||
#elif defined (ST7735_DRIVER)
|
||||
#include "TFT_Drivers\ST7735_Rotation.h"
|
||||
|
||||
#elif defined (ILI9163_DRIVER)
|
||||
#include "TFT_Drivers\ILI9163_Rotation.h"
|
||||
|
||||
#elif defined (S6D02A1_DRIVER)
|
||||
#include "TFT_Drivers\S6D02A1_Rotation.h"
|
||||
|
||||
#endif
|
||||
|
||||
spi_end();
|
||||
|
@@ -27,6 +27,10 @@
|
||||
#include <TFT_Drivers\ILI9341_Defines.h>
|
||||
#elif defined (ST7735_DRIVER)
|
||||
#include <TFT_Drivers\ST7735_Defines.h>
|
||||
#elif defined (ILI9163_DRIVER)
|
||||
#include <TFT_Drivers\ILI9163_Defines.h>
|
||||
#elif defined (S6D02A1_DRIVER)
|
||||
#include <TFT_Drivers\S6D02A1_Defines.h>
|
||||
#endif
|
||||
|
||||
// If the frequency is not defined, set a default
|
||||
|
24
User_Setup.h
24
User_Setup.h
@@ -14,21 +14,10 @@
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
|
||||
// For ST7735 ONLY, define the type of display, originally this was based on the
|
||||
// colour of the tab on the screen protector film but this is not always true, so try
|
||||
// out the different options below if the screen does not display graphics correctly,
|
||||
// e.g. colours wrong, mirror images, or tray pixels at the edges.
|
||||
// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this
|
||||
// User_Setup file, then rebuild and upload the sketch to the board again:
|
||||
|
||||
//#define ST7735_INITB
|
||||
//#define ST7735_GREENTAB
|
||||
//#define ST7735_GREENTAB2
|
||||
//#define ST7735_REDTAB
|
||||
//#define ST7735_BLACKTAB
|
||||
//#define ILI9341_DRIVER
|
||||
#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
//#define S6D02A1_DRIVER
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
@@ -131,13 +120,14 @@
|
||||
// Define the SPI clock frequency
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display TBD MHz works OK,
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
// #define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
#define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
|
||||
|
@@ -20,5 +20,7 @@
|
||||
|
||||
//#include <User_Setups\Setup1_ILI9341.h> // Setup file configured for my ILI9341
|
||||
//#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\SetupX_Template.h> // Setup file template for copying/editting
|
||||
|
140
User_Setups/Setup3_ILI9163.h
Normal file
140
User_Setups/Setup3_ILI9163.h
Normal file
@@ -0,0 +1,140 @@
|
||||
// USER DEFINED SETTINGS
|
||||
//
|
||||
// The User_Setup header that will be called up is defined in User_Setup_Select.h
|
||||
//
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// If this file is editted correctly then all the library example sketches should
|
||||
// run without the need to make any more changes for a particular hardware setup!
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
#define ILI9163_DRIVER
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (or AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI deivces (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ######
|
||||
|
||||
// ModeMCU
|
||||
#define TFT_CS D8 // Chip select control pin D8
|
||||
#define TFT_DC D3 // Data Command control pin
|
||||
#define TFT_RST D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// ESP32 Dev board (planned, not supported yet)
|
||||
//#define TFT_CS 5 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 had plenty of memory so commenting out fonts is not normally necessary
|
||||
// If all fonts are loaded the extra FLASH space required is about 17Kbytes...
|
||||
// To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Define the character to be used to detemine the text bounding box for datum changes
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline
|
||||
#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display TBD MHz works OK,
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. Tranaction support is required if other SPI devices are connected.
|
||||
// When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
140
User_Setups/Setup4_S6D02A1.h
Normal file
140
User_Setups/Setup4_S6D02A1.h
Normal file
@@ -0,0 +1,140 @@
|
||||
// USER DEFINED SETTINGS
|
||||
//
|
||||
// The User_Setup header that will be called up is defined in User_Setup_Select.h
|
||||
//
|
||||
// Set driver type, fonts to be loaded, pins used and SPI control method etc
|
||||
//
|
||||
// If this file is editted correctly then all the library example sketches should
|
||||
// run without the need to make any more changes for a particular hardware setup!
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 0. Call up the right driver file and any options for it
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Only define one driver, the other ones must be commented out
|
||||
//#define ILI9341_DRIVER
|
||||
//#define ST7735_DRIVER
|
||||
//#define ILI9163_DRIVER
|
||||
#define S6D02A1_DRIVER
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 1. Define the pins that are used to interface with the display here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// We must use hardware SPI, a minimum of 3 GPIO pins is needed.
|
||||
// Typical setup for NodeMCU ESP-12 is :
|
||||
//
|
||||
// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT)
|
||||
// Display LED to NodeMCU pin VIN (or 5V, see below)
|
||||
// Display SCK to NodeMCU pin D5
|
||||
// Display SDI/MOSI to NodeMCU pin D7
|
||||
// Display DC (or AO)to NodeMCU pin D3
|
||||
// Display RESET to NodeMCU pin D4 (or RST, see below)
|
||||
// Display CS to NodeMCU pin D8 (or GND, see below)
|
||||
// Display GND to NodeMCU pin GND (0V)
|
||||
// Display VCC to NodeMCU 5V or 3.3V
|
||||
//
|
||||
// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin
|
||||
//
|
||||
// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more
|
||||
// SPI deivces (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS
|
||||
// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin
|
||||
// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected.
|
||||
//
|
||||
// The NodeMCU D0 pin can be used for RST
|
||||
//
|
||||
// See Section 2. below if DC or CS is connected to D0
|
||||
//
|
||||
// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin
|
||||
// If 5V is not available at a pin you can use 3.3V but backlight brightness
|
||||
// will be lower.
|
||||
|
||||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ######
|
||||
|
||||
// ModeMCU
|
||||
#define TFT_CS D8 // Chip select control pin D8
|
||||
#define TFT_DC D3 // Data Command control pin
|
||||
#define TFT_RST D4 // Reset pin (could connect to NodeMCU RST, see next line)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V
|
||||
|
||||
// ESP32 Dev board (planned, not supported yet)
|
||||
//#define TFT_CS 5 // Chip select control pin
|
||||
//#define TFT_DC 2 // Data Command control pin
|
||||
//#define TFT_RST 4 // Reset pin (could connect to Arduino RESET pin)
|
||||
//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 2. Define the way the DC and/or CS lines are driven
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Normally the library uses direct register access for the DC and CS lines for speed
|
||||
// If D0 (GPIO16) is used for CS or DC then a different slower method must be used
|
||||
// Uncomment one line if D0 is used for DC or CS
|
||||
// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test
|
||||
// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test
|
||||
|
||||
// #define D0_USED_FOR_DC
|
||||
// #define D0_USED_FOR_CS
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 3. Define the fonts that are to be used here
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Comment out the #defines below with // to stop that font being loaded
|
||||
// The ESP8366 had plenty of memory so commenting out fonts is not normally necessary
|
||||
// If all fonts are loaded the extra FLASH space required is about 17Kbytes...
|
||||
// To save FLASH space only enable the fonts you need!
|
||||
|
||||
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
|
||||
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
|
||||
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
|
||||
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
|
||||
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 4. Define the character to be used to detemine the text bounding box for datum changes
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline
|
||||
#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline
|
||||
|
||||
|
||||
// ##################################################################################
|
||||
//
|
||||
// Section 5. Other options
|
||||
//
|
||||
// ##################################################################################
|
||||
|
||||
// Define the SPI clock frequency
|
||||
// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails
|
||||
// With a ST7735 display more than 27MHz may not work (spurious pixels and lines)
|
||||
// With an ILI9163 display TBD MHz works OK,
|
||||
|
||||
// #define SPI_FREQUENCY 1000000
|
||||
// #define SPI_FREQUENCY 5000000
|
||||
// #define SPI_FREQUENCY 10000000
|
||||
// #define SPI_FREQUENCY 20000000
|
||||
#define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3
|
||||
// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
|
||||
// #define SPI_FREQUENCY 80000000
|
||||
|
||||
|
||||
// Comment out the following #define if "SPI Transactions" do not need to be
|
||||
// supported. Tranaction support is required if other SPI devices are connected.
|
||||
// When commented out the code size will be smaller and sketches will
|
||||
// run slightly faster, so leave it commented out unless you need it!
|
||||
// Transaction support is needed to work with SD library but not needed with TFT_SdFat
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
Reference in New Issue
Block a user