From 2f37f209851808df00af4425ee6fc7fac44dc96c Mon Sep 17 00:00:00 2001 From: Johan Cronje Date: Tue, 5 Apr 2022 14:53:42 -0700 Subject: [PATCH] Update examples for ESP32 --- CHANGES.md | 1 + README.md | 4 ++-- examples/Basic_Demo/Basic_Demo.ino | 2 +- examples/GFX_Font_Demo/GFX_Font_Demo.ino | 8 +++++++- examples/Triangle_Demo/Triangle_Demo.ino | 15 ++++++++++----- library.json | 2 +- library.properties | 2 +- 7 files changed, 23 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 52fe425..ee6fc10 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ TFT_22_ILI9225 Version | Release Date | Description ------- | ------------ | ----------- +[v1.4.5](https://github.com/Nkawu/TFT_22_ILI9225/releases/tag/v1.4.5) | 2022-02-05 | Update examples for ESP32 [v1.4.4](https://github.com/Nkawu/TFT_22_ILI9225/releases/tag/v1.4.4) | 2020-07-19 | Add support for Arduino Nano Every ([charclo](https://github.com/charclo)) [v1.4.3](https://github.com/Nkawu/TFT_22_ILI9225/releases/tag/v1.4.3) | 2019-11-25 | Cleanup and ESP32 FAST_PINIO fixes ([Bolukan](https://github.com/Bolukan) [dl9rdz](https://github.com/dl9rdz)) [v1.4.2](https://github.com/Nkawu/TFT_22_ILI9225/releases/tag/v1.4.2) | 2019-05-01 | More performance improvements for color drawBitmap ([LAK132](https://github.com/LAK132)) diff --git a/README.md b/README.md index b6894dc..615ab8d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ TFT_22_ILI9225 Version | Release Date | Description ------- | ------------ | ----------- -[v1.4.4](https://github.com/Nkawu/TFT_22_ILI9225/releases/tag/v1.4.4) | 2020-07-19 | Add support for Arduino Nano Every ([charclo](https://github.com/charclo)) +[v1.4.5](https://github.com/Nkawu/TFT_22_ILI9225/releases/tag/v1.4.5) | 2022-02-05 | Update examples for ESP32 ## Introduction @@ -25,7 +25,7 @@ ILI9341 driver.* * Include Library * Manage Libraries... * In the resulting **Library Manager** dialog: -* Enter **"9225"** in the search filter field *(Filter your search...)* +* Enter **"ILI9225"** in the search filter field *(Filter your search...)* * Select **TFT_22_ILI9225"** in the list * Click the **Install** button diff --git a/examples/Basic_Demo/Basic_Demo.ino b/examples/Basic_Demo/Basic_Demo.ino index 730f522..4a0f2b5 100644 --- a/examples/Basic_Demo/Basic_Demo.ino +++ b/examples/Basic_Demo/Basic_Demo.ino @@ -8,7 +8,7 @@ #define TFT_CS PA0 // SS #define TFT_SDI PA7 // MOSI #define TFT_CLK PA5 // SCK -#define TFT_LED 0 // 0 if wired to +5V directly +#define TFT_LED 0 // 0 if wired to +5V directly #elif defined(ESP8266) #define TFT_RST 4 // D2 #define TFT_RS 5 // D1 diff --git a/examples/GFX_Font_Demo/GFX_Font_Demo.ino b/examples/GFX_Font_Demo/GFX_Font_Demo.ino index 2b6cf06..c7d1bfe 100644 --- a/examples/GFX_Font_Demo/GFX_Font_Demo.ino +++ b/examples/GFX_Font_Demo/GFX_Font_Demo.ino @@ -31,7 +31,8 @@ //#define TFT_SDO 12 // HSPI-MISO #define TFT_SDI 13 // HSPI-MOSI #define TFT_CS 15 // HSPI-SS0 -#define TFT_LED 0 // 0 if wired to +5V directly +#define TFT_LED 0 // 0 if wired to +5V directly +SPIClass hspi(HSPI); #else #define TFT_RST 8 #define TFT_RS 9 @@ -53,7 +54,12 @@ int16_t x=0, y=0, w, h; // Setup void setup() { +#if defined(ESP32) + hspi.begin(); + tft.begin(hspi); +#else tft.begin(); +#endif tft.clear(); // Draw first string in big font diff --git a/examples/Triangle_Demo/Triangle_Demo.ino b/examples/Triangle_Demo/Triangle_Demo.ino index cdabbee..a460b39 100644 --- a/examples/Triangle_Demo/Triangle_Demo.ino +++ b/examples/Triangle_Demo/Triangle_Demo.ino @@ -9,7 +9,7 @@ #define TFT_CS PA0 // SS #define TFT_SDI PA7 // MOSI #define TFT_CLK PA5 // SCK -#define TFT_LED 0 // 0 if wired to +5V directly +#define TFT_LED 0 // 0 if wired to +5V directly #elif defined(ESP8266) #define TFT_RST 4 // D2 #define TFT_RS 5 // D1 @@ -22,10 +22,11 @@ #define TFT_RST 26 // IO 26 #define TFT_RS 25 // IO 25 #define TFT_CLK 14 // HSPI-SCK -//#define TFT_SDO 12 // HSPI-MISO +// #define TFT_SDO 12 // HSPI-MISO #define TFT_SDI 13 // HSPI-MOSI #define TFT_CS 15 // HSPI-SS0 -#define TFT_LED 0 // 0 if wired to +5V directly +#define TFT_LED 0 // 0 if wired to +5V directly +SPIClass hspi(HSPI); #else #define TFT_RST 8 #define TFT_RS 9 @@ -39,8 +40,7 @@ #define ROTATE_ANGLE 10 // Angle in degrees to rotate the triangle -struct _point -{ +struct _point { int16_t x; int16_t y; }; @@ -53,7 +53,12 @@ _point c1, c2, c3, cc; // Setup void setup() { +#if defined(ESP32) + hspi.begin(); + tft.begin(hspi); +#else tft.begin(); +#endif // Define triangle start coordinates c1.x = 30; c1.y = 30; diff --git a/library.json b/library.json index 1bfa08f..c36a06b 100644 --- a/library.json +++ b/library.json @@ -9,7 +9,7 @@ "authors": { "name": "Nkawu" }, - "version": "1.4.4", + "version": "1.4.5", "frameworks": "arduino", "platforms": "*" } diff --git a/library.properties b/library.properties index 08a6d1a..a962761 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TFT_22_ILI9225 -version=1.4.4 +version=1.4.5 author=Nkawu maintainer=Nkawu sentence=ILI9225 2.2" 176x220 TFT LCD shield