New Arduino tft_setup.h development interest. #2671
Closed
WeGoWireless
started this conversation in
Compatible support libraries
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a working first version of a new Arduino Adafruit like support code in the works. You would call TFT_eSPI_ILI9488.h for example. So each display driver has its own library similar to her Adafruit does it. That way you don't need to use User_Setup_Select.h. Wanted to know if there is interest as I would try to make it compatible with the current TFT_eSPI or just make my own side version. It uses the tft_setup.h and a few modifications to TFT_eSPI.cpp and .h. tft_setup.h looks something like the below. If interested let me know. Thank you Bodmer for all the work you do. Just a first cut more in the works.
Scroll down for a quick partial version of TFT_eSPI_ILI9488.cpp
///////////////////////////////////////////////////////////
/* Support file for ESP32 Arduino use /
/ See library docs folder /
/ /
/ DO NOT EDIT THIS FILE /
/ */
///////////////////////////////////////////////////////////
/**
*/
/***************************************************************************************
** TFT_eSPI Configuration defines
***************************************************************************************/
// Override defaults
#define USER_SETUP_LOADED
#define DISABLE_ALL_LIBRARY_WARNINGS
extern int8_t tft_miso;
extern int8_t tft_mosi;
extern int8_t tft_sclk;
extern int8_t tft_rst;
extern int8_t tft_cs;
extern int8_t tft_dc;
#define TFT_MISO tft_miso
#define TFT_MOSI tft_mosi
#define TFT_SCLK tft_sclk
#define TFT_RST tft_rst
#define TFT_CS tft_cs
#define TFT_DC tft_dc
extern int16_t tft_width;
extern int16_t tft_height;
#define TFT_WIDTH tft_width
#define TFT_HEIGHT tft_height
extern int8_t tft_init_delay;
#define TFT_INIT_DELAY tft_init_delay
extern int8_t tft_nop;
#define TFT_NOP tft_nop
extern int8_t tft_swrst;
#define TFT_SWRST tft_swrst
extern int8_t tft_slpin;
#define TFT_SLPIN tft_slpin
extern int8_t tft_slpout;
#define TFT_SLPOUT tft_slpout
extern int8_t tft_invoff;
#define TFT_INVOFF tft_invoff
extern int8_t tft_invon;
#define TFT_INVON tft_invon
extern int8_t tft_dispoff;
#define TFT_DISPOFF tft_dispoff
extern int8_t tft_dispon;
#define TFT_DISPON tft_dispon
extern int8_t tft_caset;
#define TFT_CASET tft_caset
extern int8_t tft_paset;
#define TFT_PASET tft_paset
extern int8_t tft_ramwr;
#define TFT_RAMWR tft_ramwr
extern int8_t tft_ramrd;
#define TFT_RAMRD tft_ramrd
extern int8_t tft_madctl;
#define TFT_MADCTL tft_madctl
extern int8_t tft_mad_my;
#define TFT_MAD_MY tft_mad_my
extern int8_t tft_mad_mx;
#define TFT_MAD_MX tft_mad_mx
extern int8_t tft_mad_mv;
#define TFT_MAD_MV tft_mad_mv
extern int8_t tft_mad_ml;
#define TFT_MAD_ML tft_mad_ml
extern int8_t tft_mad_rgb;
#define TFT_MAD_RGB tft_mad_rgb
extern int8_t tft_mad_bgr;
#define TFT_MAD_BGR tft_mad_bgr
extern int8_t tft_mad_mh;
#define TFT_MAD_MH tft_mad_mh
extern int8_t tft_mad_ss;
#define TFT_MAD_SS tft_mad_ss
extern int8_t tft_mad_gs;
#define TFT_MAD_GS tft_mad_gs
extern const uint8_t PROGMEM initcmd[];
//#define ILI9488_DRIVER
#define SPI_18BIT_DRIVER
#define TOUCH_CS 6 // Chip select pin (T_CS) of touch screen
#define LOAD_GFXFF // needed to use own fonts
//#define USE_HSPI_PORT
#define SUPPORT_TRANSACTIONS
// #define SPI_FREQUENCY 20000000
#define SPI_FREQUENCY 27000000
// #define SPI_FREQUENCY 40000000
// #define SPI_FREQUENCY 80000000
// Optional reduced SPI frequency for reading TFT
#define SPI_READ_FREQUENCY 16000000
#define SPI_TOUCH_FREQUENCY 2500000
jsut a quick example of TFT_eSPI_ILI9488.cpp
#include <Arduino.h>
#include "TFT_eSPI_ILI9488.h"
//#include <SPI.h>
//#include <ILI9488_Defines.h>
//#include <ILI9488_Init.h>
//#include <ILI9488_Rotation.h>
#include <TFT_eSPI.h>
int8_t tft_miso;
int8_t tft_mosi;
int8_t tft_sclk;
int8_t tft_rst;
int8_t tft_cs;
int8_t tft_dc;
int16_t tft_width = 320;
int16_t tft_height = 480;
int8_t tft_init_delay = 0x80;
int8_t tft_nop = 0x00;
int8_t tft_swrst = 0x01;
int8_t tft_slpin = 0x10;
int8_t tft_slpout = 0x11;
int8_t tft_invoff = 0x20;
int8_t tft_invon = 0x21;
int8_t tft_dispoff = 0x28;
int8_t tft_dispon = 0x29;
int8_t tft_caset = 0x2A;
int8_t tft_paset = 0x2B;
int8_t tft_ramwr = 0x2C;
int8_t tft_ramrd = 0x2E;
int8_t tft_madctl = 0x36;
int8_t tft_mad_my = 0x80;
int8_t tft_mad_mx = 0x40;
int8_t tft_mad_mv = 0x20;
int8_t tft_mad_ml = 0x10;
int8_t tft_mad_rgb = 0x00;
int8_t tft_mad_bgr = 0x08;
int8_t tft_mad_mh = 0x04;
int8_t tft_mad_ss = 0x02;
int8_t tft_mad_gs = 0x01;
const uint8_t PROGMEM initcmd[] = {
0XC0, 2, 0x17, 0x15, // Power control VRH[5:0] Vreg1out, Verg2out
0xC1, 1, 0x41, // Power control SAP[2:0];BT[3:0] VGH,VGL
0xC5, 3, 0x00, 0x12, 0x80, // VCM control
tft_madctl, 1, 0x48, // Memory Access Control
0x3A, 1, 0x66, // 18 bit colour for SPI
0xB0, 1, 0x00, // Interface Mode Control jaretburkett has 80=SDO NOT USE, Bodmer has 00
0xB1, 1, 0xA0, // Frame Rate Control
0xB4, 1, 0x02, // Display Inversion Control 2-dot
0xB6, 3, 0x02, 0x02, 0x3B, // Display Function Control
0xB7, 1, 0xC6, // Entry mode set
0xF7, 4, 0xA9, 0x51, 0x2C, 0x82,
0xE0, 15, 0x00, 0x03, 0x09, 0x08, 0x16, 0x0A, // Set Gamma
0x3F, 0x78, 0x4C, 0x09, 0x0A, 0x08, 0x16, 0x1A, 0x0F,
0XE1, 15, 0x00, 0x16, 0x19, 0x03, 0x0F, 0x05, // Set Gamma
0x32, 0x45, 0x46, 0x04, 0x0E, 0x0D, 0x35, 0x37, 0x0F,
tft_slpout, 0x80, // Exit Sleep 0x80 = delay 150
tft_dispon, 0x80, // Display on 0x80 = delay 150
0x00 // End of list
};
Beta Was this translation helpful? Give feedback.
All reactions