Update TFT_eSPI lib,Fix TFT-Shield Wrong size definition
This commit is contained in:
parent
742e6f3680
commit
73bdb79a3e
40 changed files with 2230 additions and 2847 deletions
36
lib/TFT_eSPI/.github/ISSUE_TEMPLATE/issue-template.md
vendored
Normal file
36
lib/TFT_eSPI/.github/ISSUE_TEMPLATE/issue-template.md
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
name: Issue template
|
||||
about: Guide to content
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Only raise issues for problems with the library and/or provided examples. Post questions, comments and useful tips etc in the "Discussions" section.
|
||||
|
||||
To minimise effort to resolve issues the following should be provided as a minimum:
|
||||
1. A description of the problem and the conditions that cause it to occur
|
||||
2. IDE (e.g. Arduino or PlatformIO)
|
||||
3. TFT_eSPI library version (try the latest, the problem may have been resolved!) from the Manage Libraries... menu
|
||||
4. Board package version (e.g. 2.0.3) available from the Boards Manager... menu
|
||||
5. Procesor, e.g RP2040, ESP32 S3 etc
|
||||
6. TFT driver (e.g. ILI9341), a link to the vendors product web page is useful too.
|
||||
7. Interface type (SPI or parallel)
|
||||
|
||||
Plus further information as appropriate to the problem:
|
||||
1. TFT to processor connections used
|
||||
2. A zip file containing your setup file (just drag and drop in message window - do not paste in long files!)
|
||||
3. A zip file containing a simple and complete example sketch that demonstrates the problem but needs no special hardware sensors or libraries.
|
||||
4. Screen shot pictures showing the problem (just drag and drop in message window)
|
||||
|
||||
The idea is to provide sufficient information so I can setup the exact same (or sufficiently similar) scenario to investigate and resolve the issue without having a tedious ping-pong of Q&A.
|
||||
|
||||
DO NOT paste code directly into the issue. To correctly format code put three ticks ( ` character on key next to "1" key) at the start and end of short pasted code segments to avoid format/markup anomolies. [See here:](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code)
|
||||
|
||||
Example output:
|
||||
|
||||
```
|
||||
Serial.begin(115200);
|
||||
tft.init();
|
||||
```
|
||||
|
|
@ -793,8 +793,7 @@ bool TFT_eSPI::initDMA(bool ctrl_cs)
|
|||
.sclk_io_num = TFT_SCLK,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
//#ifdef CONFIG_IDF_TARGET_ESP32S2
|
||||
#if 1
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32S2
|
||||
.data4_io_num = -1,
|
||||
.data5_io_num = -1,
|
||||
.data6_io_num = -1,
|
||||
|
|
|
|||
|
|
@ -644,10 +644,13 @@ void TFT_eSPI::pushPixelsDMA(uint16_t* image, uint32_t len)
|
|||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
bool temp = _swapBytes;
|
||||
_swapBytes = false;
|
||||
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
|
||||
pushPixels(image, 0x400);
|
||||
len -= 0x400; image+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
_swapBytes = temp;
|
||||
|
||||
esp_err_t ret;
|
||||
static spi_transaction_t trans;
|
||||
|
|
@ -685,10 +688,13 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
|
|||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
bool temp = _swapBytes;
|
||||
_swapBytes = false;
|
||||
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
|
||||
pushPixels(buffer, 0x400);
|
||||
len -= 0x400; buffer+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
_swapBytes = temp;
|
||||
|
||||
esp_err_t ret;
|
||||
static spi_transaction_t trans;
|
||||
|
|
@ -770,10 +776,13 @@ void TFT_eSPI::pushImageDMA(int32_t x, int32_t y, int32_t w, int32_t h, uint16_t
|
|||
// small transfers are performed using a blocking call until DMA capacity is reached.
|
||||
// User sketch can prevent blocking by managing pixel count and splitting into blocks
|
||||
// of 32768 pixels maximum. (equivalent to an area of ~320 x 100 pixels)
|
||||
bool temp = _swapBytes;
|
||||
_swapBytes = false;
|
||||
while(len>0x4000) { // Transfer 16 bit pixels in blocks if len*2 over 65536 bytes
|
||||
pushPixels(buffer, 0x400);
|
||||
len -= 0x400; buffer+= 0x400; // Arbitrarily send 1K pixel blocks (2Kbytes)
|
||||
}
|
||||
_swapBytes = temp;
|
||||
|
||||
esp_err_t ret;
|
||||
static spi_transaction_t trans;
|
||||
|
|
|
|||
|
|
@ -18,26 +18,26 @@
|
|||
SPIClassRP2040 spi = SPIClassRP2040(SPI_X, TFT_MISO, -1, TFT_SCLK, TFT_MOSI);
|
||||
#endif
|
||||
|
||||
#else // PIO interface used (8 bit parallel or SPI)
|
||||
#else // PIO interface used (8-bit parallel or SPI)
|
||||
|
||||
#ifdef RP2040_PIO_SPI
|
||||
#if defined (SPI_18BIT_DRIVER)
|
||||
// SPI PIO code for 18 bit colour transmit
|
||||
#include "pio_SPI_18bit.pio.h"
|
||||
#else
|
||||
// SPI PIO code for 16 bit colour transmit
|
||||
// SPI PIO code for 16-bit colour transmit
|
||||
#include "pio_SPI.pio.h"
|
||||
#endif
|
||||
#elif defined (TFT_PARALLEL_8_BIT)
|
||||
#if defined (SSD1963_DRIVER)
|
||||
// PIO code for 8 bit parallel interface (18 bit colour)
|
||||
// PIO code for 8-bit parallel interface (18 bit colour)
|
||||
#include "pio_8bit_parallel_18bpp.pio.h"
|
||||
#else
|
||||
// PIO code for 8 bit parallel interface (16 bit colour)
|
||||
// PIO code for 8-bit parallel interface (16-bit colour)
|
||||
#include "pio_8bit_parallel.pio.h"
|
||||
#endif
|
||||
#else // must be TFT_PARALLEL_16_BIT
|
||||
// PIO code for 16 bit parallel interface (16 bit colour)
|
||||
// PIO code for 16-bit parallel interface (16-bit colour)
|
||||
#include "pio_16bit_parallel.pio.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -128,24 +128,12 @@ void TFT_eSPI::end_SDA_Read(void)
|
|||
#ifdef RP2040_PIO_SPI
|
||||
void pioinit(uint32_t clock_freq) {
|
||||
|
||||
// Find a free SM on one of the PIO's
|
||||
tft_pio = pio0;
|
||||
|
||||
/*
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, false); // false means don't panic
|
||||
// Try pio1 if SM not found
|
||||
if (pio_sm < 0) {
|
||||
tft_pio = pio1;
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, true); // panic this time if no SM is free
|
||||
}
|
||||
*/
|
||||
|
||||
// Find enough free space on one of the PIO's
|
||||
tft_pio = pio0;
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program)) {
|
||||
tft_pio = pio1;
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program)) {
|
||||
Serial.println("No room for PIO program!");
|
||||
// Serial.println("No room for PIO program!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -197,29 +185,21 @@ void pioinit(uint32_t clock_freq) {
|
|||
pio_instr_set_dc = pio_encode_set((pio_src_dest)0, 1);
|
||||
pio_instr_clr_dc = pio_encode_set((pio_src_dest)0, 0);
|
||||
}
|
||||
#else // 8 or 16 bit parallel
|
||||
#else // 8 or 16-bit parallel
|
||||
void pioinit(uint16_t clock_div, uint16_t fract_div) {
|
||||
|
||||
// Find a free SM on one of the PIO's
|
||||
tft_pio = pio0;
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, false); // false means don't panic
|
||||
// Try pio1 if SM not found
|
||||
if (pio_sm < 0) {
|
||||
tft_pio = pio1;
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, true); // panic this time if no SM is free
|
||||
}
|
||||
/*
|
||||
// Find enough free space on one of the PIO's
|
||||
tft_pio = pio0;
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program) {
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program)) {
|
||||
tft_pio = pio1;
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program) {
|
||||
Serial.println("No room for PIO program!");
|
||||
while(1) delay(100);
|
||||
if (!pio_can_add_program(tft_pio, &tft_io_program)) {
|
||||
// Serial.println("No room for PIO program!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
pio_sm = pio_claim_unused_sm(tft_pio, false);
|
||||
|
||||
#if defined (TFT_PARALLEL_8_BIT)
|
||||
uint8_t bits = 8;
|
||||
#else // must be TFT_PARALLEL_16_BIT
|
||||
|
|
@ -491,12 +471,12 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
|||
uint16_t g = (color & 0x07E0)>>3;
|
||||
uint16_t b = (color & 0x001F)<<3;
|
||||
|
||||
// If more than 32 pixels then change to 16 bit transfers with concatenated pixels
|
||||
// If more than 32 pixels then change to 16-bit transfers with concatenated pixels
|
||||
if (len > 32) {
|
||||
uint32_t rg = r<<8 | g;
|
||||
uint32_t br = b<<8 | r;
|
||||
uint32_t gb = g<<8 | b;
|
||||
// Must wait before changing to 16 bit
|
||||
// Must wait before changing to 16-bit
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (16 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
while ( len > 1 ) {
|
||||
|
|
@ -505,7 +485,7 @@ void TFT_eSPI::pushBlock(uint16_t color, uint32_t len)
|
|||
while (!spi_is_writable(SPI_X)){}; spi_get_hw(SPI_X)->dr = gb;
|
||||
len -= 2;
|
||||
}
|
||||
// Must wait before changing back to 8 bit
|
||||
// Must wait before changing back to 8-bit
|
||||
while (spi_get_hw(SPI_X)->sr & SPI_SSPSR_BSY_BITS) {};
|
||||
hw_write_masked(&spi_get_hw(SPI_X)->cr0, (8 - 1) << SPI_SSPCR0_DSS_LSB, SPI_SSPCR0_DSS_BITS);
|
||||
}
|
||||
|
|
@ -536,7 +516,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#else // Standard SPI 16 bit colour TFT
|
||||
#else // Standard SPI 16-bit colour TFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/***************************************************************************************
|
||||
|
|
@ -582,7 +562,7 @@ void TFT_eSPI::pushPixels(const void* data_in, uint32_t len){
|
|||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef RP2040_DMA // DMA functions for 16 bit SPI and 8/16 bit parallel displays
|
||||
#ifdef RP2040_DMA // DMA functions for 16-bit SPI and 8/16-bit parallel displays
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
These are created in header file:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
A ["Discussions"](https://github.com/Bodmer/TFT_eSPI/discussions) facility has been added for Q&A etc. Use the ["Issues"](https://github.com/Bodmer/TFT_eSPI/issues) tab only for problems with the library. Thanks!
|
||||
# News
|
||||
1. New functions have been added to draw smooth (antialiased) arcs, circles, and rounded rectangle outlines. New sketches are provided in the "Smooth Graphics" examples folder. Arcs can be drawn with or without anti-aliasing (which will then render faster). The arc ends can be straight or rounded. The arc drawing algorithm uses an optimised fixed point sqrt() function to improve performance on processors that do not have a hardware Floating Point Unit (e.g. RP2040). Here are two demo images, on the left smooth (anti-aliased) arcs with rounded ends, the image to the right is the same resolution (grabbed from the same 240x240 TFT) with the smoothing diasbled (no anti-aliasing):
|
||||
1. The Create_font Processing sketch has been updated to automatically create a complete C header file. The automatic opening of the font folder can also be disabled within the Processing sketch. (Thanks to Pierre-Loup Martin).
|
||||
|
||||
2. New board setup files have been added for the Seeed XIAO with round display, LilyGo T-Embed S3, LilyGo_T_QT_Pro_S3, ESP32 S3 Box and ESP32_S3_Box_Lite. The "RPi" interface style boards are now supported with the ESP32 S3.
|
||||
|
||||
3. New functions have been added to draw smooth (antialiased) arcs, circles, and rounded rectangle outlines. New sketches are provided in the "Smooth Graphics" examples folder. Arcs can be drawn with or without anti-aliasing (which will then render faster). The arc ends can be straight or rounded. The arc drawing algorithm uses an optimised fixed point sqrt() function to improve performance on processors that do not have a hardware Floating Point Unit (e.g. RP2040). Here are two demo images, on the left smooth (anti-aliased) arcs with rounded ends, the image to the right is the same resolution (grabbed from the same 240x240 TFT) with the smoothing diasbled (no anti-aliasing):
|
||||
|
||||
 
|
||||
|
||||
|
|
@ -8,17 +12,17 @@ A ["Discussions"](https://github.com/Bodmer/TFT_eSPI/discussions) facility has b
|
|||
|
||||

|
||||
|
||||
2. An excellent new compatible library is available which can render TrueType fonts on a TFT screen (or into a sprite). This has been developed by [takkaO](https://github.com/takkaO/OpenFontRender), I have created a branch with some bug fixes [here](https://github.com/Bodmer/OpenFontRender). The library provides access to compact font files, with fully scaleable anti-aliased glyphs. Left, middle and right justified text can also be printed to the screen. I have added TFT_eSPI specific examples to the OpenFontRender library and tested on RP2040 and ESP32 processors, the ESP8266 does not have sufficient RAM due to the glyph render complexity. Here is a demo screen where a single 12kbyte font file binary was used to render fully anti-aliased glyphs of gradually increasing size on a 320x480 TFT screen:
|
||||
4. An excellent new compatible library is available which can render TrueType fonts on a TFT screen (or into a sprite). This has been developed by [takkaO](https://github.com/takkaO/OpenFontRender). The library provides access to compact font files, with fully scaleable anti-aliased glyphs. Left, middle and right justified text can also be printed to the screen. I have added TFT_eSPI specific examples to the OpenFontRender library and tested on RP2040 and ESP32 processors, the ESP8266 does not have sufficient RAM due to the glyph render complexity. Here is a demo screen where a single 12kbyte font file binary was used to render fully anti-aliased glyphs of gradually increasing size on a 320x480 TFT screen:
|
||||
|
||||

|
||||
|
||||
3. New GUI examples have been added for sliders, buttons, graphs and meters. These examples require a new support library here:
|
||||
5. New GUI examples have been added for sliders, buttons, graphs and meters. These examples require a new support library here:
|
||||
|
||||
[TFT_eWidget](https://github.com/Bodmer/TFT_eWidget)
|
||||
|
||||
4. Support has been added in v2.4.70 for the RP2040 with 16 bit parallel displays. This has been tested and the screen update performance is very good (4ms to clear 320 x 480 screen with HC8357C). The use of the RP2040 PIO makes it easy to change the write cycle timing for different displays. DMA with 16 bit transfers is also supported.
|
||||
6. Support has been added in v2.4.70 for the RP2040 with 16 bit parallel displays. This has been tested and the screen update performance is very good (4ms to clear 320 x 480 screen with HC8357C). The use of the RP2040 PIO makes it easy to change the write cycle timing for different displays. DMA with 16 bit transfers is also supported.
|
||||
|
||||
5. Support for the ESP32-S2, ESP32-S3 and ESP32-C3 has been added (DMA only on ESP32 S3 at the moment). Tested with v2.0.3 RC1 of the ESP32 board package. Example setups:
|
||||
7. Support for the ESP32-S2, ESP32-S3 and ESP32-C3 has been added (DMA only on ESP32 S3 at the moment). Tested with v2.0.3 RC1 of the ESP32 board package. Example setups:
|
||||
|
||||
[Setup70_ESP32_S2_ILI9341.h](https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup70_ESP32_S2_ILI9341.h)
|
||||
|
||||
|
|
@ -28,18 +32,18 @@ A ["Discussions"](https://github.com/Bodmer/TFT_eSPI/discussions) facility has b
|
|||
|
||||
[Setup70d_ILI9488_S3_Parallel.h](https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup70d_ILI9488_S3_Parallel.h)
|
||||
|
||||
6. Smooth fonts can now be rendered direct to the TFT with very little flicker for quickly changing values. This is achieved by a line-by-line and block-by-block update of the glyph area without drawing pixels twice. This is a "breaking" change for some sketches because a new true/false parameter is needed to render the background. The default is false if the parameter is missing, Examples:
|
||||
8. Smooth fonts can now be rendered direct to the TFT with very little flicker for quickly changing values. This is achieved by a line-by-line and block-by-block update of the glyph area without drawing pixels twice. This is a "breaking" change for some sketches because a new true/false parameter is needed to render the background. The default is false if the parameter is missing, Examples:
|
||||
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLUE, true);
|
||||
spr.setTextColor(TFT_BLUE, TFT_BLACK, true);
|
||||
|
||||
Note: background rendering for Smooth fonts is also now available when using the print stream e.g. with: tft.println("Hello World");
|
||||
|
||||
7. New anti-aliased graphics functions to draw lines, wedge shaped lines, circles and rounded rectangles. [Examples are included](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Smooth%20Graphics). Examples have also been added to [display PNG compressed images](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/PNG%20Images) (note: requires ~40kbytes RAM).
|
||||
9. New anti-aliased graphics functions to draw lines, wedge shaped lines, circles and rounded rectangles. [Examples are included](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/Smooth%20Graphics). Examples have also been added to [display PNG compressed images](https://github.com/Bodmer/TFT_eSPI/tree/master/examples/PNG%20Images) (note: requires ~40kbytes RAM).
|
||||
|
||||
8. Users of PowerPoint experienced with running macros may be interested in the [pptm sketch generator here](https://github.com/Bodmer/PowerPoint_to_sketch), this converts graphics and tables drawn in PowerPoint slides into an Arduino sketch that renders the graphics on a 480x320 TFT. This is based on VB macros [created by Kris Kasprzak here](https://github.com/KrisKasprzak/Powerpoint-ILI9341_t3).
|
||||
10. Users of PowerPoint experienced with running macros may be interested in the [pptm sketch generator here](https://github.com/Bodmer/PowerPoint_to_sketch), this converts graphics and tables drawn in PowerPoint slides into an Arduino sketch that renders the graphics on a 480x320 TFT. This is based on VB macros [created by Kris Kasprzak here](https://github.com/KrisKasprzak/Powerpoint-ILI9341_t3).
|
||||
|
||||
9. The library contains two new functions for rectangles filled with a horizontal or vertical coloured gradient:
|
||||
11. The library contains two new functions for rectangles filled with a horizontal or vertical coloured gradient:
|
||||
|
||||
tft.fillRectHGradient(x, y, w, h, color1, color2);
|
||||
|
||||
|
|
@ -47,16 +51,11 @@ Note: background rendering for Smooth fonts is also now available when using the
|
|||
|
||||

|
||||
|
||||
10. The RP2040 8 bit parallel interface uses the PIO. The PIO now manages the "setWindow" and "block fill" actions, releasing the processor for other tasks when areas of the screen are being filled with a colour. The PIO can optionally be used for SPI interface displays if #define RP2040_PIO_SPI is put in the setup file. Touch screens and pixel read operations are not supported when the PIO interface is used.
|
||||
12. The RP2040 8 bit parallel interface uses the PIO. The PIO now manages the "setWindow" and "block fill" actions, releasing the processor for other tasks when areas of the screen are being filled with a colour. The PIO can optionally be used for SPI interface displays if #define RP2040_PIO_SPI is put in the setup file. Touch screens and pixel read operations are not supported when the PIO interface is used.
|
||||
The RP2040 PIO features only work with [Earle Philhower's board package](https://github.com/earlephilhower/arduino-pico), NOT the Arduino Mbed version.
|
||||
|
||||
The use of PIO for SPI allows the RP2040 to be over-clocked (up to 250MHz works on my boards) in Earle's board package whilst still maintaining high SPI clock rates.
|
||||
|
||||
11. DMA can now be used with the Raspberry Pi Pico (RP2040) when used with 8/16 bit parallel and 16 bit colour SPI displays. See "Bouncy_Circles" sketch.
|
||||
|
||||
["Bouncing circles"](https://www.youtube.com/watch?v=njFXIzCTQ_Q&lc=UgymaUIwOIuihvYh-Qt4AaABAg)
|
||||
|
||||
|
||||
# TFT_eSPI
|
||||
|
||||
A feature rich Arduino IDE compatible graphics and fonts library for 32 bit processors. The library is targeted at 32 bit processors, it has been performance optimised for RP2040, STM32, ESP8266 and ESP32 types, other 32 bit processors may be used but will use the slower generic Arduino interface calls. The library can be loaded using the Arduino IDE's Library Manager. Direct Memory Access (DMA) can be used with the ESP32, RP2040 and STM32 processors with SPI interface displays to improve rendering performance. DMA with a parallel interface (8 and 16 bit) is only supported with the RP2040.
|
||||
|
|
@ -89,7 +88,9 @@ The library supports the following interface types for these processors:
|
|||
|
||||
For other (generic) processors only SPI interface displays are supported and the slower Arduino SPI library functions are used by the library. Higher clock speed processors such as used for the Teensy 3.x and 4.x boards will still provide a very good performance with the generic Arduino SPI functions.
|
||||
|
||||
Due to lack of GPIO pins the 8 bit parallel interface is NOT supported on the ESP8266. 8 bit parallel interface TFTs (e.g. UNO format mcufriend shields) can used with the STM32 Nucleo 64/144 range or the UNO format ESP32 (see below for ESP32).
|
||||
4 wire SPI means the display must have SPI interface comaptible signals and a "Data/Command" control signal, this signal line is sometimes labelled DC, RS or A0.
|
||||
|
||||
Due to lack of GPIO pins the 8 bit parallel interface is NOT supported on the ESP8266. 8 bit parallel interface TFTs (e.g. UNO format mcufriend shields) can used with the STM32Fxxx Nucleo 64/144 range or the UNO format ESP32 (see below for ESP32).
|
||||
|
||||
Support for the XPT2046 touch screen controller is built into the library and can be used with SPI interface displays. Third party touch support libraries are also available when using a display parallel interface.
|
||||
|
||||
|
|
@ -124,8 +125,6 @@ A "good" RPi display is the [MHS-4.0 inch Display-B type ST7796](http://www.lcdw
|
|||
|
||||
Some displays permit the internal TFT screen RAM to be read, a few of the examples use this feature. The TFT_Screen_Capture example allows full screens to be captured and sent to a PC, this is handy to create program documentation.
|
||||
|
||||
The library supports Waveshare 2 and 3 colour ePaper displays using full frame buffers. This addition is relatively immature and thus only one example has been provided.
|
||||
|
||||
The library includes a "Sprite" class, this enables flicker free updates of complex graphics. Direct writes to the TFT with graphics functions are still available, so existing sketches do not need to be changed.
|
||||
|
||||
# Sprites
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#define TFT_HEIGHT 240
|
||||
#endif
|
||||
|
||||
// Delay between some initialisation commands
|
||||
|
|
|
|||
|
|
@ -9,20 +9,48 @@
|
|||
writedata(TFT_MAD_BGR);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 2;
|
||||
rowstart = 1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1: // Landscape (Portrait + 90)
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 1;
|
||||
rowstart = 2;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 2: // Inverter portrait
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 2;
|
||||
rowstart = 1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 3: // Inverted landscape
|
||||
writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 128)
|
||||
{
|
||||
colstart = 1;
|
||||
rowstart = 2;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
// Change the width and height if required (defined in portrait mode)
|
||||
// or use the constructor to over-ride defaults
|
||||
#define TFT_WIDTH 280
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 320
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 480
|
||||
#endif
|
||||
|
||||
// Generic commands used by TFT_eSPI.cpp
|
||||
#define TFT_NOP 0x00
|
||||
|
|
|
|||
|
|
@ -9,21 +9,49 @@
|
|||
writedata(TFT_MAD_MX | TFT_MAD_COLOR_ORDER);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 222)
|
||||
{
|
||||
colstart = 49;
|
||||
rowstart = 0;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
writedata(TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 222)
|
||||
{
|
||||
colstart = 0;
|
||||
rowstart = 49;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
writedata(TFT_MAD_MY | TFT_MAD_COLOR_ORDER);
|
||||
_width = _init_width;
|
||||
_height = _init_height;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 222)
|
||||
{
|
||||
colstart = 49;
|
||||
rowstart = 0;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 3:
|
||||
writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_COLOR_ORDER);
|
||||
_width = _init_height;
|
||||
_height = _init_width;
|
||||
#ifdef CGRAM_OFFSET
|
||||
if (_init_width == 222)
|
||||
{
|
||||
colstart = 0;
|
||||
rowstart = 49;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
// These next rotations are for bottom up BMP drawing
|
||||
case 4:
|
||||
|
|
|
|||
|
|
@ -23,6 +23,14 @@
|
|||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
/***************************************************************************************
|
||||
** Others
|
||||
***************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DISABLE_WARNINGS
|
||||
#define DISABLE_ALL_LIBRARY_WARNINGS
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
** TFT_eSPI Configuration defines
|
||||
***************************************************************************************/
|
||||
|
|
@ -137,7 +145,9 @@
|
|||
#endif
|
||||
|
||||
#if CONFIG_TFT_RST == -1
|
||||
#error "Invalid Reset pin. Check TFT_eSPI configuration"
|
||||
#if !defined(DISABLE_ALL_LIBRARY_WARNINGS)
|
||||
#warning "Invalid Reset pin. Check TFT_eSPI configuration"
|
||||
#endif
|
||||
#else
|
||||
#define TFT_RST CONFIG_TFT_RST
|
||||
#endif
|
||||
|
|
@ -307,12 +317,4 @@
|
|||
#define SPI_TOUCH_FREQUENCY CONFIG_SPI_TOUCH_FREQUENCY
|
||||
#endif
|
||||
|
||||
/***************************************************************************************
|
||||
** Section 6: Others
|
||||
***************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_DISABLE_WARNINGS
|
||||
#define DISABLE_ALL_LIBRARY_WARNINGS
|
||||
#endif
|
||||
|
||||
#endif // TFT_CONFIG_H
|
||||
|
|
|
|||
|
|
@ -4498,8 +4498,8 @@ void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, f
|
|||
int32_t xs = x0;
|
||||
// Scan bounding box from ys down, calculate pixel intensity from distance to line
|
||||
for (int32_t yp = ys; yp <= y1; yp++) {
|
||||
char swin = false; // Flag to start new window area
|
||||
char endX = false; // Flag to skip pixels
|
||||
bool swin = true; // Flag to start new window area
|
||||
bool endX = false; // Flag to skip pixels
|
||||
ypay = yp - ay;
|
||||
for (int32_t xp = xs; xp <= x1; xp++) {
|
||||
if (endX) if (alpha <= LoAlphaTheshold) break; // Skip right side
|
||||
|
|
@ -4520,11 +4520,11 @@ void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, f
|
|||
//Blend color with background and plot
|
||||
if (bg_color == 0x00FFFFFF) {
|
||||
bg = readPixel(xp, yp); swin = true;
|
||||
if(!swin);
|
||||
}
|
||||
#ifdef GC9A01_DRIVER
|
||||
uint16_t pcol = alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg);
|
||||
drawPixel(xp, yp, pcol);
|
||||
swin = swin;
|
||||
#else
|
||||
if (swin) { setWindow(xp, yp, x1, yp); swin = false; }
|
||||
pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
|
|
@ -4558,11 +4558,11 @@ void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, f
|
|||
//Blend colour with background and plot
|
||||
if (bg_color == 0x00FFFFFF) {
|
||||
bg = readPixel(xp, yp); swin = true;
|
||||
if(!swin);
|
||||
}
|
||||
#ifdef GC9A01_DRIVER
|
||||
uint16_t pcol = alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg);
|
||||
drawPixel(xp, yp, pcol);
|
||||
swin = swin;
|
||||
#else
|
||||
if (swin) { setWindow(xp, yp, x1, yp); swin = false; }
|
||||
pushColor(alphaBlend((uint8_t)(alpha * PixelAlphaGain), fg_color, bg));
|
||||
|
|
@ -4973,7 +4973,10 @@ uint16_t TFT_eSPI::decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining)
|
|||
** Function name: alphaBlend
|
||||
** Description: Blend 16bit foreground and background
|
||||
*************************************************************************************x*/
|
||||
inline uint16_t TFT_eSPI::alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc)
|
||||
#ifndef STM32
|
||||
inline
|
||||
#endif
|
||||
uint16_t TFT_eSPI::alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc)
|
||||
{
|
||||
// Split out and blend 5 bit red and blue channels
|
||||
uint32_t rxb = bgc & 0xF81F;
|
||||
|
|
@ -5933,7 +5936,7 @@ void TFT_eSPI::setTextFont(uint8_t f)
|
|||
** Function name: getSPIinstance
|
||||
** Description: Get the instance of the SPI class
|
||||
***************************************************************************************/
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && ! defined (RP2040_PIO_INTERFACE)
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_INTERFACE)
|
||||
SPIClass& TFT_eSPI::getSPIinstance(void)
|
||||
{
|
||||
return spi;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#ifndef _TFT_eSPIH_
|
||||
#define _TFT_eSPIH_
|
||||
|
||||
#define TFT_ESPI_VERSION "2.5.23"
|
||||
#define TFT_ESPI_VERSION "2.5.31"
|
||||
|
||||
// Bit level feature flags
|
||||
// Bit 0 set: viewport capability
|
||||
|
|
@ -29,8 +29,9 @@
|
|||
//Standard support
|
||||
#include <Arduino.h>
|
||||
#include <Print.h>
|
||||
#include <SPI.h>
|
||||
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_INTERFACE)
|
||||
#include <SPI.h>
|
||||
#endif
|
||||
/***************************************************************************************
|
||||
** Section 2: Load library and processor specific header files
|
||||
***************************************************************************************/
|
||||
|
|
@ -680,8 +681,8 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
|||
textWidth(const char *string), // Returns pixel width of string in current font
|
||||
textWidth(const String& string, uint8_t font), // As above for String types
|
||||
textWidth(const String& string),
|
||||
fontHeight(int16_t font), // Returns pixel height of string in specified font
|
||||
fontHeight(void); // Returns pixel width of string in current font
|
||||
fontHeight(int16_t font), // Returns pixel height of specified font
|
||||
fontHeight(void); // Returns pixel height of current font
|
||||
|
||||
// Used by library and Smooth font class to extract Unicode point codes from a UTF8 encoded string
|
||||
uint16_t decodeUTF8(uint8_t *buf, uint16_t *index, uint16_t remaining),
|
||||
|
|
@ -731,7 +732,12 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
|||
// Alpha blend 2 colours, see generic "alphaBlend_Test" example
|
||||
// alpha = 0 = 100% background colour
|
||||
// alpha = 255 = 100% foreground colour
|
||||
inline uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc);
|
||||
#ifdef STM32
|
||||
uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc);
|
||||
#else
|
||||
inline
|
||||
uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc);
|
||||
#endif
|
||||
// 16 bit colour alphaBlend with alpha dither (dither reduces colour banding)
|
||||
uint16_t alphaBlend(uint8_t alpha, uint16_t fgc, uint16_t bgc, uint8_t dither);
|
||||
// 24 bit colour alphaBlend with optional alpha dither
|
||||
|
|
@ -818,8 +824,9 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
|||
bool verifySetupID(uint32_t id);
|
||||
|
||||
// Global variables
|
||||
#if !defined (TFT_PARALLEL_8_BIT) && !defined (RP2040_PIO_INTERFACE)
|
||||
static SPIClass& getSPIinstance(void); // Get SPI class handle
|
||||
|
||||
#endif
|
||||
uint32_t textcolor, textbgcolor; // Text foreground and background colours
|
||||
|
||||
uint32_t bitmap_fg, bitmap_bg; // Bitmap foreground (bit=1) and background (bit=0) colours
|
||||
|
|
@ -967,7 +974,7 @@ class TFT_eSPI : public Print { friend class TFT_eSprite; // Sprite class has ac
|
|||
#endif
|
||||
#else
|
||||
#if !defined(DISABLE_ALL_LIBRARY_WARNINGS)
|
||||
//#warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available!
|
||||
#warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available!
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -134,11 +134,17 @@ String fontType = ".ttf";
|
|||
|
||||
|
||||
// Define the font size in points for the TFT_eSPI font file
|
||||
int fontSize = 20;
|
||||
int fontSize = 28;
|
||||
|
||||
// Font size to use in the Processing sketch display window that pops up (can be different to above)
|
||||
int displayFontSize = 28;
|
||||
|
||||
// Create a C header (.h file) ready to be used or copied in your sketch folder
|
||||
boolean createHeaderFile = true;
|
||||
|
||||
// Automaticely open the folder with created files when done
|
||||
boolean openFolder = true;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Next we specify which unicode blocks from the the Basic Multilingual Plane (BMP) are included in the final font file. //
|
||||
// Note: The ttf/otf font file MAY NOT contain all possible Unicode characters, refer to the fonts online documentation. //
|
||||
|
|
@ -392,7 +398,7 @@ void setup() {
|
|||
// Set the fontName from the array number or the defined fontName
|
||||
if (fontNumber >= 0)
|
||||
{
|
||||
fontName = fontList[fontNumber];
|
||||
// fontName = fontList[fontNumber];
|
||||
fontType = "";
|
||||
}
|
||||
|
||||
|
|
@ -499,11 +505,13 @@ void setup() {
|
|||
|
||||
println("Created font " + fontName + str(fontSize) + ".vlw");
|
||||
|
||||
String fontFileName = "FontFiles/" + fontName + str(fontSize) + ".vlw";
|
||||
|
||||
// creating file
|
||||
try {
|
||||
print("Saving to sketch FontFiles folder... ");
|
||||
|
||||
OutputStream output = createOutput("FontFiles/" + fontName + str(fontSize) + ".vlw");
|
||||
OutputStream output = createOutput(fontFileName);
|
||||
font.save(output);
|
||||
output.close();
|
||||
|
||||
|
|
@ -513,11 +521,50 @@ void setup() {
|
|||
|
||||
// Open up the FontFiles folder to access the saved file
|
||||
String path = sketchPath();
|
||||
Desktop.getDesktop().open(new File(path+"/FontFiles"));
|
||||
if(openFolder){
|
||||
Desktop.getDesktop().open(new File(path+"/FontFiles"));
|
||||
}
|
||||
|
||||
System.err.println("All done! Note: Rectangles are displayed for non-existant characters.");
|
||||
}
|
||||
catch(IOException e) {
|
||||
println("Doh! Failed to create the file");
|
||||
}
|
||||
|
||||
if(!createHeaderFile) return;
|
||||
// Now creating header file if the option was specified.
|
||||
try{
|
||||
print("saving header file to FontFile folder...");
|
||||
|
||||
InputStream input = createInputRaw(fontFileName);
|
||||
PrintWriter output = createWriter("FontFiles/" + fontName + str(fontSize) + ".h");
|
||||
|
||||
output.println("#include <pgmspace.h>");
|
||||
output.println();
|
||||
output.println("const uint8_t " + fontName + str(fontSize) + "[] PROGMEM = {");
|
||||
|
||||
int i = 0;
|
||||
int data = input.read();
|
||||
while(data != -1){
|
||||
output.print("0x");
|
||||
output.print(hex(data, 2));
|
||||
if(i++ < 15){
|
||||
output.print(", ");
|
||||
} else {
|
||||
output.println(",");
|
||||
i = 0;
|
||||
}
|
||||
data = input.read();
|
||||
}
|
||||
// font.save(output);
|
||||
output.println("\n};");
|
||||
|
||||
output.close();
|
||||
input.close();
|
||||
|
||||
println("C header file created.");
|
||||
|
||||
} catch(IOException e){
|
||||
println("Failed to create C header file");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
|
@ -84,6 +84,7 @@
|
|||
// #define TFT_WIDTH 80
|
||||
// #define TFT_WIDTH 128
|
||||
// #define TFT_WIDTH 172 // ST7789 172 x 320
|
||||
// #define TFT_WIDTH 170 // ST7789 170 x 320
|
||||
// #define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
|
||||
// #define TFT_HEIGHT 160
|
||||
// #define TFT_HEIGHT 128
|
||||
|
|
@ -166,10 +167,15 @@
|
|||
// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR ESP8266 SETUP ######
|
||||
|
||||
// For NodeMCU - use pin numbers in the form PIN_Dx where Dx is the NodeMCU pin designation
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
#define TFT_DC PIN_D3 // Data Command control pin
|
||||
#define TFT_RST PIN_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
|
||||
#define TFT_MISO PIN_D6 // Automatically assigned with ESP8266 if not defined
|
||||
#define TFT_MOSI PIN_D7 // Automatically assigned with ESP8266 if not defined
|
||||
#define TFT_SCLK PIN_D5 // Automatically assigned with ESP8266 if not defined
|
||||
|
||||
#define TFT_CS PIN_D8 // Chip select control pin D8
|
||||
#define TFT_DC PIN_D3 // Data Command control pin
|
||||
#define TFT_RST PIN_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
|
||||
|
||||
|
||||
//#define TFT_BL PIN_D1 // LED back-light (only for ST7789 with backlight control pin)
|
||||
|
||||
|
|
@ -327,7 +333,7 @@
|
|||
// For RP2040 processor and 8 or 16 bit parallel displays:
|
||||
// The parallel interface write cycle period is derived from a division of the CPU clock
|
||||
// speed so scales with the processor clock. This means that the divider ratio may need
|
||||
// to be increased when overclocking. I may also need to be adjusted dependant on the
|
||||
// to be increased when overclocking. It may also need to be adjusted dependant on the
|
||||
// display controller type (ILI94341, HX8357C etc). If RP2040_PIO_CLK_DIV is not defined
|
||||
// the library will set default values which may not suit your display.
|
||||
// The display controller data sheet will specify the minimum write cycle period. The
|
||||
|
|
|
|||
|
|
@ -12,14 +12,11 @@
|
|||
// Create a shortcut to this file on your desktop to permit quick access for editing.
|
||||
// Re-compile and upload after making and saving any changes to this file.
|
||||
|
||||
// Customised User_Setup files are stored in the "User_Setups" folder.
|
||||
|
||||
// It is also possible for the user tft settings to be included with the sketch, see
|
||||
// the "Sketch_with_tft_setup" generic example. This may be more convenient for
|
||||
// multiple projects.
|
||||
// Example User_Setup files are stored in the "User_Setups" folder. These can be used
|
||||
// unmodified or adapted for a particular hardware configuration.
|
||||
|
||||
#ifndef USER_SETUP_LOADED // Lets PlatformIO users define settings in
|
||||
// platformio.ini, see notes in "Tools" folder.
|
||||
// platformio.ini, see notes in "Tools" folder.
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// User configuration selection lines are below //
|
||||
|
|
@ -27,7 +24,7 @@
|
|||
|
||||
// Only ONE line below should be uncommented to define your setup. Add extra lines and files as needed.
|
||||
|
||||
// #include <User_Setup.h> // Default setup is root library folder
|
||||
#include <User_Setup.h> // Default setup is root library folder
|
||||
|
||||
//#include <User_Setups/Setup1_ILI9341.h> // Setup file for ESP8266 configured for my ILI9341
|
||||
//#include <User_Setups/Setup2_ST7735.h> // Setup file for ESP8266 configured for my ST7735
|
||||
|
|
@ -49,7 +46,7 @@
|
|||
//#include <User_Setups/Setup17_ePaper.h> // Setup file for ESP8266 and any Waveshare ePaper display
|
||||
//#include <User_Setups/Setup18_ST7789.h> // Setup file for ESP8266 configured for ST7789
|
||||
|
||||
//#include <User_Setups/Setup19_RM68140_Parallel.h> // Setup file configured for RM68140 with parallel bus
|
||||
//#include <User_Setups/Setup19_RM68140_Parallel.h> // Setup file configured for RM68140 with parallel bus
|
||||
|
||||
//#include <User_Setups/Setup20_ILI9488.h> // Setup file for ESP8266 and ILI9488 SPI bus TFT
|
||||
//#include <User_Setups/Setup21_ILI9488.h> // Setup file for ESP32 and ILI9488 SPI bus TFT
|
||||
|
|
@ -89,9 +86,11 @@
|
|||
//#include <User_Setups/Setup51_LilyPi_ILI9481.h> // Setup file for LilyGo LilyPi with ILI9481 display
|
||||
//#include <User_Setups/Setup52_LilyPi_ST7796.h> // Setup file for LilyGo LilyPi with ST7796 display
|
||||
|
||||
//#include <User_Setups/Setup60_RP2040_ILI9341.h> // Setup file for RP2040 with SPI ILI9341
|
||||
//#include <User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h> // Setup file for RP2040 with PIO SPI ILI9341
|
||||
//#include <User_Setups/Setup62_RP2040_Nano_Connect_ILI9341.h> // Setup file for RP2040 with SPI ILI9341
|
||||
//#include <User_Setups/Setup60_RP2040_ILI9341.h> // Setup file for RP2040 with SPI ILI9341
|
||||
//#include <User_Setups/Setup61_RP2040_ILI9341_PIO_SPI.h> // Setup file for RP2040 with PIO SPI ILI9341
|
||||
//#include <User_Setups/Setup62_RP2040_Nano_Connect_ILI9341.h> // Setup file for RP2040 with SPI ILI9341
|
||||
|
||||
//#include <User_Setups/Setup66_Seeed_XIAO_Round.h> // Setup file for Seeed XIAO with GC9A01 240x240
|
||||
|
||||
//#include <User_Setups/Setup70_ESP32_S2_ILI9341.h> // Setup file for ESP32 S2 with SPI ILI9341
|
||||
//#include <User_Setups/Setup70b_ESP32_S3_ILI9341.h> // Setup file for ESP32 S3 with SPI ILI9341
|
||||
|
|
@ -124,32 +123,36 @@
|
|||
|
||||
//#include <User_Setups/Setup202_SSD1351_128.h> // Setup file for ESP32/ESP8266 based SSD1351 128x128 1.5inch OLED display
|
||||
|
||||
//#include <User_Setups/Setup203_ST7789.h> // Setup file for ESP32/ESP8266 based ST7789 240X280 1.69inch TFT
|
||||
//#include <User_Setups/Setup203_ST7789.h> // Setup file for ESP32/ESP8266 based ST7789 240X280 1.69inch TFT
|
||||
|
||||
//#include <User_Setups/Setup204_ESP32_TouchDown.h> // Setup file for the ESP32 TouchDown based on ILI9488 480 x 320 TFT
|
||||
//#include <User_Setups/Setup204_ESP32_TouchDown.h> // Setup file for the ESP32 TouchDown based on ILI9488 480 x 320 TFT
|
||||
|
||||
//#include <User_Setups/Setup205_ESP32_TouchDown_S3.h> // Setup file for the ESP32 TouchDown S3 based on ILI9488 480 x 320 TFT
|
||||
|
||||
//#include <User_Setups/Setup206_LilyGo_T_Display_S3.h>
|
||||
//#include <User_Setups/Setup200_GC9A01.h>
|
||||
#include <User_Setups/Setup217_LilyGo_T_Beam_ST7796_Shiled.h>
|
||||
//#include <User_Setups/Setup208_ESP32_S3_Box_Lite.h> // For the ESP32 S3 Box Lite (may also work with ESP32 S3 Box)
|
||||
//#include <User_Setups/Setup205_ESP32_TouchDown_S3.h> // Setup file for the ESP32 TouchDown S3 based on ILI9488 480 x 320 TFT
|
||||
|
||||
//#include <User_Setups/Setup206_LilyGo_T_Display_S3.h> // For the LilyGo T-Display S3 based ESP32S3 with ST7789 170 x 320 TFT
|
||||
//#include <User_Setups/Setup207_LilyGo_T_HMI.h> // For the LilyGo T-HMI S3 based ESP32S3 with ST7789 240 x 320 TFT
|
||||
//#include <User_Setups/Setup209_LilyGo_T_Dongle_S3.h> // For the LilyGo T-Dongle S3 based ESP32 with ST7735 80 x 160 TFT
|
||||
//#include <User_Setups/Setup210_LilyGo_T_Embed_S3.h> // For the LilyGo T-Embed S3 based ESP32S3 with ST7789 170 x 320 TFT
|
||||
//#include <User_Setups/Setup211_LilyGo_T_QT_Pro_S3.h> // For the LilyGo T-QT Pro S3 based ESP32S3 with GC9A01 128 x 128 TFT
|
||||
// #include <User_Setups/Setup212_LilyGo_T_PicoPro.h> // For the LilyGo T-PICO-Pro with ST7796 222 x 480 TFT
|
||||
// #include <User_Setups/Setup213_LilyGo_T_Beam_Shield.h> // For the LilyGo T-BEAM V1.x with ST7796 222 x 480 TFT
|
||||
|
||||
//#include <User_Setups/Setup250_ESP32_S3_Box_Lite.h> // For the ESP32 S3 Box Lite
|
||||
//#include <User_Setups/Setup251_ESP32_S3_Box.h> // For the ESP32 S3 Box
|
||||
|
||||
//#include <User_Setups/Setup301_BW16_ST7735.h> // Setup file for Bw16-based boards with ST7735 160 x 80 TFT
|
||||
|
||||
//#include <User_Setups/SetupX_Template.h> // Template file for a setup
|
||||
|
||||
|
||||
//#include <User_Setups/Dustin_ILI9488.h> // Setup file for Dustin Watts PCB with ILI9488
|
||||
//#include <User_Setups/Dustin_ILI9488.h> // Setup file for Dustin Watts PCB with ILI9488
|
||||
//#include <User_Setups/Dustin_ST7796.h> // Setup file for Dustin Watts PCB with ST7796
|
||||
//#include <User_Setups/Dustin_ILI9488_Pico.h> // Setup file for Dustin Watts Pico PCB with ST7796
|
||||
//#include <User_Setups/Dustin_ST7789_Pico.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_Pico.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_ESP32.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_STT7789_ESP32.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_ILI9341_ESP32.h> // Setup file for Dustin Watts PCB with ILI9341
|
||||
//#include <User_Setups/Dustin_ILI9488_Pico.h> // Setup file for Dustin Watts Pico PCB with ST7796
|
||||
//#include <User_Setups/Dustin_ST7789_Pico.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_Pico.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_GC9A01_ESP32.h> // Setup file for Dustin Watts PCB with GC9A01 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_STT7789_ESP32.h> // Setup file for Dustin Watts PCB with ST7789 240 x 240 on 3.3V adapter board
|
||||
//#include <User_Setups/Dustin_ILI9341_ESP32.h> // Setup file for Dustin Watts PCB with ILI9341
|
||||
//#include <User_Setups/ILI9225.h>
|
||||
|
||||
#endif // USER_SETUP_LOADED
|
||||
|
|
@ -170,110 +173,110 @@
|
|||
|
||||
// Legacy setup support, RPI_DISPLAY_TYPE replaces RPI_DRIVER
|
||||
#if defined (RPI_DRIVER)
|
||||
#if !defined (RPI_DISPLAY_TYPE)
|
||||
#define RPI_DISPLAY_TYPE
|
||||
#endif
|
||||
#if !defined (RPI_DISPLAY_TYPE)
|
||||
#define RPI_DISPLAY_TYPE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Legacy setup support, RPI_ILI9486_DRIVER form is deprecated
|
||||
// Instead define RPI_DISPLAY_TYPE and also define driver (e.g. ILI9486_DRIVER)
|
||||
// Instead define RPI_DISPLAY_TYPE and also define driver (e.g. ILI9486_DRIVER)
|
||||
#if defined (RPI_ILI9486_DRIVER)
|
||||
#if !defined (ILI9486_DRIVER)
|
||||
#define ILI9486_DRIVER
|
||||
#endif
|
||||
#if !defined (RPI_DISPLAY_TYPE)
|
||||
#define RPI_DISPLAY_TYPE
|
||||
#endif
|
||||
#if !defined (ILI9486_DRIVER)
|
||||
#define ILI9486_DRIVER
|
||||
#endif
|
||||
#if !defined (RPI_DISPLAY_TYPE)
|
||||
#define RPI_DISPLAY_TYPE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Invoke 18 bit colour for selected displays
|
||||
#if !defined (RPI_DISPLAY_TYPE) && !defined (TFT_PARALLEL_8_BIT) && !defined (TFT_PARALLEL_16_BIT) && !defined (ESP32_PARALLEL)
|
||||
#if defined (ILI9481_DRIVER) || defined (ILI9486_DRIVER) || defined (ILI9488_DRIVER)
|
||||
#define SPI_18BIT_DRIVER
|
||||
#endif
|
||||
#if defined (ILI9481_DRIVER) || defined (ILI9486_DRIVER) || defined (ILI9488_DRIVER)
|
||||
#define SPI_18BIT_DRIVER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Load the right driver definition - do not tinker here !
|
||||
#if defined (ILI9341_DRIVER) || defined(ILI9341_2_DRIVER) || defined (ILI9342_DRIVER)
|
||||
#include <TFT_Drivers/ILI9341_Defines.h>
|
||||
#define TFT_DRIVER 0x9341
|
||||
#include <TFT_Drivers/ILI9341_Defines.h>
|
||||
#define TFT_DRIVER 0x9341
|
||||
#elif defined (ST7735_DRIVER)
|
||||
#include <TFT_Drivers/ST7735_Defines.h>
|
||||
#define TFT_DRIVER 0x7735
|
||||
#include <TFT_Drivers/ST7735_Defines.h>
|
||||
#define TFT_DRIVER 0x7735
|
||||
#elif defined (ILI9163_DRIVER)
|
||||
#include <TFT_Drivers/ILI9163_Defines.h>
|
||||
#define TFT_DRIVER 0x9163
|
||||
#include <TFT_Drivers/ILI9163_Defines.h>
|
||||
#define TFT_DRIVER 0x9163
|
||||
#elif defined (S6D02A1_DRIVER)
|
||||
#include <TFT_Drivers/S6D02A1_Defines.h>
|
||||
#define TFT_DRIVER 0x6D02
|
||||
#include <TFT_Drivers/S6D02A1_Defines.h>
|
||||
#define TFT_DRIVER 0x6D02
|
||||
#elif defined (ST7796_DRIVER)
|
||||
#include "TFT_Drivers/ST7796_Defines.h"
|
||||
#define TFT_DRIVER 0x7796
|
||||
#include "TFT_Drivers/ST7796_Defines.h"
|
||||
#define TFT_DRIVER 0x7796
|
||||
#elif defined (ILI9486_DRIVER)
|
||||
#include <TFT_Drivers/ILI9486_Defines.h>
|
||||
#define TFT_DRIVER 0x9486
|
||||
#include <TFT_Drivers/ILI9486_Defines.h>
|
||||
#define TFT_DRIVER 0x9486
|
||||
#elif defined (ILI9481_DRIVER)
|
||||
#include <TFT_Drivers/ILI9481_Defines.h>
|
||||
#define TFT_DRIVER 0x9481
|
||||
#include <TFT_Drivers/ILI9481_Defines.h>
|
||||
#define TFT_DRIVER 0x9481
|
||||
#elif defined (ILI9488_DRIVER)
|
||||
#include <TFT_Drivers/ILI9488_Defines.h>
|
||||
#define TFT_DRIVER 0x9488
|
||||
#include <TFT_Drivers/ILI9488_Defines.h>
|
||||
#define TFT_DRIVER 0x9488
|
||||
#elif defined (HX8357D_DRIVER)
|
||||
#include "TFT_Drivers/HX8357D_Defines.h"
|
||||
#define TFT_DRIVER 0x8357
|
||||
#include "TFT_Drivers/HX8357D_Defines.h"
|
||||
#define TFT_DRIVER 0x8357
|
||||
#elif defined (EPD_DRIVER)
|
||||
#include "TFT_Drivers/EPD_Defines.h"
|
||||
#define TFT_DRIVER 0xE9D
|
||||
#include "TFT_Drivers/EPD_Defines.h"
|
||||
#define TFT_DRIVER 0xE9D
|
||||
#elif defined (ST7789_DRIVER)
|
||||
#include "TFT_Drivers/ST7789_Defines.h"
|
||||
#define TFT_DRIVER 0x7789
|
||||
#include "TFT_Drivers/ST7789_Defines.h"
|
||||
#define TFT_DRIVER 0x7789
|
||||
#elif defined (R61581_DRIVER)
|
||||
#include "TFT_Drivers/R61581_Defines.h"
|
||||
#define TFT_DRIVER 0x6158
|
||||
#include "TFT_Drivers/R61581_Defines.h"
|
||||
#define TFT_DRIVER 0x6158
|
||||
#elif defined (ST7789_2_DRIVER)
|
||||
#include "TFT_Drivers/ST7789_2_Defines.h"
|
||||
#define TFT_DRIVER 0x778B
|
||||
#include "TFT_Drivers/ST7789_2_Defines.h"
|
||||
#define TFT_DRIVER 0x778B
|
||||
#elif defined (RM68140_DRIVER)
|
||||
#include "TFT_Drivers/RM68140_Defines.h"
|
||||
#define TFT_DRIVER 0x6814
|
||||
#include "TFT_Drivers/RM68140_Defines.h"
|
||||
#define TFT_DRIVER 0x6814
|
||||
#elif defined (SSD1351_DRIVER)
|
||||
#include "TFT_Drivers/SSD1351_Defines.h"
|
||||
#define TFT_DRIVER 0x1351
|
||||
#include "TFT_Drivers/SSD1351_Defines.h"
|
||||
#define TFT_DRIVER 0x1351
|
||||
#elif defined (SSD1963_480_DRIVER)
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#elif defined (SSD1963_800_DRIVER)
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#elif defined (SSD1963_800ALT_DRIVER)
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#elif defined (SSD1963_800BD_DRIVER)
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#include "TFT_Drivers/SSD1963_Defines.h"
|
||||
#define TFT_DRIVER 0x1963
|
||||
#elif defined (GC9A01_DRIVER)
|
||||
#include "TFT_Drivers/GC9A01_Defines.h"
|
||||
#define TFT_DRIVER 0x9A01
|
||||
#include "TFT_Drivers/GC9A01_Defines.h"
|
||||
#define TFT_DRIVER 0x9A01
|
||||
#elif defined (ILI9225_DRIVER)
|
||||
#include "TFT_Drivers/ILI9225_Defines.h"
|
||||
#define TFT_DRIVER 0x9225
|
||||
#include "TFT_Drivers/ILI9225_Defines.h"
|
||||
#define TFT_DRIVER 0x9225
|
||||
#elif defined (RM68120_DRIVER)
|
||||
#include "TFT_Drivers/RM68120_Defines.h"
|
||||
#define TFT_DRIVER 0x6812
|
||||
#include "TFT_Drivers/RM68120_Defines.h"
|
||||
#define TFT_DRIVER 0x6812
|
||||
#elif defined (HX8357B_DRIVER)
|
||||
#include "TFT_Drivers/HX8357B_Defines.h"
|
||||
#define TFT_DRIVER 0x835B
|
||||
#include "TFT_Drivers/HX8357B_Defines.h"
|
||||
#define TFT_DRIVER 0x835B
|
||||
#elif defined (HX8357C_DRIVER)
|
||||
#include "TFT_Drivers/HX8357C_Defines.h"
|
||||
#define TFT_DRIVER 0x835C
|
||||
#include "TFT_Drivers/HX8357C_Defines.h"
|
||||
#define TFT_DRIVER 0x835C
|
||||
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVER HERE
|
||||
// XYZZY_init.h and XYZZY_rotation.h must also be added in TFT_eSPI.cpp
|
||||
// <<<<<<<<<<<<<<<<<<<<<<<< ADD NEW DRIVER HERE
|
||||
// XYZZY_init.h and XYZZY_rotation.h must also be added in TFT_eSPI.cpp
|
||||
#elif defined (XYZZY_DRIVER)
|
||||
#include "TFT_Drivers/XYZZY_Defines.h"
|
||||
#define TFT_DRIVER 0x0000
|
||||
#include "TFT_Drivers/XYZZY_Defines.h"
|
||||
#define TFT_DRIVER 0x0000
|
||||
#else
|
||||
#define TFT_DRIVER 0x0000
|
||||
#define TFT_DRIVER 0x0000
|
||||
#endif
|
||||
|
||||
// These are the pins for ESP8266 boards
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
//#define TFT_RD -1 // Do not define, read pin permanently connected to 3V3
|
||||
|
||||
// Note: All the following pins are PIO hardware configured and driven
|
||||
// The pins are hard-coded at the moment and must not be changed here
|
||||
// Connections MUST use the pins below
|
||||
#define TFT_WR 22
|
||||
|
||||
// PIO requires these to be sequentially increasing - do not change
|
||||
|
|
|
|||
|
|
@ -1,37 +1,32 @@
|
|||
// See SetupX_Template.h for all options available
|
||||
#define USER_SETUP_ID 200
|
||||
|
||||
#define GC9A01_DRIVER
|
||||
|
||||
//#include "TWatch_config.h"
|
||||
|
||||
// For ESP32 Dev board (only tested with GC9A01 display)
|
||||
// The hardware SPI can be mapped to any pins
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 240
|
||||
|
||||
#define TFT_MISO -1
|
||||
#define TFT_MOSI 13 // In some display driver board, it might be written as "SDA" and so on.
|
||||
#define TFT_MOSI 15 // In some display driver board, it might be written as "SDA" and so on.
|
||||
#define TFT_SCLK 14
|
||||
#define TFT_CS 15 // Chip select control pin
|
||||
#define TFT_DC 19 // Data Command control pin
|
||||
#define TFT_RST 27 // Reset pin (could connect to Arduino RESET pin)
|
||||
#define TFT_BL 21 // LED back-light
|
||||
#define TFT_CS 5 // Chip select control pin
|
||||
#define TFT_DC 27 // Data Command control pin
|
||||
#define TFT_RST 33 // Reset pin (could connect to Arduino RESET pin)
|
||||
#define TFT_BL 22 // LED back-light
|
||||
|
||||
|
||||
#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
|
||||
|
||||
#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
|
||||
#define SMOOTH_FONT
|
||||
|
||||
// #define SMOOTH_FONT
|
||||
|
||||
#define SPI_FREQUENCY 80000000
|
||||
// #define SPI_FREQUENCY 27000000
|
||||
//#define SPI_FREQUENCY 80000000
|
||||
#define SPI_FREQUENCY 27000000
|
||||
|
||||
// Optional reduced SPI frequency for reading TFT
|
||||
#define SPI_READ_FREQUENCY 5000000
|
||||
#define SPI_READ_FREQUENCY 5000000
|
||||
|
|
@ -17,7 +17,8 @@
|
|||
#define TFT_WIDTH 170
|
||||
#define TFT_HEIGHT 320
|
||||
|
||||
#define TFT_DC 7
|
||||
#define TFT_CS 6
|
||||
#define TFT_DC 7
|
||||
#define TFT_RST 5
|
||||
|
||||
#define TFT_WR 8
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
// ST7789 240 x 240 display with no chip select line
|
||||
#define USER_SETUP_ID 208
|
||||
|
||||
#define ST7796_DRIVER // Configure all registers
|
||||
|
||||
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define TFT_WIDTH 222
|
||||
#define TFT_HEIGHT 480
|
||||
|
||||
#define CGRAM_OFFSET
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
// #define TFT_INVERSION_ON
|
||||
// #define TFT_INVERSION_OFF
|
||||
|
||||
|
||||
#define TFT_MISO 7
|
||||
#define TFT_MOSI 4 //...
|
||||
#define TFT_SCLK 6 //...
|
||||
#define TFT_CS 15
|
||||
#define TFT_DC 2 //...
|
||||
#define TFT_RST 5
|
||||
|
||||
|
||||
|
||||
// #define TFT_BL 38 // LED back-light
|
||||
|
||||
#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_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
#define SPI_FREQUENCY 4000000
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
// ST7789 240 x 240 display with no chip select line
|
||||
#define USER_SETUP_ID 210
|
||||
|
||||
#define ST7796_DRIVER // Configure all registers
|
||||
|
||||
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define TFT_WIDTH 240
|
||||
#define TFT_HEIGHT 240
|
||||
|
||||
#define CGRAM_OFFSET
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
// #define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
// #define TFT_INVERSION_ON
|
||||
// #define TFT_INVERSION_OFF
|
||||
|
||||
|
||||
#define TFT_MISO -1
|
||||
#define TFT_MOSI 13
|
||||
#define TFT_SCLK 14
|
||||
#define TFT_CS 15
|
||||
#define TFT_DC 19
|
||||
#define TFT_RST 27
|
||||
#define TFT_BL 21
|
||||
|
||||
|
||||
// #define TFT_BL 38 // LED back-light
|
||||
|
||||
#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_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
#define SPI_FREQUENCY 4000000
|
||||
43
lib/TFT_eSPI/User_Setups/Setup210_LilyGo_T_Embed_S3.h
Normal file
43
lib/TFT_eSPI/User_Setups/Setup210_LilyGo_T_Embed_S3.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// ST7789 170 x 320 display with no chip select line
|
||||
#define USER_SETUP_ID 210
|
||||
|
||||
#define ST7789_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 170
|
||||
#define TFT_HEIGHT 320
|
||||
|
||||
//#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define TFT_INVERSION_ON
|
||||
//#define TFT_INVERSION_OFF
|
||||
#define TFT_BACKLIGHT_ON 1
|
||||
|
||||
#define TFT_BL 15 // LED back-light
|
||||
#define TFT_MISO -1 // Not connected
|
||||
#define TFT_MOSI 11
|
||||
#define TFT_SCLK 12
|
||||
#define TFT_CS 10
|
||||
#define TFT_DC 13
|
||||
#define TFT_RST 9 // Connect reset to ensure display initialises
|
||||
|
||||
#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_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
|
||||
// #define SPI_FREQUENCY 27000000
|
||||
#define SPI_FREQUENCY 40000000
|
||||
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
45
lib/TFT_eSPI/User_Setups/Setup211_LilyGo_T_QT_Pro_S3.h
Normal file
45
lib/TFT_eSPI/User_Setups/Setup211_LilyGo_T_QT_Pro_S3.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// GC9A01 128 x 128 display with no chip select line
|
||||
#define USER_SETUP_ID 211
|
||||
|
||||
#define GC9A01_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 128
|
||||
#define TFT_HEIGHT 128
|
||||
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
// #define TFT_INVERSION_ON
|
||||
//#define TFT_INVERSION_OFF
|
||||
#define TFT_BACKLIGHT_ON 0
|
||||
#define CGRAM_OFFSET
|
||||
|
||||
|
||||
#define TFT_BL 10 // LED back-light
|
||||
#define TFT_MISO -1 // Not connected
|
||||
#define TFT_MOSI 2
|
||||
#define TFT_SCLK 3
|
||||
#define TFT_CS 5
|
||||
#define TFT_DC 6
|
||||
#define TFT_RST 1 // Connect reset to ensure display initialises
|
||||
|
||||
#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_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
|
||||
// #define SPI_FREQUENCY 27000000
|
||||
#define SPI_FREQUENCY 40000000
|
||||
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
45
lib/TFT_eSPI/User_Setups/Setup212_LilyGo_T_PicoPro.h
Normal file
45
lib/TFT_eSPI/User_Setups/Setup212_LilyGo_T_PicoPro.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
// ST7796 222 x 480 display with no chip select line
|
||||
#define USER_SETUP_ID 212
|
||||
|
||||
#define ST7796_DRIVER // Configure all registers
|
||||
|
||||
#define TFT_WIDTH 222
|
||||
#define TFT_HEIGHT 480
|
||||
|
||||
#define CGRAM_OFFSET // Library will add offsets required
|
||||
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define TFT_INVERSION_ON
|
||||
|
||||
#define TFT_MISO 4
|
||||
#define TFT_MOSI 7
|
||||
#define TFT_SCLK 6
|
||||
#define TFT_CS 8
|
||||
#define TFT_DC 9
|
||||
#define TFT_RST 10
|
||||
#define TFT_BACKLIGHT_ON 1
|
||||
#define TFT_BL 11
|
||||
|
||||
|
||||
#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_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
|
||||
// #define SPI_FREQUENCY 27000000
|
||||
#define SPI_FREQUENCY 40000000
|
||||
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
|
||||
#define SPI_TOUCH_FREQUENCY 2500000
|
||||
|
||||
// #define SUPPORT_TRANSACTIONS
|
||||
|
|
@ -1,13 +1,17 @@
|
|||
// ST7796 222 x 480 display with no chip select line
|
||||
#define USER_SETUP_ID 217
|
||||
#define USER_SETUP_ID 213
|
||||
|
||||
#define ST7796_DRIVER // Configure all registers
|
||||
#define ST7796_DRIVER // Configure all registers
|
||||
|
||||
|
||||
#define TFT_WIDTH 272
|
||||
#define TFT_WIDTH 222
|
||||
#define TFT_HEIGHT 480
|
||||
|
||||
#define CGRAM_OFFSET
|
||||
#define CGRAM_OFFSET // Library will add offsets required
|
||||
|
||||
// #define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
|
||||
#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red
|
||||
|
||||
#define TFT_INVERSION_ON
|
||||
|
||||
#define TFT_MISO -1
|
||||
#define TFT_MOSI 14
|
||||
|
|
@ -15,8 +19,9 @@
|
|||
#define TFT_CS 25
|
||||
#define TFT_DC 13
|
||||
#define TFT_RST 2
|
||||
#define TFT_BL 4
|
||||
#define TFT_BACKLIGHT_ON HIGH
|
||||
|
||||
// #define TFT_BL 38 // LED back-light
|
||||
|
||||
#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
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// Display configuration for ST7789-based ESP32-S3-Box-Lite
|
||||
|
||||
#define USER_SETUP_ID 208
|
||||
#define USER_SETUP_ID 250
|
||||
#define USER_SETUP_INFO "ESP32-S3-BOX-LITE"
|
||||
|
||||
#define ST7789_DRIVER
|
||||
28
lib/TFT_eSPI/User_Setups/Setup251_ESP32_S3_Box.h
Normal file
28
lib/TFT_eSPI/User_Setups/Setup251_ESP32_S3_Box.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Display configuration for ILI9342-based ESP32-S3-Box
|
||||
|
||||
#define USER_SETUP_ID 251
|
||||
#define USER_SETUP_INFO "ESP32-S3-BOX"
|
||||
|
||||
#define M5STACK // S3-Box uses the same ILI9342 display, don't remove
|
||||
|
||||
#define ILI9341_DRIVER
|
||||
|
||||
#define TFT_MISO 0
|
||||
#define TFT_MOSI 6
|
||||
#define TFT_SCLK 7
|
||||
#define TFT_CS 5 // Chip select control pin
|
||||
#define TFT_DC 4 // Data Command control pin
|
||||
#define TFT_RST 48 // Reset pin (could connect to Arduino RESET pin)
|
||||
#define TFT_BL 45 // LED back-light
|
||||
|
||||
#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
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
#define SPI_FREQUENCY 27000000
|
||||
29
lib/TFT_eSPI/User_Setups/Setup66_Seeed_XIAO_Round.h
Normal file
29
lib/TFT_eSPI/User_Setups/Setup66_Seeed_XIAO_Round.h
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#define USER_SETUP_ID 66
|
||||
|
||||
#define GC9A01_DRIVER // Full configuration option, define additional parameters below for this display
|
||||
|
||||
#define TFT_RGB_ORDER TFT_RGB // Colour order Blue-Green-Red
|
||||
#define TFT_HEIGHT 240 // GC9A01 240 x 240
|
||||
|
||||
#define TFT_SCLK D8
|
||||
#define TFT_MISO D9
|
||||
#define TFT_MOSI D10
|
||||
#define TFT_CS D1 // Chip select control pin
|
||||
#define TFT_DC D3 // Data Command control pin
|
||||
#define TFT_BL D6
|
||||
#define TFT_RST -1 // Reset pin (could connect to RST pin)
|
||||
|
||||
#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_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
|
||||
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
|
||||
|
||||
#define SMOOTH_FONT
|
||||
|
||||
#define SPI_FREQUENCY 40000000
|
||||
#define SPI_READ_FREQUENCY 20000000
|
||||
// #define USE_HSPI_PORT
|
||||
|
|
@ -1,174 +0,0 @@
|
|||
/////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
Button2.cpp - Arduino Library to simplify working with buttons.
|
||||
Created by Lennart Hennigs, October 28, 2017.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "Button2.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
Button2::Button2(byte attachTo, byte buttonMode /*= INPUT_PULLUP*/, unsigned int debounceTimeout /*= DEBOUNCE_MS*/) {
|
||||
pin = attachTo;
|
||||
setDebounceTime(debounceTimeout);
|
||||
pinMode(attachTo, buttonMode);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
bool Button2::operator==(Button2 &rhs) {
|
||||
return (this==&rhs);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::setDebounceTime(unsigned int ms) {
|
||||
debounce_time_ms = ms;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::setChangedHandler(CallbackFunction f) {
|
||||
change_cb = f;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::setPressedHandler(CallbackFunction f) {
|
||||
pressed_cb = f;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::setReleasedHandler(CallbackFunction f) {
|
||||
released_cb = f;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::setClickHandler(CallbackFunction f) {
|
||||
click_cb = f;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::setTapHandler(CallbackFunction f) {
|
||||
tap_cb = f;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::setLongClickHandler(CallbackFunction f) {
|
||||
long_cb = f;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::setDoubleClickHandler(CallbackFunction f) {
|
||||
double_cb = f;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::setTripleClickHandler(CallbackFunction f) {
|
||||
triple_cb = f;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
unsigned int Button2::wasPressedFor() {
|
||||
return down_time_ms;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
boolean Button2::isPressed() {
|
||||
return (state == LOW);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
unsigned int Button2::getNumberOfClicks() {
|
||||
return click_count;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
unsigned int Button2::getClickType() {
|
||||
return last_click_type;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
void Button2::loop() {
|
||||
if(pin < 0)return;
|
||||
|
||||
prev_state = state;
|
||||
state = digitalRead(pin);
|
||||
|
||||
// is button pressed?
|
||||
if (prev_state == HIGH && state == LOW) {
|
||||
down_ms = millis();
|
||||
pressed_triggered = false;
|
||||
click_count++;
|
||||
click_ms = down_ms;
|
||||
|
||||
// is the button released?
|
||||
} else if (prev_state == LOW && state == HIGH) {
|
||||
down_time_ms = millis() - down_ms;
|
||||
// is it beyond debounce time?
|
||||
if (down_time_ms >= debounce_time_ms) {
|
||||
// trigger release
|
||||
if (change_cb != NULL) change_cb (*this);
|
||||
if (released_cb != NULL) released_cb (*this);
|
||||
// trigger tap
|
||||
if (tap_cb != NULL) tap_cb (*this);
|
||||
// was it a longclick? (preceeds single / double / triple clicks)
|
||||
if (down_time_ms >= LONGCLICK_MS) {
|
||||
longclick_detected = true;
|
||||
}
|
||||
}
|
||||
|
||||
// trigger pressed event (after debounce has passed)
|
||||
} else if (state == LOW && !pressed_triggered && (millis() - down_ms >= debounce_time_ms)) {
|
||||
if (change_cb != NULL) change_cb (*this);
|
||||
if (pressed_cb != NULL) pressed_cb (*this);
|
||||
pressed_triggered = true;
|
||||
|
||||
// is the button pressed and the time has passed for multiple clicks?
|
||||
} else if (state == HIGH && millis() - click_ms > DOUBLECLICK_MS) {
|
||||
// was there a longclick?
|
||||
if (longclick_detected) {
|
||||
// was it part of a combination?
|
||||
if (click_count == 1) {
|
||||
last_click_type = LONG_CLICK;
|
||||
if (long_cb != NULL) long_cb (*this);
|
||||
}
|
||||
longclick_detected = false;
|
||||
// determine the number of single clicks
|
||||
} else if (click_count > 0) {
|
||||
switch (click_count) {
|
||||
case 1:
|
||||
last_click_type = SINGLE_CLICK;
|
||||
if (click_cb != NULL){
|
||||
click_cb (*this);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
last_click_type = DOUBLE_CLICK;
|
||||
if (double_cb != NULL) double_cb (*this);
|
||||
break;
|
||||
case 3:
|
||||
last_click_type = TRIPLE_CLICK;
|
||||
if (triple_cb != NULL) triple_cb (*this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
click_count = 0;
|
||||
click_ms = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
Button2.cpp - Arduino Library to simplify working with buttons.
|
||||
Created by Lennart Hennigs, October 28, 2017.
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#ifndef Button2_h
|
||||
#define Button2_h
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
#define DEBOUNCE_MS 50
|
||||
#define LONGCLICK_MS 250
|
||||
#define DOUBLECLICK_MS 400
|
||||
|
||||
#define SINGLE_CLICK 1
|
||||
#define DOUBLE_CLICK 2
|
||||
#define TRIPLE_CLICK 3
|
||||
#define LONG_CLICK 4
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
class Button2 {
|
||||
private:
|
||||
byte pin;
|
||||
int prev_state;
|
||||
int state = HIGH;
|
||||
byte click_count = 0;
|
||||
unsigned int last_click_type = 0;
|
||||
unsigned long click_ms;
|
||||
unsigned long down_ms;
|
||||
unsigned int debounce_time_ms;
|
||||
unsigned int down_time_ms = 0;
|
||||
bool pressed_triggered = false;
|
||||
bool longclick_detected = false;
|
||||
|
||||
typedef void (*CallbackFunction) (Button2&);
|
||||
|
||||
CallbackFunction pressed_cb = NULL;
|
||||
CallbackFunction released_cb = NULL;
|
||||
CallbackFunction change_cb = NULL;
|
||||
CallbackFunction tap_cb = NULL;
|
||||
CallbackFunction click_cb = NULL;
|
||||
CallbackFunction long_cb = NULL;
|
||||
CallbackFunction double_cb = NULL;
|
||||
CallbackFunction triple_cb = NULL;
|
||||
|
||||
public:
|
||||
Button2(){pin = -1;}
|
||||
Button2(byte attachTo, byte buttonMode = INPUT_PULLUP, unsigned int debounceTimeout = DEBOUNCE_MS);
|
||||
void setDebounceTime(unsigned int ms);
|
||||
|
||||
void setChangedHandler(CallbackFunction f);
|
||||
void setPressedHandler(CallbackFunction f);
|
||||
void setReleasedHandler(CallbackFunction f);
|
||||
void setClickHandler(CallbackFunction f);
|
||||
void setTapHandler(CallbackFunction f);
|
||||
void setLongClickHandler(CallbackFunction f);
|
||||
void setDoubleClickHandler(CallbackFunction f);
|
||||
void setTripleClickHandler(CallbackFunction f);
|
||||
|
||||
unsigned int wasPressedFor();
|
||||
boolean isPressed();
|
||||
|
||||
unsigned int getNumberOfClicks();
|
||||
unsigned int getClickType();
|
||||
uint8_t getAttachPin(){return pin;}
|
||||
bool operator==(Button2 &rhs);
|
||||
|
||||
void loop();
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#endif
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1,245 +0,0 @@
|
|||
#include <TFT_eSPI.h>
|
||||
#include <SPI.h>
|
||||
#include "WiFi.h"
|
||||
#include <Wire.h>
|
||||
#include "Button2.h"
|
||||
#include "esp_adc_cal.h"
|
||||
#include "bmp.h"
|
||||
|
||||
|
||||
// TFT Pins has been set in the TFT_eSPI library in the User Setup file TTGO_T_Display.h
|
||||
// #define TFT_MOSI 19
|
||||
// #define TFT_SCLK 18
|
||||
// #define TFT_CS 5
|
||||
// #define TFT_DC 16
|
||||
// #define TFT_RST 23
|
||||
// #define TFT_BL 4 // Display backlight control pin
|
||||
|
||||
|
||||
#define ADC_EN 14 //ADC_EN is the ADC detection enable port
|
||||
#define ADC_PIN 34
|
||||
#define BUTTON_1 35
|
||||
#define BUTTON_2 0
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(135, 240); // Invoke custom library
|
||||
Button2 btn1(BUTTON_1);
|
||||
Button2 btn2(BUTTON_2);
|
||||
|
||||
char buff[512];
|
||||
int vref = 1100;
|
||||
int btnCick = false;
|
||||
|
||||
#define ENABLE_SPI_SDCARD
|
||||
|
||||
//Uncomment will use SDCard, this is just a demonstration,
|
||||
//how to use the second SPI
|
||||
#ifdef ENABLE_SPI_SDCARD
|
||||
|
||||
#include "FS.h"
|
||||
#include "SD.h"
|
||||
|
||||
SPIClass SDSPI(HSPI);
|
||||
|
||||
#define MY_CS 33
|
||||
#define MY_SCLK 25
|
||||
#define MY_MISO 27
|
||||
#define MY_MOSI 26
|
||||
|
||||
void setupSDCard()
|
||||
{
|
||||
SDSPI.begin(MY_SCLK, MY_MISO, MY_MOSI, MY_CS);
|
||||
//Assuming use of SPI SD card
|
||||
if (!SD.begin(MY_CS, SDSPI)) {
|
||||
Serial.println("Card Mount Failed");
|
||||
tft.setTextColor(TFT_RED);
|
||||
tft.drawString("SDCard Mount FAIL", tft.width() / 2, tft.height() / 2 - 32);
|
||||
tft.setTextColor(TFT_GREEN);
|
||||
} else {
|
||||
tft.setTextColor(TFT_GREEN);
|
||||
Serial.println("SDCard Mount PASS");
|
||||
tft.drawString("SDCard Mount PASS", tft.width() / 2, tft.height() / 2 - 48);
|
||||
String size = String((uint32_t)(SD.cardSize() / 1024 / 1024)) + "MB";
|
||||
tft.drawString(size, tft.width() / 2, tft.height() / 2 - 32);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define setupSDCard()
|
||||
#endif
|
||||
|
||||
|
||||
void wifi_scan();
|
||||
|
||||
//! Long time delay, it is recommended to use shallow sleep, which can effectively reduce the current consumption
|
||||
void espDelay(int ms)
|
||||
{
|
||||
esp_sleep_enable_timer_wakeup(ms * 1000);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
|
||||
esp_light_sleep_start();
|
||||
}
|
||||
|
||||
void showVoltage()
|
||||
{
|
||||
static uint64_t timeStamp = 0;
|
||||
if (millis() - timeStamp > 1000) {
|
||||
timeStamp = millis();
|
||||
uint16_t v = analogRead(ADC_PIN);
|
||||
float battery_voltage = ((float)v / 4095.0) * 2.0 * 3.3 * (vref / 1000.0);
|
||||
String voltage = "Voltage :" + String(battery_voltage) + "V";
|
||||
Serial.println(voltage);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
tft.drawString(voltage, tft.width() / 2, tft.height() / 2 );
|
||||
}
|
||||
}
|
||||
|
||||
void button_init()
|
||||
{
|
||||
btn1.setLongClickHandler([](Button2 & b) {
|
||||
btnCick = false;
|
||||
int r = digitalRead(TFT_BL);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
tft.drawString("Press again to wake up", tft.width() / 2, tft.height() / 2 );
|
||||
espDelay(6000);
|
||||
digitalWrite(TFT_BL, !r);
|
||||
|
||||
tft.writecommand(TFT_DISPOFF);
|
||||
tft.writecommand(TFT_SLPIN);
|
||||
//After using light sleep, you need to disable timer wake, because here use external IO port to wake up
|
||||
esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_TIMER);
|
||||
// esp_sleep_enable_ext1_wakeup(GPIO_SEL_35, ESP_EXT1_WAKEUP_ALL_LOW);
|
||||
esp_sleep_enable_ext0_wakeup(GPIO_NUM_35, 0);
|
||||
delay(200);
|
||||
esp_deep_sleep_start();
|
||||
});
|
||||
btn1.setPressedHandler([](Button2 & b) {
|
||||
Serial.println("Detect Voltage..");
|
||||
btnCick = true;
|
||||
});
|
||||
|
||||
btn2.setPressedHandler([](Button2 & b) {
|
||||
btnCick = false;
|
||||
Serial.println("btn press wifi scan");
|
||||
wifi_scan();
|
||||
});
|
||||
}
|
||||
|
||||
void button_loop()
|
||||
{
|
||||
btn1.loop();
|
||||
btn2.loop();
|
||||
}
|
||||
|
||||
void wifi_scan()
|
||||
{
|
||||
tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
tft.setTextSize(1);
|
||||
|
||||
tft.drawString("Scan Network", tft.width() / 2, tft.height() / 2);
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFi.disconnect();
|
||||
delay(100);
|
||||
|
||||
int16_t n = WiFi.scanNetworks();
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
if (n == 0) {
|
||||
tft.drawString("no networks found", tft.width() / 2, tft.height() / 2);
|
||||
} else {
|
||||
tft.setTextDatum(TL_DATUM);
|
||||
tft.setCursor(0, 0);
|
||||
Serial.printf("Found %d net\n", n);
|
||||
for (int i = 0; i < n; ++i) {
|
||||
sprintf(buff,
|
||||
"[%d]:%s(%d)",
|
||||
i + 1,
|
||||
WiFi.SSID(i).c_str(),
|
||||
WiFi.RSSI(i));
|
||||
tft.println(buff);
|
||||
}
|
||||
}
|
||||
// WiFi.mode(WIFI_OFF);
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println("Start");
|
||||
|
||||
/*
|
||||
ADC_EN is the ADC detection enable port
|
||||
If the USB port is used for power supply, it is turned on by default.
|
||||
If it is powered by battery, it needs to be set to high level
|
||||
*/
|
||||
pinMode(ADC_EN, OUTPUT);
|
||||
digitalWrite(ADC_EN, HIGH);
|
||||
|
||||
tft.init();
|
||||
tft.setRotation(1);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextSize(2);
|
||||
tft.setTextColor(TFT_GREEN);
|
||||
tft.setCursor(0, 0);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
tft.setTextSize(1);
|
||||
|
||||
/*
|
||||
if (TFT_BL > 0) { // TFT_BL has been set in the TFT_eSPI library in the User Setup file TTGO_T_Display.h
|
||||
pinMode(TFT_BL, OUTPUT); // Set backlight pin to output mode
|
||||
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); // Turn backlight on. TFT_BACKLIGHT_ON has been set in the TFT_eSPI library in the User Setup file TTGO_T_Display.h
|
||||
}
|
||||
*/
|
||||
|
||||
tft.setSwapBytes(true);
|
||||
tft.pushImage(0, 0, 240, 135, ttgo);
|
||||
espDelay(5000);
|
||||
|
||||
|
||||
tft.setRotation(0);
|
||||
tft.fillScreen(TFT_RED);
|
||||
espDelay(1000);
|
||||
tft.fillScreen(TFT_BLUE);
|
||||
espDelay(1000);
|
||||
tft.fillScreen(TFT_GREEN);
|
||||
espDelay(1000);
|
||||
|
||||
button_init();
|
||||
|
||||
esp_adc_cal_characteristics_t adc_chars;
|
||||
esp_adc_cal_value_t val_type = esp_adc_cal_characterize((adc_unit_t)ADC_UNIT_1, (adc_atten_t)ADC1_CHANNEL_6, (adc_bits_width_t)ADC_WIDTH_BIT_12, 1100, &adc_chars);
|
||||
//Check type of calibration value used to characterize ADC
|
||||
if (val_type == ESP_ADC_CAL_VAL_EFUSE_VREF) {
|
||||
Serial.printf("eFuse Vref:%u mV", adc_chars.vref);
|
||||
vref = adc_chars.vref;
|
||||
} else if (val_type == ESP_ADC_CAL_VAL_EFUSE_TP) {
|
||||
Serial.printf("Two Point --> coeff_a:%umV coeff_b:%umV\n", adc_chars.coeff_a, adc_chars.coeff_b);
|
||||
} else {
|
||||
Serial.println("Default Vref: 1100mV");
|
||||
}
|
||||
|
||||
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
|
||||
setupSDCard();
|
||||
|
||||
|
||||
tft.drawString("LeftButton:", tft.width() / 2, tft.height() / 2 - 16);
|
||||
tft.drawString("[WiFi Scan]", tft.width() / 2, tft.height() / 2 );
|
||||
tft.drawString("RightButton:", tft.width() / 2, tft.height() / 2 + 16);
|
||||
tft.drawString("[Voltage Monitor]", tft.width() / 2, tft.height() / 2 + 32 );
|
||||
tft.drawString("RightButtonLongPress:", tft.width() / 2, tft.height() / 2 + 48);
|
||||
tft.drawString("[Deep Sleep]", tft.width() / 2, tft.height() / 2 + 64 );
|
||||
tft.setTextDatum(TL_DATUM);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
if (btnCick) {
|
||||
showVoltage();
|
||||
}
|
||||
button_loop();
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
83
lib/TFT_eSPI/examples/Generic/Julia_Set/Julia_Set.ino
Normal file
83
lib/TFT_eSPI/examples/Generic/Julia_Set/Julia_Set.ino
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
// Based on sketch here:
|
||||
// https://github.com/OpenHDZ/Arduino-experimentation
|
||||
// Adapted for TFT_eSPI library
|
||||
|
||||
// Note: a high number of floating point calculations are needed
|
||||
// for each pixel so rendering will be quite slow.
|
||||
// For best performance use a Teensy 4.x (600MHz CPU clock).
|
||||
|
||||
#include <TFT_eSPI.h> // Hardware-specific library
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(); // Invoke custom library
|
||||
|
||||
const uint16_t MAX_ITERATION = 300; // Nombre de couleurs
|
||||
|
||||
#define SCREEN_WIDTH tft.width() //
|
||||
#define SCREEN_HEIGHT tft.height() // Taille de l'écran
|
||||
|
||||
static float zoom = 0.5;
|
||||
|
||||
/* Fonction setup */
|
||||
void setup() {
|
||||
/* Initialise l'écran LCD */
|
||||
tft.begin();
|
||||
tft.setRotation(1);
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setFreeFont(&FreeMono9pt7b);
|
||||
}
|
||||
|
||||
/* Fonction loop() */
|
||||
void loop() {
|
||||
/* Dessine la fractale */
|
||||
draw_Julia(-0.8,+0.156,zoom);
|
||||
tft.fillRect(0, 0, 150, 20, TFT_BLACK);
|
||||
tft.setCursor(0,15);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.print(" Zoom = ");
|
||||
tft.println(zoom);
|
||||
delay(2000);
|
||||
zoom *= 1.5;
|
||||
if (zoom > 100) zoom = 0.5;
|
||||
}
|
||||
|
||||
/*
|
||||
Dessine une fractale de Julia
|
||||
*/
|
||||
|
||||
void draw_Julia(float c_r, float c_i, float zoom) {
|
||||
|
||||
tft.setCursor(0,0);
|
||||
float new_r = 0.0, new_i = 0.0, old_r = 0.0, old_i = 0.0;
|
||||
|
||||
/* Pour chaque pixel en X */
|
||||
|
||||
for(int16_t x = SCREEN_WIDTH/2 - 1; x >= 0; x--) { // Rely on inverted symettry
|
||||
/* Pour chaque pixel en Y */
|
||||
for(uint16_t y = 0; y < SCREEN_HEIGHT; y++) {
|
||||
old_r = 1.5 * (x - SCREEN_WIDTH / 2) / (0.5 * zoom * SCREEN_WIDTH);
|
||||
old_i = (y - SCREEN_HEIGHT / 2) / (0.5 * zoom * SCREEN_HEIGHT);
|
||||
uint16_t i = 0;
|
||||
|
||||
while ((old_r * old_r + old_i * old_i) < 4.0 && i < MAX_ITERATION) {
|
||||
new_r = old_r * old_r - old_i * old_i ;
|
||||
new_i = 2.0 * old_r * old_i;
|
||||
|
||||
old_r = new_r+c_r;
|
||||
old_i = new_i+c_i;
|
||||
|
||||
i++;
|
||||
}
|
||||
/* Affiche le pixel */
|
||||
if (i < 100){
|
||||
tft.drawPixel(x,y,tft.color565(255,255,map(i,0,100,255,0)));
|
||||
tft.drawPixel(SCREEN_WIDTH - x - 1,SCREEN_HEIGHT - y - 1,tft.color565(255,255,map(i,0,100,255,0)));
|
||||
}if(i<200){
|
||||
tft.drawPixel(x,y,tft.color565(255,map(i,100,200,255,0),0));
|
||||
tft.drawPixel(SCREEN_WIDTH - x - 1,SCREEN_HEIGHT - y - 1,tft.color565(255,map(i,100,200,255,0),0));
|
||||
}else{
|
||||
tft.drawPixel(x,y,tft.color565(map(i,200,300,255,0),0,0));
|
||||
tft.drawPixel(SCREEN_WIDTH - x - 1,SCREEN_HEIGHT - y - 1,tft.color565(map(i,200,300,255,0),0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "TFT_eSPI",
|
||||
"version": "2.5.23",
|
||||
"version": "2.5.31",
|
||||
"keywords": "Arduino, tft, display, ttgo, LilyPi, WT32-SC01, ePaper, display, Pico, RP2040 Nano Connect, RP2040, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9481, ILI9486, ILI9488, ST7789, ST7796, RM68140, SSD1351, SSD1963, ILI9225, HX8357D, GC9A01, R61581",
|
||||
"description": "A TFT and ePaper (SPI or parallel interface) graphics library with optimisation for Raspberry Pi Pico, RP2040, ESP8266, ESP32 and STM32 processors",
|
||||
"repository":
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
name=TFT_eSPI
|
||||
version=2.5.23
|
||||
version=2.5.31
|
||||
author=Bodmer
|
||||
maintainer=Bodmer
|
||||
sentence=TFT graphics library for Arduino processors with performance optimisation for RP2040, STM32, ESP8266 and ESP32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue