From 237565cff052c34537d4d01572bc64e328379a22 Mon Sep 17 00:00:00 2001 From: Bodmer Date: Wed, 22 Feb 2017 10:04:26 +0000 Subject: [PATCH] Update with multiple User_Setup file option Added Tools folder and licence for Marek's screenshot viewer utility --- ...LIScreenshotViewer licence information.txt | 23 +++ Tools/ILIScreenshotViewer.exe | Bin 0 -> 16896 bytes User_Setup_Select.h | 14 +- User_Setups/Setup1_ILI9341.h | 150 +++++++++++++++++ User_Setups/Setup2_ST7735.h | 150 +++++++++++++++++ User_Setups/SetupX_Template.h | 152 ++++++++++++++++++ library.json | 2 +- library.properties | 2 +- 8 files changed, 486 insertions(+), 7 deletions(-) create mode 100644 Tools/ILIScreenshotViewer licence information.txt create mode 100644 Tools/ILIScreenshotViewer.exe create mode 100644 User_Setups/Setup1_ILI9341.h create mode 100644 User_Setups/Setup2_ST7735.h create mode 100644 User_Setups/SetupX_Template.h diff --git a/Tools/ILIScreenshotViewer licence information.txt b/Tools/ILIScreenshotViewer licence information.txt new file mode 100644 index 0000000..2c9f877 --- /dev/null +++ b/Tools/ILIScreenshotViewer licence information.txt @@ -0,0 +1,23 @@ + +This ILIScreenshotViewer.exe file is part of the Arduino ILI9341_due library. + +A set of compatible functions is included in the "ESP8266_uncannyEyes" example. + +The original library licence conditions that apply to the software in this folder are: + +Copyright (c) 2014 Marek Buriak + +Sources can be found at https://github.com/marekburiak/ILI9341_Due. + +ILI9341_due is free software you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 of the License, or +(at your option) any later version. + +ILI9341_due is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with ILI9341_due. If not, see . diff --git a/Tools/ILIScreenshotViewer.exe b/Tools/ILIScreenshotViewer.exe new file mode 100644 index 0000000000000000000000000000000000000000..d9f4ed92b984202825858c42de4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z-}KdU9iv=gK(>m_-l0*acRHInc8uC~&Q0PlV|xF!#fgh&s!zz>~m|3p;8Lh5Vu%U zqqw%sZ%=L7WNt`r*x0e9bG_BRdCSVVjj20ZzfE*YMG7p#Gt||~|JmmMU+v~@_2R1S~yjy%5ePt4!@rM2go*Y1x#^MiLz^0;KS9vPf6dhIk08Tq1n1P5Eb zrErgQIhj&6Zy%Xw4jr*mw;#ccpJlq%eC5ePCPmx#LA&=HVBGMj*>C@krxX{5Qm5~f zCHFTH43?G5C-79YiU*W}7xmG>8XtWnR` ztA35()L;`1>L}se%v?=>BrQRaU6ZGA9=f zzpGw*hUoA8DTY4(>c9T?Z8x2o%o(@~;>+pnt=KQL8dg4SXRyX@Z{0V#bM59>@mwN`irWx2W5s)R@R?E`p50fESq?3Z#DARkZf-qoT|7cPnv~7>kUdn(J8t3 zqU4zUKJ8i8D)rE|Yo$wkW8~4`IJi%OomOVZ$)3P>8snDxKDBoGS`9oida#zHOMD+c zV4bjXMvme3R?}5q_ByRbDchCC%`x0~%*?r#*C|nQ!#vjbrr$8j_H8$modAJtH~1rT eBhQ+DfBwyT0E;~TZaTN&-+WL1y@T_3;9miKBH*3? literal 0 HcmV?d00001 diff --git a/User_Setup_Select.h b/User_Setup_Select.h index abb33ae..40d9d24 100644 --- a/User_Setup_Select.h +++ b/User_Setup_Select.h @@ -12,9 +12,13 @@ // Create a shortcut to this file on your desktop to permit quick access for editting. // Re-compile and upload after making and saving any changes to this file. -// Only ONE line should be uncommented +// Customised User_Setup files are stored in the "User_Setups" folder. -#include // Default setup -//#include // Setup file configured for my ILI9341 -//#include // Setup file configured for my ST7735 -//#include // Setup file template for copying/editting \ No newline at end of file +// Only ONE line should be uncommented. Add extra lines and files as needed. + +//#include // Default setup is root library folder + +//#include // Setup file configured for my ILI9341 +#include // Setup file configured for my ST7735 + +//#include // Setup file template for copying/editting diff --git a/User_Setups/Setup1_ILI9341.h b/User_Setups/Setup1_ILI9341.h new file mode 100644 index 0000000..eb9e278 --- /dev/null +++ b/User_Setups/Setup1_ILI9341.h @@ -0,0 +1,150 @@ +// USER DEFINED SETTINGS +// +// The User_Setup header that will be called up is defined in User_Setup_Select.h +// +// Set driver type, fonts to be loaded, pins used and SPI control method etc +// +// If this file is editted correctly then all the library example sketches should +// run without the need to make any more changes for a particular hardware setup! + +// ################################################################################## +// +// Section 0. Call up the right driver file and any options for it +// +// ################################################################################## + +// Only define one driver, the other ones must be commented out +#define ILI9341_DRIVER +//#define ST7735_DRIVER + +// For ST7735 ONLY, define the type of display, originally this was based on the +// colour of the tab on the screen protector film but this is not always true, so try +// out the different options below if the screen does not display graphics correctly, +// e.g. colours wrong, mirror images, or tray pixels at the edges. +// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this +// this User_Setup file, then rebuild and upload the sketch to the board again: + +//#define ST7735_INITB +//#define ST7735_GREENTAB +//#define ST7735_GREENTAB2 +//#define ST7735_REDTAB +//#define ST7735_BLACKTAB + +// ################################################################################## +// +// Section 1. Define the pins that are used to interface with the display here +// +// ################################################################################## + +// We must use hardware SPI, a minimum of 3 GPIO pins is needed. +// Typical setup for NodeMCU ESP-12 is : +// +// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT) +// Display LED to NodeMCU pin VIN (or 5V, see below) +// Display SCK to NodeMCU pin D5 +// Display SDI/MOSI to NodeMCU pin D7 +// Display DC (or AO)to NodeMCU pin D3 +// Display RESET to NodeMCU pin D4 (or RST, see below) +// Display CS to NodeMCU pin D8 (or GND, see below) +// Display GND to NodeMCU pin GND (0V) +// Display VCC to NodeMCU 5V or 3.3V +// +// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin +// +// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more +// SPI deivces (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS +// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin +// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected. +// +// The NodeMCU D0 pin can be used for RST +// +// See Section 2. below if DC or CS is connected to D0 +// +// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin +// If 5V is not available at a pin you can use 3.3V but backlight brightness +// will be lower. + +// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### + +// ModeMCU +#define TFT_CS D8 // Chip select control pin D8 +#define TFT_DC D3 // Data Command control pin +#define TFT_RST D4 // Reset pin (could connect to NodeMCU RST, see next line) +//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V + +// ESP32 Dev board (planned, not supported yet) +//#define TFT_CS 5 // Chip select control pin +//#define TFT_DC 2 // Data Command control pin +//#define TFT_RST 4 // Reset pin (could connect to Arduino RESET pin) +//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST + +// ################################################################################## +// +// Section 2. Define the way the DC and/or CS lines are driven +// +// ################################################################################## + +// Normally the library uses direct register access for the DC and CS lines for speed +// If D0 (GPIO16) is used for CS or DC then a different slower method must be used +// Uncomment one line if D0 is used for DC or CS +// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test +// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test + +// #define D0_USED_FOR_DC +// #define D0_USED_FOR_CS + +// ################################################################################## +// +// Section 3. Define the fonts that are to be used here +// +// ################################################################################## + +// Comment out the #defines below with // to stop that font being loaded +// The ESP8366 had plenty of memory so commenting out fonts is not normally necessary +// If all fonts are loaded the extra FLASH space required is about 17Kbytes... +// To save FLASH space only enable the fonts you need! + +#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH +#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters +#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters +#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm +#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:. +#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. +#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts + +// ################################################################################## +// +// Section 4. Define the character to be used to detemine the text bounding box for datum changes +// +// ################################################################################## + +#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline +#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline + + +// ################################################################################## +// +// Section 5. Other options +// +// ################################################################################## + +// Define the SPI clock frequency +// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails +// With a ST7735 display more than 27MHz may not work (spurious pixels and lines) + +// #define SPI_FREQUENCY 1000000 +// #define SPI_FREQUENCY 5000000 +// #define SPI_FREQUENCY 10000000 +// #define SPI_FREQUENCY 20000000 +// #define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3 + #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS +// #define SPI_FREQUENCY 80000000 + + +// Comment out the following #define if "SPI Transactions" do not need to be +// supported. Tranaction support is required if other SPI devices are connected. +// When commented out the code size will be smaller and sketches will +// run slightly faster, so leave it commented out unless you need it! +// Transaction support is needed to work with SD library but not needed with TFT_SdFat + +// #define SUPPORT_TRANSACTIONS diff --git a/User_Setups/Setup2_ST7735.h b/User_Setups/Setup2_ST7735.h new file mode 100644 index 0000000..54da24f --- /dev/null +++ b/User_Setups/Setup2_ST7735.h @@ -0,0 +1,150 @@ +// USER DEFINED SETTINGS +// +// The User_Setup header that will be called up is defined in User_Setup_Select.h +// +// Set driver type, fonts to be loaded, pins used and SPI control method etc +// +// If this file is editted correctly then all the library example sketches should +// run without the need to make any more changes for a particular hardware setup! + +// ################################################################################## +// +// Section 0. Call up the right driver file and any options for it +// +// ################################################################################## + +// Only define one driver, the other ones must be commented out +//#define ILI9341_DRIVER +#define ST7735_DRIVER + +// For ST7735 ONLY, define the type of display, originally this was based on the +// colour of the tab on the screen protector film but this is not always true, so try +// out the different options below if the screen does not display graphics correctly, +// e.g. colours wrong, mirror images, or tray pixels at the edges. +// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this +// this User_Setup file, then rebuild and upload the sketch to the board again: + +//#define ST7735_INITB +//#define ST7735_GREENTAB +//#define ST7735_GREENTAB2 +#define ST7735_REDTAB +//#define ST7735_BLACKTAB + +// ################################################################################## +// +// Section 1. Define the pins that are used to interface with the display here +// +// ################################################################################## + +// We must use hardware SPI, a minimum of 3 GPIO pins is needed. +// Typical setup for NodeMCU ESP-12 is : +// +// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT) +// Display LED to NodeMCU pin VIN (or 5V, see below) +// Display SCK to NodeMCU pin D5 +// Display SDI/MOSI to NodeMCU pin D7 +// Display DC (or AO)to NodeMCU pin D3 +// Display RESET to NodeMCU pin D4 (or RST, see below) +// Display CS to NodeMCU pin D8 (or GND, see below) +// Display GND to NodeMCU pin GND (0V) +// Display VCC to NodeMCU 5V or 3.3V +// +// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin +// +// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more +// SPI deivces (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS +// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin +// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected. +// +// The NodeMCU D0 pin can be used for RST +// +// See Section 2. below if DC or CS is connected to D0 +// +// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin +// If 5V is not available at a pin you can use 3.3V but backlight brightness +// will be lower. + +// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### + +// ModeMCU +#define TFT_CS D8 // Chip select control pin D8 +#define TFT_DC D3 // Data Command control pin +#define TFT_RST D4 // Reset pin (could connect to NodeMCU RST, see next line) +//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V + +// ESP32 Dev board (planned, not test/supported yet) +//#define TFT_CS 5 // Chip select control pin +//#define TFT_DC 2 // Data Command control pin +//#define TFT_RST 4 // Reset pin (could connect to Arduino RESET pin) +//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST + +// ################################################################################## +// +// Section 2. Define the way the DC and/or CS lines are driven +// +// ################################################################################## + +// Normally the library uses direct register access for the DC and CS lines for speed +// If D0 (GPIO16) is used for CS or DC then a different slower method must be used +// Uncomment one line if D0 is used for DC or CS +// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test +// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test + +// #define D0_USED_FOR_DC +// #define D0_USED_FOR_CS + +// ################################################################################## +// +// Section 3. Define the fonts that are to be used here +// +// ################################################################################## + +// Comment out the #defines below with // to stop that font being loaded +// The ESP8366 had plenty of memory so commenting out fonts is not normally necessary +// If all fonts are loaded the extra FLASH space required is about 17Kbytes... +// To save FLASH space only enable the fonts you need! + +#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH +#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters +#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters +#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm +#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:. +#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. +#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts + +// ################################################################################## +// +// Section 4. Define the character to be used to detemine the text bounding box for datum changes +// +// ################################################################################## + +#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline +#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline + + +// ################################################################################## +// +// Section 5. Other options +// +// ################################################################################## + +// Define the SPI clock frequency +// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails +// With a ST7735 display more than 27MHz may not work (spurious pixels and lines) + +// #define SPI_FREQUENCY 1000000 +// #define SPI_FREQUENCY 5000000 +// #define SPI_FREQUENCY 10000000 +// #define SPI_FREQUENCY 20000000 + #define SPI_FREQUENCY 27000000 // Maximum for my ST7735. It is actually 26.67MHz = 80/3 +// #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS +// #define SPI_FREQUENCY 80000000 + + +// Comment out the following #define if "SPI Transactions" do not need to be +// supported. Tranaction support is required if other SPI devices are connected. +// When commented out the code size will be smaller and sketches will +// run slightly faster, so leave it commented out unless you need it! +// Transaction support is needed to work with SD library but not needed with TFT_SdFat + +// #define SUPPORT_TRANSACTIONS diff --git a/User_Setups/SetupX_Template.h b/User_Setups/SetupX_Template.h new file mode 100644 index 0000000..ff513ea --- /dev/null +++ b/User_Setups/SetupX_Template.h @@ -0,0 +1,152 @@ +// USER DEFINED SETTINGS +// +// The User_Setup header that will be called up is defined in User_Setup_Select.h +// This file is a default template that can be copied to create new setup files +// Add the new header file to the list in User_Setup_Select.h +// +// Set driver type, fonts to be loaded, pins used and SPI control method etc +// +// If this file is editted correctly then all the library example sketches should +// run without the need to make any more changes for a particular hardware setup! + +// ################################################################################## +// +// Section 0. Call up the right driver file and any options for it +// +// ################################################################################## + +// Only define one driver, the other ones must be commented out +#define ILI9341_DRIVER +//#define ST7735_DRIVER + +// For ST7735 ONLY, define the type of display, originally this was based on the +// colour of the tab on the screen protector film but this is not always true, so try +// out the different options below if the screen does not display graphics correctly, +// e.g. colours wrong, mirror images, or tray pixels at the edges. +// Comment out ALL BUT ONE of these options for a ST7735 display driver, save this +// this User_Setup file, then rebuild and upload the sketch to the board again: + +//#define ST7735_INITB +//#define ST7735_GREENTAB +//#define ST7735_GREENTAB2 +//#define ST7735_REDTAB +//#define ST7735_BLACKTAB + +// ################################################################################## +// +// Section 1. Define the pins that are used to interface with the display here +// +// ################################################################################## + +// We must use hardware SPI, a minimum of 3 GPIO pins is needed. +// Typical setup for NodeMCU ESP-12 is : +// +// Display SDO/MISO to NodeMCU pin D6 (or leave disconnected if not reading TFT) +// Display LED to NodeMCU pin VIN (or 5V, see below) +// Display SCK to NodeMCU pin D5 +// Display SDI/MOSI to NodeMCU pin D7 +// Display DC (or AO)to NodeMCU pin D3 +// Display RESET to NodeMCU pin D4 (or RST, see below) +// Display CS to NodeMCU pin D8 (or GND, see below) +// Display GND to NodeMCU pin GND (0V) +// Display VCC to NodeMCU 5V or 3.3V +// +// The TFT RESET pin can be connected to the NodeMCU RST pin or 3.3V to free up a control pin +// +// With some displays such as the ILI9341 the TFT CS pin can be connected to GND if no more +// SPI deivces (e.g. an SD Card) are connected, in this case comment out the #define TFT_CS +// line below so it is NOT defined. Other displays such at the ST7735 require the TFT CS pin +// to be toggled during setup, so in these cases the TFT_CS line must be defined and connected. +// +// The NodeMCU D0 pin can be used for RST +// +// See Section 2. below if DC or CS is connected to D0 +// +// Note: only some versions of the NodeMCU provide the USB 5V on the VIN pin +// If 5V is not available at a pin you can use 3.3V but backlight brightness +// will be lower. + +// ###### EDIT THE PIN NUMBERS IN THE LINES FOLLOWING TO SUIT YOUR SETUP ###### + +// ModeMCU +#define TFT_CS D8 // Chip select control pin D8 +#define TFT_DC D3 // Data Command control pin +#define TFT_RST D4 // Reset pin (could connect to NodeMCU RST, see next line) +//#define TFT_RST -1 // Set TFT_RST to -1 if the display RESET is connected to NodeMCU RST or 3.3V + +// ESP32 Dev board (planned, not supported yet) +//#define TFT_CS 5 // Chip select control pin +//#define TFT_DC 2 // Data Command control pin +//#define TFT_RST 4 // Reset pin (could connect to Arduino RESET pin) +//#define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST + +// ################################################################################## +// +// Section 2. Define the way the DC and/or CS lines are driven +// +// ################################################################################## + +// Normally the library uses direct register access for the DC and CS lines for speed +// If D0 (GPIO16) is used for CS or DC then a different slower method must be used +// Uncomment one line if D0 is used for DC or CS +// DC on D0 = 6% performance penalty at 40MHz SPI running graphics test +// CS on D0 = 2% performance penalty at 40MHz SPI running graphics test + +// #define D0_USED_FOR_DC +// #define D0_USED_FOR_CS + +// ################################################################################## +// +// Section 3. Define the fonts that are to be used here +// +// ################################################################################## + +// Comment out the #defines below with // to stop that font being loaded +// The ESP8366 had plenty of memory so commenting out fonts is not normally necessary +// If all fonts are loaded the extra FLASH space required is about 17Kbytes... +// To save FLASH space only enable the fonts you need! + +#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH +#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters +#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters +#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm +#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:. +#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-. +#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts + +// ################################################################################## +// +// Section 4. Define the character to be used to detemine the text bounding box for datum changes +// +// ################################################################################## + +#define FF_HEIGHT '/' // '/' character used to set free font height above the baseline +#define FF_BOTTOM 'y' // 'y' character used to set free font height below baseline + + +// ################################################################################## +// +// Section 5. Other options +// +// ################################################################################## + +// Define the SPI clock frequency +// With an ILI9341 display 40MHz works OK, 80MHz sometimes fails +// With a ST7735 display more than 27MHz may not work (spurious pixels and lines) + +// #define SPI_FREQUENCY 1000000 +// #define SPI_FREQUENCY 5000000 +// #define SPI_FREQUENCY 10000000 +// #define SPI_FREQUENCY 20000000 +// #define SPI_FREQUENCY 27000000 // Actually sets it to 26.67MHz = 80/3 + #define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS +// #define SPI_FREQUENCY 80000000 + + +// Comment out the following #define if "SPI Transactions" do not need to be +// supported. Tranaction support is required if other SPI devices are connected. +// When commented out the code size will be smaller and sketches will +// run slightly faster, so leave it commented out unless you need it! +// Transaction support is needed to work with SD library but not needed with TFT_SdFat + +// #define SUPPORT_TRANSACTIONS diff --git a/library.json b/library.json index 226ce00..24fb4c1 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "TFT_eSPI", - "version": "0.01.0", + "version": "0.12.0", "keywords": "ILI9341, ST7735, ESP8266, TFT", "description": "A TFT SPI graphics library for ESP8266", "repository": diff --git a/library.properties b/library.properties index be0cbc6..b64640e 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=TFT_eSPI -version=0.10 +version=0.12 author=Bodmer maintainer=Bodmer sentence=A fast TFT library for ESP8266 processors and the Arduino IDE