Commit Graph

192 Commits

Author SHA1 Message Date
Bodmer c689b4211d Add FLASH based anti-aliased fonts
Processors (such as STM32) that are not supported by a SPIFFS library can now use anti-aliased (smooth) fonts stored in FLASH (program) memory.
2020-02-14 23:54:37 +00:00
Bodmer 443be934a7 Add PSRAM switch
Typical use to disable use of PSRAM for the sprite storage:
sprite.setAttribute(PSRAM_ENABLE, false); // true to enable
Minor update for recent button class update
2020-02-06 20:34:36 +00:00
Bodmer 15c137633a Raise version add comments for button update 2020-02-06 13:38:03 +00:00
Bodmer 8146ac3015
Move include for User_Setup_Select.h (#537)
Requested change in #537
2020-02-02 17:32:46 +00:00
Bodmer c8530d7ae4 4 bpp Sprite bug fix
OR has precedence over AND so brackets needed.
Remove unused varaible.
2020-02-01 01:43:16 +00:00
Bodmer 8209c00316 Add new alphaBlend functions
Added 24 bit colour handling alphaBlend to reduce precision loss in multiple blend stages (e.g. in 2D colour gradients). Added option for alpha dither to reduce colour banding in gradients with 16 bit colours.

Get rid of compile warnings.
2020-01-30 16:01:36 +00:00
Bodmer 0e0fd75277 Raise to version 2.0.0
The library has been cleaned up as it has got a bit untidy due to the large number of small incremental changes.

4bit Sprite examples renaed to be consistent with others.

alphaBlend example moved to generic folder (alphaBlend fn was moved to TFT_eSPI class).
Added sections + explanatory comments to functions prototypes.

Temporary comments added for potential gotchas for noobs when using DMA.

spi_begin/end functions renamed to reflect functionality. Old fns  retained for backwards compatibility with user setup.h files.
2020-01-26 21:17:49 +00:00
kamorris e019b6dcf6 added color maps and examples 2020-01-24 22:07:45 -08:00
Bodmer 7f53a571f4 Add STM32 and generic processor support 2020-01-11 23:32:10 +00:00
Bodmer 1476da56ba Restructured code, added ST7796
RPi MHS-4.0 inch Display-B type display now supported.
2020-01-11 00:58:38 +00:00
Bodmer d02fe55c46
Fix #503
The s60sc Adafruit_Touch library fork for the ESP32 parallel mode uses the TFT_WR pin as an analogue input to read the screen resistance.  The TFT_eSPI library kept TFT_CS low permanently for performance reasons, but when used with the touch library a low analogue value on the TFT_WR pin will write spurious data to the display. 

This change toggle TFT_CS so it is only low during TFT parallel bus writes. The performance reduction is small.
2020-01-02 11:53:50 +00:00
Bodmer 5bb14ba2d8 Add new callback for smooth font antialiasing
Callback allows anitaliased fonts to be rendered over colour gradients
or images.
"Smooth_font_reading_TFT" example added
"Smooth_font_gradient" example added
Minor changes to avoid signed/unsigned comparison warnings.
2019-11-10 02:23:22 +00:00
Bodmer 27b6509f27 Raise version 2019-10-22 23:02:41 +01:00
Bodmer e9d405ea1f Fix image cropping bug plus minor update
Images/sprites overlapping both sides of the display were not correctly
cropped.
Option added to allow RGB<>BGR colourr swap option to be used.
ESP8266 Wemos D1 R1 pin numbering difference accomodated.
TTGO T4 setup changed to use HSPI port.
2019-10-21 22:56:35 +01:00
Bodmer 4f68cf90e8
update diagnostic version number 2019-08-08 09:56:52 +01:00
Bodmer 197c408d7d
Corrrect byte swap for 18 bit colours 2019-05-19 09:22:04 +01:00
Bodmer 9f17920115 Add ESP32 SD support for smooth font plus performance updates
Added SD card storage for smooth fonts with ESP32
ESP32 will use PSRAM (if available and enabled) to hold smooth font
metrics
Improve performance of ESP32 Sprite shared functions
Add basic ST7789 driver option
Latent bug fixes for pin mask
2019-04-15 12:23:16 +01:00
Bodmer e17ba463c9 Add UTF-8 on/off control via new setAttribute function
No change to legacy sketches meeded, UTF-8 decoding is on by default.
Add colour test example.
2019-02-17 22:35:49 +00:00
Bodmer 26d7e4038a Fix touch screen handler
The touch screen handler was broken for the ESP8266 only. The library
uses SPI write only configuration for ESP8266 so the SPI buffer can be
recycled and it was left in write only mode. The library now switches
back to read & write mode at the end of a transaction.
2019-02-14 00:32:16 +00:00
Bodmer 35a402f6a8 Raise issue in header 2019-02-10 21:38:34 +00:00
Bodmer 1e1e888fa0 Support extended font formats
Adafruit_GFX font support extended to Unidode Basic Multilingual Plane
Print stream deocdes UTF-8
Smooth font ascent and descent (affects line spacing) changed to rely on
metrics provided by Processing IDE (issue #303)
Bug fix for font rendering with no background on RLE native fonts
2019-02-10 21:36:40 +00:00
Bodmer b5a74a016a
Fix #301 2019-02-10 01:25:34 +00:00
Bodmer 091d8cd231 Fix issue #297
There is a bug in the ESP8266 Arduino core that averwrites the overlap
mode setup and hold bits for the hardware driven SPI SS line.  The
TFT_eSPI library has been patched as a work-around.

In overlap mode to maintain the required setup and hold times at 80MHz
ESP8266 CPU clock the SPI rate must be 27MHz or less. At 160MHz CPU
clock the SPI rate can be 40MHz.
2019-02-03 21:54:24 +00:00
Bodmer caef4519f3 Improve bounds checking update CS management
Add bounds checking to graphics functions
Rationalise variable types and style used to minimse type casting needs
(this change ended up being a more extensive refactoring than
anticipated - but once started...)
Add version reporting to diagnostic sketch
Boost PDQ graphicstest performance
2019-01-25 14:25:40 +00:00
Bodmer 11ef56d48c Test slower DC and CS lines for a user 2019-01-23 20:55:04 +00:00
Bodmer 054a824eb8 Add ESP32 VSPI or HSPI port option + others
If the VSPI port is in use and pins are not accessible (e.g. TTGO
T-Beam)
then add or uncomment the following line in the setup header file:
//#define USE_HSPI_PORT

Minor performance tweaks for ESP32 to minimise the occurence of the slow
transaction overhead.

setAddrWindow now takes xstart, ystart, width and height as inputs

Multi-sample raw touch x and y for noisy displays

Example update for setAddrWindow change compatibility
2019-01-22 18:41:31 +00:00
Bodmer 05359a4dff Misc updates
Speed up Sprite rotation on an ESP32
Update utf8 serial decoder to handle illegal format strings
Remove need for D0_USED_FOR_xx (issue #271)
Clean up setup files
Correct various comment typos
2019-01-06 17:45:06 +00:00
Bodmer 96228cbf44 Add Sprite rotation and examples
Sprites can be rendered rotated with defined pivot points, 3 new
examples have been added "Rotated_Sprite_1/2/3".
The FLASH bitmap example has been moved to the Generic examples folder.
Boundary checks have been added to pushImage()
A new scrolling and wrapping in a Sprite example has been added.
2019-01-06 01:14:10 +00:00
Bodmer e0aa312dfa Slow down the RPi strobes but keep fast for other displays 2018-11-28 22:23:52 +00:00
Bodmer d23f0b00c0
Correct typo causing error message 2018-11-28 01:02:15 +00:00
Bodmer 467d1dc3c5 Fix issue #260 2018-11-26 19:50:52 +00:00
Bodmer beda811a3a Add R61581 driver as detailed in #238
Not tested by Bodmer, tested by s60sc as in #238
2018-11-25 19:41:29 +00:00
Bodmer e01ea43baf Fix SPI incompatibility
I fixed the parallel and broke the SPI, now both work!
2018-11-25 03:47:54 +00:00
Bodmer 5e62875ff5 Fix issue #256
Parallel compatibility lost during recent updates.
Now working again.
2018-11-25 03:15:16 +00:00
Bodmer d13f84e4a6 Re-work the support for bi-directional SDA line
Tested on ESP32 and ST7789V display only. It may not work with other
displays!

Use:
#define TFT_SDA_READ

in setup file to use bi-directional SDA pin support.
2018-11-24 01:30:41 +00:00
Bodmer 1cf2305e4d Add capability to read TFT SDA bi-directional pin
Tested on an ESP32 with ST7789V display
SDA read is very slow on an ESP8266 (to be investigated)
Added new setup #define TFT_SDA_READ
Add new ESP32 and ESP8266 compatible in example/Generic folder to test
capture of TFT screen
2018-11-23 03:09:07 +00:00
Bodmer ac7a229301 Remove setAddressWindow change for ESP32
Corner case caused missed graphics.
2018-11-16 00:54:51 +00:00
Bodmer 7a3d6bcab9 Minor performance improvements for ESP32
Remove legacy changes for double buffered SPI
Eliminate unecessary ESP32 SPI read/modify write
Eliminate two stage control bit changes (may impact some diplays with
setup/hold  timing and show ESP32 hardware register bug?)
Add single register write for CS and DC command
Make setAddrWindow smarter (as used in previous AVR library)
Improve compatibility with GFX sketches
Re-arrange comments slightly to improve positioning
2018-11-14 01:05:16 +00:00
Bodmer 1a0b37097a Add new anti-aliased (smooth) font examples + bug fixes
Four new examples have been added to show different methods of rendering
the anta-aliased fonts.  A few minor bugs have been corrected associated
with the font rendering. drawNumber and drawFloat handle fixed width
mono fonts with no digit movement.
2018-10-21 17:53:27 +01:00
Bodmer 73c1831e7b Add option for a different TFT read SPI frequency
#define SPI_READ_FREQUENCY  20000000 // Optional reduced SPI frequency
for reading TFT

Also weeded out some compiler warnings
2018-07-29 15:00:09 +01:00
Bodmer 40e2c8dc74 Update so read TFT works for ILI9488 SPI display
Small performance improvement for ILI9488
2018-07-11 20:30:39 +01:00
Bodmer 5b0d96d64d Completed support for SPI ILI9488
Setup20 added for ESP8266 and Setup21 addwd for ESP32
2018-07-07 22:41:53 +01:00
Bodmer 51ed23af0f Support ST7789 rotation offset and boards with no chip select
Other minor changes to tidy code up
Put back in ability to call init() multiple times in sketch
2018-07-06 18:48:24 +01:00
Bodmer 96a4df7214
Missing #define 2018-05-29 00:24:20 +01:00
Bodmer 4a52f5e685 Add ability to set ST7735 tab color from sketch
Use line is form:
tft.init(1);
or:
tft.init(INITR_REDTAB);
// Enumerated the configurations in library are:
#define INITR_GREENTAB
0x0
#define INITR_REDTAB    0x1
#define INITR_BLACKTAB  0x2
#define
INITR_GREENTAB2 0x3 // Use if you get random pixels on two edges of
green tab display
#define INITR_GREENTAB3 0x4 // Use if you get random
pixels on edge(s) of 128x128 screen
#define INITR_GREENTAB128 0x5 // Use
if you only get part of 128x128 screen in rotation 0 & 1
#define INITB
0xB
2018-05-25 22:48:22 +01:00
Bodmer 2a9f7030d8 Fix #111 2018-04-23 20:29:52 +01:00
Bodmer 54b3f0f63d Add drawXBitmap() function and example
Example is in Generic folder, draw the Espressif logo on the screen.
2018-04-23 17:16:18 +01:00
Bodmer 6213de3ab9 Use direct write, fix bug for TFT_CS pin >31 2018-04-22 20:38:55 +01:00
Bodmer 235f89e755 Allow ESP32 pin numbers greater than 31 for CS and DC 2018-04-21 22:49:17 +01:00
Bodmer 7cbf6fe048 Make some variables public
To allow access to variables that can be set via functions anyway.
2018-04-21 09:50:41 +01:00
Bodmer 4d181d7a19 Fix bug #122 by different approach 2018-04-21 09:50:41 +01:00
Bodmer f56184e9cd Add diagnostic sketches
Do not load button class is touch screen chip select not defined
2018-04-11 01:03:26 +01:00
Bodmer 7f98aeb63f Bug fix for Issue #114
The ESP32 now works OK with the RPi display.
2018-04-01 15:27:10 +01:00
Bodmer 9276b0162d Add support for 1 bit per pixel in Sprite class
This is stage one of support for ePaper displays from Waveshare.
Examples for 1 bit per pixel Sprites and 2 or 3 colour ePaper displays
to follow soon.
2018-03-26 01:02:23 +01:00
Bodmer 972d852346 Correct issue #104 and update setup files
Macro name (transfer16) conflict with SPI library fixed
Smooth font option added to User Setup files
Narrow font 8 option added to User Setup files
2018-03-12 22:49:18 +00:00
Bodmer a00011c2df Add 8 bit parallel TFT support for ESP32
Add interface driver macro
Add 8 bit parallel support
Add 8 bit parallel read support
Add ILI9481, ILI9488 and HX8357D drivers
Update version and ReadMe
Update Create_Font processing sketch
Add slightly narrower alternative font 8
2018-03-10 23:08:57 +00:00
Bodmer 8752236ac2 Add smooth (antialiased) fonts 2018-02-24 19:02:20 +00:00
Bodmer 2fbc2e4adf Add text for ESP8266 overlap mode, add workaround for ESP32 silicon bug 2018-02-22 22:28:23 +00:00
Bodmer f3190fde71 Allow init() to be called in sketch to reset and re-initialise TFT
Solution to Issue #85
2018-01-27 19:22:42 +00:00
Bodmer 1f84ab0885 Reinstate 8bit pushColors()
Permits backwards compatibility
2018-01-27 13:46:59 +00:00
Bodmer b2e4e69f7a Fix Issue #81 2018-01-27 02:35:25 +00:00
Bodmer 6c993f8fd2 Add getCursorX() and getCursorY() functions
As requested in Issue #79

Function names are compatible with Adafruit_GFX

Also trimmed out duplicate keywords
2018-01-26 15:19:40 +00:00
Bodmer aa2c79a25f Performance enhancements, new functions, bug fixes
1. Ability to swap bytes in pushColors() and pushImage()
2. pushImage() will handle FLASH stroed images
3. pushImage() will accept a transparent color
4. pushRect() deprecated but still works
5. setSwapBytes() to set swapping bytes in color for pushImage() and
pushColors() true or false
6. getSwapBytes() returns swap bytes parameter
7. fillCircle() and fillCircleHelper() changed to use horizontal lines
to speed up plotting in a sprite
8. fillTriangle bug fix by moving spi_begin()
9  Small performance improvement to setAddrWindow()
10. pushColor() bug fix for swapped bytes
11. pushColors() performance improvement for ESP8266 and add optional
byte swap parameter, accepts higher pixel count
12. move spi_begin() later in drawLine() incase fn returns early
13. add spi_end() in drawLine incdae return occurs early
14. Add color332() fn to convert 16 bit to 8 bit colour
15. Sprite: createSprite() checks if sprite already created and returns
pointer if it does
16. Sprite: one extra "off-screen pixel added to a sprite to point
out-of-bounds setWindow coords to
this avoids extra bounds checks in push/write color
17. Sprite: setColorDepth allows changing of depthe for existing sprtie
and returns a new pointer to the new sprite
18. Sprite: pushImage() accepts a swapped byte parameter
19. Sprite: setSwapBytes() to set swapping bytes in color for
pushImage() and pushColors() true or false
20. Sprite: getSwapBytes() returns swap bytes parameter
21. Sprite: setWindow deals with duff out of sprite coords.
22. Sprite: bug in draw char corrected which could draw too many
over-writing pixels
2018-01-08 23:19:42 +00:00
Bodmer 936b5cccc7 Add default touch detect threshold 2017-12-22 00:02:31 +00:00
Bodmer 2e84218ecb Add touch pressure hysterisis and user defined sensitivity
getTouch accepts a third optional pressure threshold, default is 600,
increasing means harder presses are needed.
getTouch(uint16_t *x, uint16_t *y, uint16_t threshold = 600);
2017-12-21 23:16:11 +00:00
Bodmer 93ba6e3716 Add scrolling inside a sprite
Added example "Sprite_scroll"
Tidy up virtual function list
Add PROGMEM bitmap image functions
2017-12-10 23:04:31 +00:00
Bodmer d2104f6d85 Add ability to plot Sprites with a "transparent" colour
Can now specify a colour that will not be plotted so some part of the
Sprite are "transparent" and the TFT backforund shows through. New
example added for demonstration.
2017-12-03 02:29:39 +00:00
turiphro b97324875d Fix width/height override issue when using setRotation
This commit fixes an issue when setting screen width
and height from the constructor (e.g., user sketch),
followed by setRotation(i). Previously, setRotation
used TFT_WIDTH and TFT_HEIGHT, ignoring user overrides.
2017-11-26 18:06:11 -08:00
Bodmer 312b7c1128 Tidy up 8 bit sprite code and fix gugs
Minor tweaks and speed improvements
2017-11-24 14:12:29 +00:00
Bodmer 3e3d638bba Add support for 8 bit color sprites (needs less RAM)
Added setColorDepth(d) where "d" is 8 or 16.
Default is 16 bit if not specified.
2017-11-21 22:57:11 +00:00
Bodmer 943c18facf Add sprite class
Sprites (images) can now be created in RAM, written to with text and
graphics and rendered to screen quickly, this makes it easier to get
flicker frre screen updates.
ESP8266 can typically create up to a 160x128 sprite, and ESP32 about
200x200 pixels. 16 bit colour only at the moment, may soon implement 8
bit colour to reduce RAM.
2017-11-15 20:26:22 +00:00
Bodmer 2333e1ab5c Initialise touch parameterswith example calibration values
This avoids a processor crash it setTouch() not called in setup()
2017-11-04 20:56:26 +00:00
Bodmer 8734a05d3e Update touch handler to work with ESP32
Adde Setup11... for testing with ESP32
2017-11-04 19:11:50 +00:00
Bodmer 0562594ae3 Fix issue #49 2017-11-02 01:49:35 +00:00
Bodmer e4ea506b65 Update touch, add Button class
Touch reliability improved by using pressure and double sampling. Added
Adafruit compatible Button class. Added touchscreen on/off and keypad
examples.
2017-10-23 01:59:37 +01:00
Bodmer f907ac31b7 Tidy up code merge 2017-10-16 23:26:54 +01:00
Max 548fcca258 now calibration works with all orientations. 2017-10-01 21:34:11 +02:00
Max 944e505f36 Add XPT2046 touch controller support
supports esp8266 + RPi displays
2017-10-01 00:32:30 +02:00
Bodmer 6b794e1eb3 Add SPI overlap support Issue #26
Note, must use latest ESP board package with support for the overlap
mode
2017-07-15 18:44:49 +01:00
Bodmer 2d0f580a38 Silicon bug work-around for Issue #21
There is a silicon bug in the ESP32, writing the same value to a
register twice sometimes fails. TFT_CS needs a delay though, so the fix
is to write two different values to the register.
2017-06-16 13:45:49 +01:00
Bodmer c52db6bf59 Add ESP32 compatibility
Tested with ILI9341 only so far!
2017-05-20 01:37:58 +01:00
Bodmer 40d35b1892 Examples menu now based on resolution
Reference to particular drivers in examples have been removed as
multiple display drivers are now supported.
Tabs replaced by spaces in header file by file editor.
RPi TFT with write strobe SPI clock rate dropped to 20MHz (display
cannot cope with new high rate siWriteBlock() function)
2017-04-24 22:35:11 +01:00
Bodmer 8e996c0257 Minor bug fixes plus faster block write function added 2017-04-23 18:50:53 +01:00
Bodmer e65f4cb1fe Rename swap() to avoid clashes
Increment version
2017-04-13 00:20:19 +01:00
Bodmer c5fafdd71c Minor performance tweaks
Plus code tidy and typo corrections
2017-03-28 23:56:54 +01:00
Bodmer d3d877c8e2 Add RPi display support for write strobe mod 2017-03-27 02:15:30 +01:00
Bodmer 0fe1acf6cb Allow MISO (D6) to be used as DC or CS pin 2017-03-12 03:31:51 +00:00
Bodmer a427626cfc Weed out legacy variables, add readAddrWindow()
readAddrWindow is a private function to support pixel and block reads of
the TFT screen. Tested on ILI9341.
2017-03-11 16:59:34 +00:00
Bodmer 406aac051e Update to screenshot sketches + others
Minor tweaks and re-arrangement of User and Custom font references
between header files
2017-03-10 19:16:31 +00:00
Bodmer 37687da0f3 Correct \ in file path to / for Windows and Linux comaptibility 2017-03-09 22:42:08 +00:00
Bodmer cd356bb6c5 Add S6D02A1 and ILI9163 driver code 2017-02-26 03:03:47 +00:00
Bodmer e1b2959577 First draft release
Not yet fully tested but seems to work OK!
2017-02-22 03:07:17 +00:00