From 510321f2e161b40086bf1206cc7d043d9f2e08ce Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 21 Aug 2018 16:28:18 +0200 Subject: [PATCH] Change to latest GFX/ILI9341 libs Change to latest Adafruit GFX and ILI9341 libraries (saves 300 bytes ;-) --- lib/Adafruit-GFX-Library-1.2.9/.gitignore | 6 + lib/Adafruit-GFX-Library-1.2.9/.travis.yml | 27 + .../Adafruit_GFX.cpp | 794 ++++++++++++++++-- .../Adafruit_GFX.h | 38 +- .../Adafruit_SPITFT.cpp | 555 ++++++++++++ .../Adafruit_SPITFT.h | 125 +++ .../Adafruit_SPITFT_Macros.h | 16 +- .../Fonts/FreeMono12pt7b.h | 0 .../Fonts/FreeMono18pt7b.h | 0 .../Fonts/FreeMono24pt7b.h | 0 .../Fonts/FreeMono9pt7b.h | 0 .../Fonts/FreeMonoBold12pt7b.h | 0 .../Fonts/FreeMonoBold18pt7b.h | 0 .../Fonts/FreeMonoBold24pt7b.h | 0 .../Fonts/FreeMonoBold9pt7b.h | 0 .../Fonts/FreeMonoBoldOblique12pt7b.h | 0 .../Fonts/FreeMonoBoldOblique18pt7b.h | 0 .../Fonts/FreeMonoBoldOblique24pt7b.h | 0 .../Fonts/FreeMonoBoldOblique9pt7b.h | 0 .../Fonts/FreeMonoOblique12pt7b.h | 0 .../Fonts/FreeMonoOblique18pt7b.h | 0 .../Fonts/FreeMonoOblique24pt7b.h | 0 .../Fonts/FreeMonoOblique9pt7b.h | 0 .../Fonts/FreeSans12pt7b.h | 0 .../Fonts/FreeSans18pt7b.h | 0 .../Fonts/FreeSans24pt7b.h | 0 .../Fonts/FreeSans9pt7b.h | 0 .../Fonts/FreeSansBold12pt7b.h | 0 .../Fonts/FreeSansBold18pt7b.h | 0 .../Fonts/FreeSansBold24pt7b.h | 0 .../Fonts/FreeSansBold9pt7b.h | 0 .../Fonts/FreeSansBoldOblique12pt7b.h | 0 .../Fonts/FreeSansBoldOblique18pt7b.h | 0 .../Fonts/FreeSansBoldOblique24pt7b.h | 0 .../Fonts/FreeSansBoldOblique9pt7b.h | 0 .../Fonts/FreeSansOblique12pt7b.h | 0 .../Fonts/FreeSansOblique18pt7b.h | 0 .../Fonts/FreeSansOblique24pt7b.h | 0 .../Fonts/FreeSansOblique9pt7b.h | 0 .../Fonts/FreeSerif12pt7b.h | 0 .../Fonts/FreeSerif18pt7b.h | 0 .../Fonts/FreeSerif24pt7b.h | 0 .../Fonts/FreeSerif9pt7b.h | 0 .../Fonts/FreeSerifBold12pt7b.h | 0 .../Fonts/FreeSerifBold18pt7b.h | 0 .../Fonts/FreeSerifBold24pt7b.h | 0 .../Fonts/FreeSerifBold9pt7b.h | 0 .../Fonts/FreeSerifBoldItalic12pt7b.h | 0 .../Fonts/FreeSerifBoldItalic18pt7b.h | 0 .../Fonts/FreeSerifBoldItalic24pt7b.h | 0 .../Fonts/FreeSerifBoldItalic9pt7b.h | 0 .../Fonts/FreeSerifItalic12pt7b.h | 0 .../Fonts/FreeSerifItalic18pt7b.h | 0 .../Fonts/FreeSerifItalic24pt7b.h | 0 .../Fonts/FreeSerifItalic9pt7b.h | 0 .../Fonts/Org_01.h | 0 .../Fonts/Picopixel.h | 0 .../Fonts/Tiny3x3a2pt7b | 0 .../Fonts/TomThumb.h | 0 .../README.md | 8 +- .../examples/mock_ili9341/mock_ili9341.ino} | 0 .../fontconvert/Makefile | 0 .../fontconvert/fontconvert.c | 0 .../fontconvert/fontconvert_win.md | 0 .../fontconvert/makefonts.sh | 0 lib/Adafruit-GFX-Library-1.2.9/gfxfont.h | 29 + .../glcdfont.c | 0 .../library.properties | 2 +- .../license.txt | 0 lib/Adafruit_GFX-1.2.2.07/.gitignore | 2 - lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.cpp | 336 -------- lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.h | 80 -- lib/Adafruit_GFX-1.2.2.07/gfxfont.h | 24 - .../Adafruit_ILI9341.cpp | 683 --------------- .../Adafruit_ILI9341.h | 205 ----- .../.github/ISSUE_TEMPLATE.md | 0 .../.github/PULL_REQUEST_TEMPLATE.md | 0 .../.gitignore | 4 + .../.travis.yml | 38 + .../Adafruit_ILI9341.cpp | 282 +++++++ .../Adafruit_ILI9341.h | 144 ++++ .../README.md} | 18 +- .../breakouttouchpaint/.esp8266.test.skip | 0 .../breakouttouchpaint/breakouttouchpaint.ino | 0 .../fulltest_featherwing/.mega2560.test.skip | 0 .../fulltest_featherwing.ino | 30 +- .../examples/graphicstest/graphicstest.ino | 365 ++++++++ .../.mega2560.test.skip | 0 .../graphicstest_featherwing.ino | 21 +- .../examples/onoffbutton/onoffbutton.ino | 0 .../onoffbutton_breakout/.esp8266.test.skip | 0 .../onoffbutton_breakout.ino | 0 .../examples/pictureEmbed/dragon.h | 0 .../examples/pictureEmbed/pictureEmbed.ino | 0 .../examples/spitftbitmap/spitftbitmap.ino | 0 .../examples/touchpaint/touchpaint.ino | 0 .../.mega2560.test.skip | 0 .../touchpaint_featherwing.ino | 21 +- .../library.properties | 2 +- 99 files changed, 2389 insertions(+), 1466 deletions(-) create mode 100644 lib/Adafruit-GFX-Library-1.2.9/.gitignore create mode 100644 lib/Adafruit-GFX-Library-1.2.9/.travis.yml rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Adafruit_GFX.cpp (52%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Adafruit_GFX.h (81%) create mode 100644 lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT.cpp create mode 100644 lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT.h rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Adafruit_SPITFT_Macros.h (90%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMono12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMono18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMono24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMono9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoBold12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoBold18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoBold24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoBold9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoBoldOblique12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoBoldOblique18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoBoldOblique24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoBoldOblique9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoOblique12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoOblique18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoOblique24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeMonoOblique9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSans12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSans18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSans24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSans9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansBold12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansBold18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansBold24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansBold9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansBoldOblique12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansBoldOblique18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansBoldOblique24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansBoldOblique9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansOblique12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansOblique18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansOblique24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSansOblique9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerif12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerif18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerif24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerif9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifBold12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifBold18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifBold24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifBold9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifBoldItalic12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifBoldItalic18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifBoldItalic24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifBoldItalic9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifItalic12pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifItalic18pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifItalic24pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/FreeSerifItalic9pt7b.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/Org_01.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/Picopixel.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/Tiny3x3a2pt7b (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/Fonts/TomThumb.h (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/README.md (83%) rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/graphicstest/graphicstest.ino => Adafruit-GFX-Library-1.2.9/examples/mock_ili9341/mock_ili9341.ino} (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/fontconvert/Makefile (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/fontconvert/fontconvert.c (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/fontconvert/fontconvert_win.md (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/fontconvert/makefonts.sh (100%) create mode 100644 lib/Adafruit-GFX-Library-1.2.9/gfxfont.h rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/glcdfont.c (100%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/library.properties (96%) rename lib/{Adafruit_GFX-1.2.2.07 => Adafruit-GFX-Library-1.2.9}/license.txt (100%) delete mode 100644 lib/Adafruit_GFX-1.2.2.07/.gitignore delete mode 100644 lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.cpp delete mode 100644 lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.h delete mode 100644 lib/Adafruit_GFX-1.2.2.07/gfxfont.h delete mode 100644 lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/Adafruit_ILI9341.cpp delete mode 100644 lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/Adafruit_ILI9341.h rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/.github/ISSUE_TEMPLATE.md (100%) rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/.github/PULL_REQUEST_TEMPLATE.md (100%) create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.gitignore create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.travis.yml create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/Adafruit_ILI9341.cpp create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/Adafruit_ILI9341.h rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0/README.txt => Adafruit_ILI9341-1.2.0-Tasmota-1.0/README.md} (60%) create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/breakouttouchpaint/.esp8266.test.skip rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/breakouttouchpaint/breakouttouchpaint.ino (100%) create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/fulltest_featherwing/.mega2560.test.skip rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/fulltest_featherwing/fulltest_featherwing.ino (93%) create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest/graphicstest.ino create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest_featherwing/.mega2560.test.skip rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/graphicstest_featherwing/graphicstest_featherwing.ino (97%) rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/onoffbutton/onoffbutton.ino (100%) create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/onoffbutton_breakout/.esp8266.test.skip rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/onoffbutton_breakout/onoffbutton_breakout.ino (100%) rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/pictureEmbed/dragon.h (100%) rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/pictureEmbed/pictureEmbed.ino (100%) rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/spitftbitmap/spitftbitmap.ino (100%) rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/touchpaint/touchpaint.ino (100%) create mode 100644 lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/touchpaint_featherwing/.mega2560.test.skip rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/examples/touchpaint_featherwing/touchpaint_featherwing.ino (94%) rename lib/{Adafruit_ILI9341-1.0.11-Tasmota-1.0 => Adafruit_ILI9341-1.2.0-Tasmota-1.0}/library.properties (94%) diff --git a/lib/Adafruit-GFX-Library-1.2.9/.gitignore b/lib/Adafruit-GFX-Library-1.2.9/.gitignore new file mode 100644 index 000000000..469bb7370 --- /dev/null +++ b/lib/Adafruit-GFX-Library-1.2.9/.gitignore @@ -0,0 +1,6 @@ +default.vim +fontconvert/fontconvert +# Our handy .gitignore for automation ease +Doxyfile* +doxygen_sqlite3.db +html \ No newline at end of file diff --git a/lib/Adafruit-GFX-Library-1.2.9/.travis.yml b/lib/Adafruit-GFX-Library-1.2.9/.travis.yml new file mode 100644 index 000000000..a856c6db6 --- /dev/null +++ b/lib/Adafruit-GFX-Library-1.2.9/.travis.yml @@ -0,0 +1,27 @@ +language: c +sudo: false +cache: + directories: + - ~/arduino_ide + - ~/.arduino15/packages/ +git: + depth: false + quiet: true +env: + global: + - ARDUINO_IDE_VERSION="1.8.5" + - PRETTYNAME="Adafruit GFX Library" + +before_install: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh) + +install: + - arduino --install-library "Adafruit ILI9341" + +script: + - build_main_platforms + +# Generate and deploy documentation +after_success: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh) + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh) \ No newline at end of file diff --git a/lib/Adafruit_GFX-1.2.2.07/Adafruit_GFX.cpp b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_GFX.cpp similarity index 52% rename from lib/Adafruit_GFX-1.2.2.07/Adafruit_GFX.cpp rename to lib/Adafruit-GFX-Library-1.2.9/Adafruit_GFX.cpp index 53c7ad35c..c431a17c8 100644 --- a/lib/Adafruit_GFX-1.2.2.07/Adafruit_GFX.cpp +++ b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_GFX.cpp @@ -70,6 +70,13 @@ POSSIBILITY OF SUCH DAMAGE. #define _swap_int16_t(a, b) { int16_t t = a; a = b; b = t; } #endif +/**************************************************************************/ +/*! + @brief Instatiate a GFX context for graphics! Can only be done by a superclass + @param w Display width, in pixels + @param h Display height, in pixels +*/ +/**************************************************************************/ Adafruit_GFX::Adafruit_GFX(int16_t w, int16_t h): WIDTH(w), HEIGHT(h) { @@ -84,7 +91,16 @@ WIDTH(w), HEIGHT(h) gfxFont = NULL; } -// Bresenham's algorithm - thx wikpedia +/**************************************************************************/ +/*! + @brief Write a line. Bresenham's algorithm - thx wikpedia + @param x0 Start point x coordinate + @param y0 Start point y coordinate + @param x1 End point x coordinate + @param y1 End point y coordinate + @param color 16-bit 5-6-5 Color to draw with +*/ +/**************************************************************************/ void Adafruit_GFX::writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) { int16_t steep = abs(y1 - y0) > abs(x1 - x0); @@ -125,17 +141,35 @@ void Adafruit_GFX::writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, } } +/**************************************************************************/ +/*! + @brief Start a display-writing routine, overwrite in subclasses. +*/ +/**************************************************************************/ void Adafruit_GFX::startWrite(){ - // Overwrite in subclasses if desired! } +/**************************************************************************/ +/*! + @brief Write a pixel, overwrite in subclasses if startWrite is defined! + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::writePixel(int16_t x, int16_t y, uint16_t color){ - // Overwrite in subclasses if startWrite is defined! drawPixel(x, y, color); } -// (x,y) is topmost point; if unsure, calling function -// should sort endpoints or call writeLine() instead +/**************************************************************************/ +/*! + @brief Write a perfectly vertical line, overwrite in subclasses if startWrite is defined! + @param x Top-most x coordinate + @param y Top-most y coordinate + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) { // Overwrite in subclasses if startWrite is defined! @@ -144,8 +178,15 @@ void Adafruit_GFX::writeFastVLine(int16_t x, int16_t y, drawFastVLine(x, y, h, color); } -// (x,y) is leftmost point; if unsure, calling function -// should sort endpoints or call writeLine() instead +/**************************************************************************/ +/*! + @brief Write a perfectly horizontal line, overwrite in subclasses if startWrite is defined! + @param x Left-most x coordinate + @param y Left-most y coordinate + @param w Width in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) { // Overwrite in subclasses if startWrite is defined! @@ -154,39 +195,74 @@ void Adafruit_GFX::writeFastHLine(int16_t x, int16_t y, drawFastHLine(x, y, w, color); } +/**************************************************************************/ +/*! + @brief Write a rectangle completely with one color, overwrite in subclasses if startWrite is defined! + @param x Top left corner x coordinate + @param y Top left corner y coordinate + @param w Width in pixels + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) { // Overwrite in subclasses if desired! fillRect(x,y,w,h,color); } +/**************************************************************************/ +/*! + @brief End a display-writing routine, overwrite in subclasses if startWrite is defined! +*/ +/**************************************************************************/ void Adafruit_GFX::endWrite(){ - // Overwrite in subclasses if startWrite is defined! } -// (x,y) is topmost point; if unsure, calling function -// should sort endpoints or call drawLine() instead +/**************************************************************************/ +/*! + @brief Draw a perfectly vertical line (this is often optimized in a subclass!) + @param x Top-most x coordinate + @param y Top-most y coordinate + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) { - // Update in subclasses if desired! startWrite(); writeLine(x, y, x, y+h-1, color); endWrite(); } -// (x,y) is leftmost point; if unsure, calling function -// should sort endpoints or call drawLine() instead +/**************************************************************************/ +/*! + @brief Draw a perfectly horizontal line (this is often optimized in a subclass!) + @param x Left-most x coordinate + @param y Left-most y coordinate + @param w Width in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) { - // Update in subclasses if desired! startWrite(); writeLine(x, y, x+w-1, y, color); endWrite(); } +/**************************************************************************/ +/*! + @brief Fill a rectangle completely with one color. Update in subclasses if desired! + @param x Top left corner x coordinate + @param y Top left corner y coordinate + @param w Width in pixels + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) { - // Update in subclasses if desired! startWrite(); for (int16_t i=x; i= 100 +/**************************************************************************/ +/*! + @brief Print one byte/character of data, used to support print() + @param c The 8-bit ascii character to write +*/ +/**************************************************************************/ size_t Adafruit_GFX::write(uint8_t c) { -#else -void Adafruit_GFX::write(uint8_t c) { -#endif if(!gfxFont) { // 'Classic' built-in font if(c == '\n') { // Newline? @@ -852,47 +1160,101 @@ void Adafruit_GFX::write(uint8_t c) { } } -#if ARDUINO >= 100 return 1; -#endif } +/**************************************************************************/ +/*! + @brief Set text cursor location + @param x X coordinate in pixels + @param y Y coordinate in pixels +*/ +/**************************************************************************/ void Adafruit_GFX::setCursor(int16_t x, int16_t y) { cursor_x = x; cursor_y = y; } +/**************************************************************************/ +/*! + @brief Get text cursor X location + @returns X coordinate in pixels +*/ +/**************************************************************************/ int16_t Adafruit_GFX::getCursorX(void) const { return cursor_x; } +/**************************************************************************/ +/*! + @brief Get text cursor Y location + @returns Y coordinate in pixels +*/ +/**************************************************************************/ int16_t Adafruit_GFX::getCursorY(void) const { return cursor_y; } +/**************************************************************************/ +/*! + @brief Set text 'magnification' size. Each increase in s makes 1 pixel that much bigger. + @param s Desired text size. 1 is default 6x8, 2 is 12x16, 3 is 18x24, etc +*/ +/**************************************************************************/ void Adafruit_GFX::setTextSize(uint8_t s) { textsize = (s > 0) ? s : 1; } +/**************************************************************************/ +/*! + @brief Set text font color with transparant background + @param c 16-bit 5-6-5 Color to draw text with +*/ +/**************************************************************************/ void Adafruit_GFX::setTextColor(uint16_t c) { // For 'transparent' background, we'll set the bg // to the same as fg instead of using a flag textcolor = textbgcolor = c; } +/**************************************************************************/ +/*! + @brief Set text font color with custom background color + @param c 16-bit 5-6-5 Color to draw text with + @param b 16-bit 5-6-5 Color to draw background/fill with +*/ +/**************************************************************************/ void Adafruit_GFX::setTextColor(uint16_t c, uint16_t b) { textcolor = c; textbgcolor = b; } +/**************************************************************************/ +/*! + @brief Whether text that is too long should 'wrap' around to the next line. + @param w Set true for wrapping, false for clipping +*/ +/**************************************************************************/ void Adafruit_GFX::setTextWrap(boolean w) { wrap = w; } +/**************************************************************************/ +/*! + @brief Get rotation setting for display + @returns 0 thru 3 corresponding to 4 cardinal rotations +*/ +/**************************************************************************/ uint8_t Adafruit_GFX::getRotation(void) const { return rotation; } +/**************************************************************************/ +/*! + @brief Set rotation setting for display + @param x 0 thru 3 corresponding to 4 cardinal rotations +*/ +/**************************************************************************/ void Adafruit_GFX::setRotation(uint8_t x) { rotation = (x & 3); switch(rotation) { @@ -909,17 +1271,28 @@ void Adafruit_GFX::setRotation(uint8_t x) { } } -// Enable (or disable) Code Page 437-compatible charset. -// There was an error in glcdfont.c for the longest time -- one character -// (#176, the 'light shade' block) was missing -- this threw off the index -// of every character that followed it. But a TON of code has been written -// with the erroneous character indices. By default, the library uses the -// original 'wrong' behavior and old sketches will still work. Pass 'true' -// to this function to use correct CP437 character values in your code. +/**************************************************************************/ +/*! + @brief Enable (or disable) Code Page 437-compatible charset. + There was an error in glcdfont.c for the longest time -- one character + (#176, the 'light shade' block) was missing -- this threw off the index + of every character that followed it. But a TON of code has been written + with the erroneous character indices. By default, the library uses the + original 'wrong' behavior and old sketches will still work. Pass 'true' + to this function to use correct CP437 character values in your code. + @param x Whether to enable (True) or not (False) +*/ +/**************************************************************************/ void Adafruit_GFX::cp437(boolean x) { _cp437 = x; } +/**************************************************************************/ +/*! + @brief Set the font to display when print()ing, either custom or default + @param f The GFXfont object, if NULL use built in 6x8 font +*/ +/**************************************************************************/ void Adafruit_GFX::setFont(const GFXfont *f) { if(f) { // Font struct pointer passed in? if(!gfxFont) { // And no current font struct? @@ -935,8 +1308,20 @@ void Adafruit_GFX::setFont(const GFXfont *f) { gfxFont = (GFXfont *)f; } -// Broke this out as it's used by both the PROGMEM- and RAM-resident -// getTextBounds() functions. + +/**************************************************************************/ +/*! + @brief Helper to determine size of a character with current font/size. + Broke this out as it's used by both the PROGMEM- and RAM-resident getTextBounds() functions. + @param c The ascii character in question + @param x Pointer to x location of character + @param y Pointer to y location of character + @param minx Minimum clipping value for X + @param miny Minimum clipping value for Y + @param maxx Maximum clipping value for X + @param maxy Maximum clipping value for Y +*/ +/**************************************************************************/ void Adafruit_GFX::charBounds(char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy) { @@ -995,8 +1380,19 @@ void Adafruit_GFX::charBounds(char c, int16_t *x, int16_t *y, } } -// Pass string and a cursor position, returns UL corner and W,H. -void Adafruit_GFX::getTextBounds(char *str, int16_t x, int16_t y, +/**************************************************************************/ +/*! + @brief Helper to determine size of a string with current font/size. Pass string and a cursor position, returns UL corner and W,H. + @param str The ascii string to measure + @param x The current cursor X + @param y The current cursor Y + @param x1 The boundary X coordinate, set by function + @param y1 The boundary Y coordinate, set by function + @param w The boundary width, set by function + @param h The boundary height, set by function +*/ +/**************************************************************************/ +void Adafruit_GFX::getTextBounds(const char *str, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h) { uint8_t c; // Current character @@ -1019,7 +1415,38 @@ void Adafruit_GFX::getTextBounds(char *str, int16_t x, int16_t y, } } -// Same as above, but for PROGMEM strings +/**************************************************************************/ +/*! + @brief Helper to determine size of a string with current font/size. Pass string and a cursor position, returns UL corner and W,H. + @param str The ascii string to measure (as an arduino String() class) + @param x The current cursor X + @param y The current cursor Y + @param x1 The boundary X coordinate, set by function + @param y1 The boundary Y coordinate, set by function + @param w The boundary width, set by function + @param h The boundary height, set by function +*/ +/**************************************************************************/ +void Adafruit_GFX::getTextBounds(const String &str, int16_t x, int16_t y, + int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h) { + if (str.length() != 0) { + getTextBounds(const_cast(str.c_str()), x, y, x1, y1, w, h); + } +} + + +/**************************************************************************/ +/*! + @brief Helper to determine size of a PROGMEM string with current font/size. Pass string and a cursor position, returns UL corner and W,H. + @param str The flash-memory ascii string to measure + @param x The current cursor X + @param y The current cursor Y + @param x1 The boundary X coordinate, set by function + @param y1 The boundary Y coordinate, set by function + @param w The boundary width, set by function + @param h The boundary height, set by function +*/ +/**************************************************************************/ void Adafruit_GFX::getTextBounds(const __FlashStringHelper *str, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h) { uint8_t *s = (uint8_t *)str, c; @@ -1043,26 +1470,62 @@ void Adafruit_GFX::getTextBounds(const __FlashStringHelper *str, } } -// Return the size of the display (per current rotation) +/**************************************************************************/ +/*! + @brief Get width of the display, accounting for the current rotation + @returns Width in pixels +*/ +/**************************************************************************/ int16_t Adafruit_GFX::width(void) const { return _width; } +/**************************************************************************/ +/*! + @brief Get height of the display, accounting for the current rotation + @returns Height in pixels +*/ +/**************************************************************************/ int16_t Adafruit_GFX::height(void) const { return _height; } +/**************************************************************************/ +/*! + @brief Invert the display (ideally using built-in hardware command) + @param i True if you want to invert, false to make 'normal' +*/ +/**************************************************************************/ void Adafruit_GFX::invertDisplay(boolean i) { // Do nothing, must be subclassed if supported by hardware } /***************************************************************************/ -// code for the GFX button UI element +/**************************************************************************/ +/*! + @brief Create a simple drawn button UI element +*/ +/**************************************************************************/ Adafruit_GFX_Button::Adafruit_GFX_Button(void) { _gfx = 0; } +/**************************************************************************/ +/*! + @brief Initialize button with our desired color/size/settings + @param gfx Pointer to our display so we can draw to it! + @param x The X coordinate of the center of the button + @param y The Y coordinate of the center of the button + @param w Width of the buttton + @param h Height of the buttton + @param outline Color of the outline (16-bit 5-6-5 standard) + @param fill Color of the button fill (16-bit 5-6-5 standard) + @param textcolor Color of the button label (16-bit 5-6-5 standard) + @param label Ascii string of the text inside the button + @param textsize The font magnification of the label text +*/ +/**************************************************************************/ // Classic initButton() function: pass center & size void Adafruit_GFX_Button::initButton( Adafruit_GFX *gfx, int16_t x, int16_t y, uint16_t w, uint16_t h, @@ -1074,7 +1537,21 @@ void Adafruit_GFX_Button::initButton( textcolor, label, textsize); } -// Newer function instead accepts upper-left corner & size +/**************************************************************************/ +/*! + @brief Initialize button with our desired color/size/settings, with upper-left coordinates + @param gfx Pointer to our display so we can draw to it! + @param x1 The X coordinate of the Upper-Left corner of the button + @param y1 The Y coordinate of the Upper-Left corner of the button + @param w Width of the buttton + @param h Height of the buttton + @param outline Color of the outline (16-bit 5-6-5 standard) + @param fill Color of the button fill (16-bit 5-6-5 standard) + @param textcolor Color of the button label (16-bit 5-6-5 standard) + @param label Ascii string of the text inside the button + @param textsize The font magnification of the label text +*/ +/**************************************************************************/ void Adafruit_GFX_Button::initButtonUL( Adafruit_GFX *gfx, int16_t x1, int16_t y1, uint16_t w, uint16_t h, uint16_t outline, uint16_t fill, uint16_t textcolor, @@ -1092,6 +1569,12 @@ void Adafruit_GFX_Button::initButtonUL( strncpy(_label, label, 9); } +/**************************************************************************/ +/*! + @brief Draw the button on the screen + @param inverted Whether to draw with fill/text swapped to indicate 'pressed' +*/ +/**************************************************************************/ void Adafruit_GFX_Button::drawButton(boolean inverted) { uint16_t fill, outline, text; @@ -1116,18 +1599,52 @@ void Adafruit_GFX_Button::drawButton(boolean inverted) { _gfx->print(_label); } +/**************************************************************************/ +/*! + @brief Helper to let us know if a coordinate is within the bounds of the button + @param x The X coordinate to check + @param y The Y coordinate to check + @returns True if within button graphics outline +*/ +/**************************************************************************/ boolean Adafruit_GFX_Button::contains(int16_t x, int16_t y) { - return ((x >= _x1) && (x < (_x1 + _w)) && - (y >= _y1) && (y < (_y1 + _h))); + return ((x >= _x1) && (x < (int16_t) (_x1 + _w)) && + (y >= _y1) && (y < (int16_t) (_y1 + _h))); } +/**************************************************************************/ +/*! + @brief Sets the state of the button, should be done by some touch function + @param p True for pressed, false for not. +*/ +/**************************************************************************/ void Adafruit_GFX_Button::press(boolean p) { laststate = currstate; currstate = p; } +/**************************************************************************/ +/*! + @brief Query whether the button is currently pressed + @returns True if pressed +*/ +/**************************************************************************/ boolean Adafruit_GFX_Button::isPressed() { return currstate; } + +/**************************************************************************/ +/*! + @brief Query whether the button was pressed since we last checked state + @returns True if was not-pressed before, now is. +*/ +/**************************************************************************/ boolean Adafruit_GFX_Button::justPressed() { return (currstate && !laststate); } + +/**************************************************************************/ +/*! + @brief Query whether the button was released since we last checked state + @returns True if was pressed before, now is not. +*/ +/**************************************************************************/ boolean Adafruit_GFX_Button::justReleased() { return (!currstate && laststate); } // ------------------------------------------------------------------------- @@ -1149,6 +1666,13 @@ boolean Adafruit_GFX_Button::justReleased() { return (!currstate && laststate); // scanline pad). // NOT EXTENSIVELY TESTED YET. MAY CONTAIN WORST BUGS KNOWN TO HUMANKIND. +/**************************************************************************/ +/*! + @brief Instatiate a GFX 1-bit canvas context for graphics + @param w Display width, in pixels + @param h Display height, in pixels +*/ +/**************************************************************************/ GFXcanvas1::GFXcanvas1(uint16_t w, uint16_t h) : Adafruit_GFX(w, h) { uint16_t bytes = ((w + 7) / 8) * h; if((buffer = (uint8_t *)malloc(bytes))) { @@ -1156,14 +1680,33 @@ GFXcanvas1::GFXcanvas1(uint16_t w, uint16_t h) : Adafruit_GFX(w, h) { } } +/**************************************************************************/ +/*! + @brief Delete the canvas, free memory +*/ +/**************************************************************************/ GFXcanvas1::~GFXcanvas1(void) { if(buffer) free(buffer); } +/**************************************************************************/ +/*! + @brief Get a pointer to the internal buffer memory + @returns A pointer to the allocated buffer +*/ +/**************************************************************************/ uint8_t* GFXcanvas1::getBuffer(void) { return buffer; } +/**************************************************************************/ +/*! + @brief Draw a pixel to the canvas framebuffer + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) { #ifdef __AVR__ // Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR @@ -1204,6 +1747,12 @@ void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) { } } +/**************************************************************************/ +/*! + @brief Fill the framebuffer completely with one color + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void GFXcanvas1::fillScreen(uint16_t color) { if(buffer) { uint16_t bytes = ((WIDTH + 7) / 8) * HEIGHT; @@ -1211,6 +1760,13 @@ void GFXcanvas1::fillScreen(uint16_t color) { } } +/**************************************************************************/ +/*! + @brief Instatiate a GFX 8-bit canvas context for graphics + @param w Display width, in pixels + @param h Display height, in pixels +*/ +/**************************************************************************/ GFXcanvas8::GFXcanvas8(uint16_t w, uint16_t h) : Adafruit_GFX(w, h) { uint32_t bytes = w * h; if((buffer = (uint8_t *)malloc(bytes))) { @@ -1218,14 +1774,34 @@ GFXcanvas8::GFXcanvas8(uint16_t w, uint16_t h) : Adafruit_GFX(w, h) { } } +/**************************************************************************/ +/*! + @brief Delete the canvas, free memory +*/ +/**************************************************************************/ GFXcanvas8::~GFXcanvas8(void) { if(buffer) free(buffer); } + +/**************************************************************************/ +/*! + @brief Get a pointer to the internal buffer memory + @returns A pointer to the allocated buffer +*/ +/**************************************************************************/ uint8_t* GFXcanvas8::getBuffer(void) { return buffer; } +/**************************************************************************/ +/*! + @brief Draw a pixel to the canvas framebuffer + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) { if(buffer) { if((x < 0) || (y < 0) || (x >= _width) || (y >= _height)) return; @@ -1252,6 +1828,12 @@ void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) { } } +/**************************************************************************/ +/*! + @brief Fill the framebuffer completely with one color + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void GFXcanvas8::fillScreen(uint16_t color) { if(buffer) { memset(buffer, color, WIDTH * HEIGHT); @@ -1293,6 +1875,13 @@ void GFXcanvas8::writeFastHLine(int16_t x, int16_t y, memset(buffer + y * WIDTH + x, color, w); } +/**************************************************************************/ +/*! + @brief Instatiate a GFX 16-bit canvas context for graphics + @param w Display width, in pixels + @param h Display height, in pixels +*/ +/**************************************************************************/ GFXcanvas16::GFXcanvas16(uint16_t w, uint16_t h) : Adafruit_GFX(w, h) { uint32_t bytes = w * h * 2; if((buffer = (uint16_t *)malloc(bytes))) { @@ -1300,14 +1889,33 @@ GFXcanvas16::GFXcanvas16(uint16_t w, uint16_t h) : Adafruit_GFX(w, h) { } } +/**************************************************************************/ +/*! + @brief Delete the canvas, free memory +*/ +/**************************************************************************/ GFXcanvas16::~GFXcanvas16(void) { if(buffer) free(buffer); } +/**************************************************************************/ +/*! + @brief Get a pointer to the internal buffer memory + @returns A pointer to the allocated buffer +*/ +/**************************************************************************/ uint16_t* GFXcanvas16::getBuffer(void) { return buffer; } +/**************************************************************************/ +/*! + @brief Draw a pixel to the canvas framebuffer + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void GFXcanvas16::drawPixel(int16_t x, int16_t y, uint16_t color) { if(buffer) { if((x < 0) || (y < 0) || (x >= _width) || (y >= _height)) return; @@ -1334,6 +1942,12 @@ void GFXcanvas16::drawPixel(int16_t x, int16_t y, uint16_t color) { } } +/**************************************************************************/ +/*! + @brief Fill the framebuffer completely with one color + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void GFXcanvas16::fillScreen(uint16_t color) { if(buffer) { uint8_t hi = color >> 8, lo = color & 0xFF; diff --git a/lib/Adafruit_GFX-1.2.2.07/Adafruit_GFX.h b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_GFX.h similarity index 81% rename from lib/Adafruit_GFX-1.2.2.07/Adafruit_GFX.h rename to lib/Adafruit-GFX-Library-1.2.9/Adafruit_GFX.h index 0bf6ff7ac..5af57aa41 100644 --- a/lib/Adafruit_GFX-1.2.2.07/Adafruit_GFX.h +++ b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_GFX.h @@ -9,6 +9,7 @@ #endif #include "gfxfont.h" +/// A generic graphics superclass that can handle all sorts of drawing. At a minimum you can subclass and provide drawPixel(). At a maximum you can do a ton of overriding to optimize. Used for any/all Adafruit displays! class Adafruit_GFX : public Print { public: @@ -16,7 +17,7 @@ class Adafruit_GFX : public Print { Adafruit_GFX(int16_t w, int16_t h); // Constructor // This MUST be defined by the subclass: - virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; + virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; ///< Virtual drawPixel() function to draw to the screen/framebuffer/etc, must be overridden in subclass. @param x X coordinate. @param y Y coordinate. @param color 16-bit pixel color. // TRANSACTION API / CORE DRAW API // These MAY be overridden by the subclass to provide device-specific @@ -101,11 +102,14 @@ class Adafruit_GFX : public Print { setTextWrap(boolean w), cp437(boolean x=true), setFont(const GFXfont *f = NULL), - getTextBounds(char *string, int16_t x, int16_t y, + getTextBounds(const char *string, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h), getTextBounds(const __FlashStringHelper *s, int16_t x, int16_t y, + int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h), + getTextBounds(const String &str, int16_t x, int16_t y, int16_t *x1, int16_t *y1, uint16_t *w, uint16_t *h); + #if ARDUINO >= 100 virtual size_t write(uint8_t); #else @@ -126,22 +130,28 @@ class Adafruit_GFX : public Print { charBounds(char c, int16_t *x, int16_t *y, int16_t *minx, int16_t *miny, int16_t *maxx, int16_t *maxy); const int16_t - WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes + WIDTH, ///< This is the 'raw' display width - never changes + HEIGHT; ///< This is the 'raw' display height - never changes int16_t - _width, _height, // Display w/h as modified by current rotation - cursor_x, cursor_y; + _width, ///< Display width as modified by current rotation + _height, ///< Display height as modified by current rotation + cursor_x, ///< x location to start print()ing text + cursor_y; ///< y location to start print()ing text uint16_t - textcolor, textbgcolor; + textcolor, ///< 16-bit background color for print() + textbgcolor; ///< 16-bit text color for print() uint8_t - textsize, - rotation; + textsize, ///< Desired magnification of text to print() + rotation; ///< Display rotation (0 thru 3) boolean - wrap, // If set, 'wrap' text at right edge of display - _cp437; // If set, use correct CP437 charset (default is off) + wrap, ///< If set, 'wrap' text at right edge of display + _cp437; ///< If set, use correct CP437 charset (default is off) GFXfont - *gfxFont; + *gfxFont; ///< Pointer to special font }; + +/// A simple drawn button UI element class Adafruit_GFX_Button { public: @@ -173,6 +183,8 @@ class Adafruit_GFX_Button { boolean currstate, laststate; }; + +/// A GFX 1-bit canvas context for graphics class GFXcanvas1 : public Adafruit_GFX { public: GFXcanvas1(uint16_t w, uint16_t h); @@ -184,6 +196,8 @@ class GFXcanvas1 : public Adafruit_GFX { uint8_t *buffer; }; + +/// A GFX 8-bit canvas context for graphics class GFXcanvas8 : public Adafruit_GFX { public: GFXcanvas8(uint16_t w, uint16_t h); @@ -197,6 +211,8 @@ class GFXcanvas8 : public Adafruit_GFX { uint8_t *buffer; }; + +/// A GFX 16-bit canvas context for graphics class GFXcanvas16 : public Adafruit_GFX { public: GFXcanvas16(uint16_t w, uint16_t h); diff --git a/lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT.cpp b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT.cpp new file mode 100644 index 000000000..51b53cc3b --- /dev/null +++ b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT.cpp @@ -0,0 +1,555 @@ +/*! +* @file Adafruit_SPITFT.cpp +* +* @mainpage Adafruit SPI TFT Displays +* +* @section intro_sec Introduction + This is our library for generic SPI TFT Displays with + address windows and 16 bit color (e.g. ILI9341, HX8357D, ST7735...) + + Check out the links above for our tutorials and wiring diagrams + These displays use SPI to communicate, 4 or 5 pins are required to + interface (RST is optional) + Adafruit invests time and resources providing this open source code, + please support Adafruit and open-source hardware by purchasing + products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + MIT license, all text above must be included in any redistribution +* @section dependencies Dependencies +* +* This library depends on +* Adafruit_GFX being present on your system. Please make sure you have +* installed the latest version before using this library. +* +* @section author Author +* +* Written by Limor "ladyada" Fried for Adafruit Industries. +* +* @section license License +* +* BSD license, all text here must be included in any redistribution. +* +*/ + +#ifndef __AVR_ATtiny85__ // NOT A CHANCE of this stuff working on ATtiny! + +#include "Adafruit_SPITFT.h" +#ifndef ARDUINO_STM32_FEATHER + #include "pins_arduino.h" +#ifndef RASPI + #include "wiring_private.h" +#endif +#endif +#include + +#include "Adafruit_SPITFT_Macros.h" + + + +/**************************************************************************/ +/*! + @brief Pass 8-bit (each) R,G,B, get back 16-bit packed color + This function converts 8-8-8 RGB data to 16-bit 5-6-5 + @param red Red 8 bit color + @param green Green 8 bit color + @param blue Blue 8 bit color + @return Unsigned 16-bit down-sampled color in 5-6-5 format +*/ +/**************************************************************************/ +uint16_t Adafruit_SPITFT::color565(uint8_t red, uint8_t green, uint8_t blue) { + return ((red & 0xF8) << 8) | ((green & 0xFC) << 3) | ((blue & 0xF8) >> 3); +} + + +/**************************************************************************/ +/*! + @brief Instantiate Adafruit SPI display driver with software SPI + @param w Display width in pixels + @param h Display height in pixels + @param cs Chip select pin # + @param dc Data/Command pin # + @param mosi SPI MOSI pin # + @param sclk SPI Clock pin # + @param rst Reset pin # (optional, pass -1 if unused) + @param miso SPI MISO pin # (optional, pass -1 if unused) +*/ +/**************************************************************************/ +Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, + int8_t cs, int8_t dc, int8_t mosi, + int8_t sclk, int8_t rst, int8_t miso) + : Adafruit_GFX(w, h) { + _cs = cs; + _dc = dc; + _rst = rst; + _sclk = sclk; + _mosi = mosi; + _miso = miso; + _freq = 0; +#ifdef USE_FAST_PINIO + dcport = (RwReg *)portOutputRegister(digitalPinToPort(dc)); + dcpinmask = digitalPinToBitMask(dc); + clkport = (RwReg *)portOutputRegister(digitalPinToPort(sclk)); + clkpinmask = digitalPinToBitMask(sclk); + mosiport = (RwReg *)portOutputRegister(digitalPinToPort(mosi)); + mosipinmask = digitalPinToBitMask(mosi); + if(miso >= 0){ + misoport = (RwReg *)portInputRegister(digitalPinToPort(miso)); + misopinmask = digitalPinToBitMask(miso); + } else { + misoport = 0; + misopinmask = 0; + } + if(cs >= 0) { + csport = (RwReg *)portOutputRegister(digitalPinToPort(cs)); + cspinmask = digitalPinToBitMask(cs); + } else { + // No chip-select line defined; might be permanently tied to GND. + // Assign a valid GPIO register (though not used for CS), and an + // empty pin bitmask...the nonsense bit-twiddling might be faster + // than checking _cs and possibly branching. + csport = dcport; + cspinmask = 0; + } +#endif +} + +/**************************************************************************/ +/*! + @brief Instantiate Adafruit SPI display driver with hardware SPI + @param w Display width in pixels + @param h Display height in pixels + @param cs Chip select pin # + @param dc Data/Command pin # + @param rst Reset pin # (optional, pass -1 if unused) +*/ +/**************************************************************************/ +Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, + int8_t cs, int8_t dc, int8_t rst) + : Adafruit_GFX(w, h) { + _cs = cs; + _dc = dc; + _rst = rst; + _sclk = -1; + _mosi = -1; + _miso = -1; + _freq = 0; +#ifdef USE_FAST_PINIO + clkport = 0; + clkpinmask = 0; + mosiport = 0; + mosipinmask = 0; + misoport = 0; + misopinmask = 0; + dcport = (RwReg *)portOutputRegister(digitalPinToPort(dc)); + dcpinmask = digitalPinToBitMask(dc); + if(cs >= 0) { + csport = (RwReg *)portOutputRegister(digitalPinToPort(cs)); + cspinmask = digitalPinToBitMask(cs); + } else { + // See notes in prior constructor. + csport = dcport; + cspinmask = 0; + } +#endif +} + +/**************************************************************************/ +/*! + @brief Initialiaze the SPI interface (hardware or software) + @param freq The desired maximum SPI hardware clock frequency +*/ +/**************************************************************************/ +void Adafruit_SPITFT::initSPI(uint32_t freq) { + _freq = freq; + + // Control Pins + if(_cs >= 0) { + pinMode(_cs, OUTPUT); + digitalWrite(_cs, HIGH); // Deselect + } + pinMode(_dc, OUTPUT); + digitalWrite(_dc, LOW); + + // Software SPI + if(_sclk >= 0){ + pinMode(_mosi, OUTPUT); + digitalWrite(_mosi, LOW); + pinMode(_sclk, OUTPUT); + digitalWrite(_sclk, HIGH); + if(_miso >= 0){ + pinMode(_miso, INPUT); + } + } + + // Hardware SPI + SPI_BEGIN(); + + // toggle RST low to reset + if (_rst >= 0) { + pinMode(_rst, OUTPUT); + digitalWrite(_rst, HIGH); + delay(100); + digitalWrite(_rst, LOW); + delay(100); + digitalWrite(_rst, HIGH); + delay(200); + } +} + +/**************************************************************************/ +/*! + @brief Read one byte from SPI interface (hardware or software + @returns One byte, MSB order +*/ +/**************************************************************************/ +uint8_t Adafruit_SPITFT::spiRead() { + if(_sclk < 0){ + return HSPI_READ(); + } + if(_miso < 0){ + return 0; + } + uint8_t r = 0; + for (uint8_t i=0; i<8; i++) { + SSPI_SCK_LOW(); + SSPI_SCK_HIGH(); + r <<= 1; + if (SSPI_MISO_READ()){ + r |= 0x1; + } + } + return r; +} + +/**************************************************************************/ +/*! + @brief Write one byte to SPI interface (hardware or software + @param b One byte to send, MSB order +*/ +/**************************************************************************/ +void Adafruit_SPITFT::spiWrite(uint8_t b) { + if(_sclk < 0){ + HSPI_WRITE(b); + return; + } + for(uint8_t bit = 0x80; bit; bit >>= 1){ + if((b) & bit){ + SSPI_MOSI_HIGH(); + } else { + SSPI_MOSI_LOW(); + } + SSPI_SCK_LOW(); + SSPI_SCK_HIGH(); + } +} + + +/* + * Transaction API + * */ + +/**************************************************************************/ +/*! + @brief Begin an SPI transaction & set CS low. +*/ +/**************************************************************************/ +void inline Adafruit_SPITFT::startWrite(void){ + SPI_BEGIN_TRANSACTION(); + SPI_CS_LOW(); +} + +/**************************************************************************/ +/*! + @brief Begin an SPI transaction & set CS high. +*/ +/**************************************************************************/ +void inline Adafruit_SPITFT::endWrite(void){ + SPI_CS_HIGH(); + SPI_END_TRANSACTION(); +} + +/**************************************************************************/ +/*! + @brief Write a command byte (must have a transaction in progress) + @param cmd The 8-bit command to send +*/ +/**************************************************************************/ +void Adafruit_SPITFT::writeCommand(uint8_t cmd){ + SPI_DC_LOW(); + spiWrite(cmd); + SPI_DC_HIGH(); +} + +/**************************************************************************/ +/*! + @brief Push a 2-byte color to the framebuffer RAM, will start transaction + @param color 16-bit 5-6-5 Color to draw +*/ +/**************************************************************************/ +void Adafruit_SPITFT::pushColor(uint16_t color) { + startWrite(); + SPI_WRITE16(color); + endWrite(); +} + + + +/**************************************************************************/ +/*! + @brief Blit multiple 2-byte colors (must have a transaction in progress) + @param colors Array of 16-bit 5-6-5 Colors to draw + @param len How many pixels to draw - 2 bytes per pixel! +*/ +/**************************************************************************/ +void Adafruit_SPITFT::writePixels(uint16_t * colors, uint32_t len){ + SPI_WRITE_PIXELS((uint8_t*)colors , len * 2); +} + +/**************************************************************************/ +/*! + @brief Blit a 2-byte color many times (must have a transaction in progress) + @param color The 16-bit 5-6-5 Color to draw + @param len How many pixels to draw +*/ +/**************************************************************************/ +void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len){ +#ifdef SPI_HAS_WRITE_PIXELS + if(_sclk >= 0){ + for (uint32_t t=0; t SPI_MAX_PIXELS_AT_ONCE)?SPI_MAX_PIXELS_AT_ONCE:len; + uint16_t tlen = 0; + + for (uint32_t t=0; tblen)?blen:len; + writePixels(temp, tlen); + len -= tlen; + } +#else + uint8_t hi = color >> 8, lo = color; + if(_sclk < 0){ //AVR Optimization + for (uint32_t t=len; t; t--){ + HSPI_WRITE(hi); + HSPI_WRITE(lo); + } + return; + } + for (uint32_t t=len; t; t--){ + spiWrite(hi); + spiWrite(lo); + } +#endif +} + +/**************************************************************************/ +/*! + @brief Write a pixel (must have a transaction in progress) + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to draw with +*/ +/**************************************************************************/ +void Adafruit_SPITFT::writePixel(int16_t x, int16_t y, uint16_t color) { + if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return; + setAddrWindow(x,y,1,1); + writePixel(color); +} + +/**************************************************************************/ +/*! + @brief Write a filled rectangle (must have a transaction in progress) + @param x Top left corner x coordinate + @param y Top left corner y coordinate + @param w Width in pixels + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ +void Adafruit_SPITFT::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color){ + if((x >= _width) || (y >= _height)) return; + int16_t x2 = x + w - 1, y2 = y + h - 1; + if((x2 < 0) || (y2 < 0)) return; + + // Clip left/top + if(x < 0) { + x = 0; + w = x2 + 1; + } + if(y < 0) { + y = 0; + h = y2 + 1; + } + + // Clip right/bottom + if(x2 >= _width) w = _width - x; + if(y2 >= _height) h = _height - y; + + int32_t len = (int32_t)w * h; + setAddrWindow(x, y, w, h); + writeColor(color, len); +} + +/**************************************************************************/ +/*! + @brief Write a perfectly vertical line (must have a transaction in progress) + @param x Top-most x coordinate + @param y Top-most y coordinate + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ +void inline Adafruit_SPITFT::writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color){ + writeFillRect(x, y, 1, h, color); +} + +/**************************************************************************/ +/*! + @brief Write a perfectly horizontal line (must have a transaction in progress) + @param x Left-most x coordinate + @param y Left-most y coordinate + @param w Width in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ +void inline Adafruit_SPITFT::writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color){ + writeFillRect(x, y, w, 1, color); +} + +/**************************************************************************/ +/*! + @brief Draw a pixel - sets up transaction + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to draw with +*/ +/**************************************************************************/ +void Adafruit_SPITFT::drawPixel(int16_t x, int16_t y, uint16_t color){ + startWrite(); + writePixel(x, y, color); + endWrite(); +} + +/**************************************************************************/ +/*! + @brief Write a perfectly vertical line - sets up transaction + @param x Top-most x coordinate + @param y Top-most y coordinate + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ +void Adafruit_SPITFT::drawFastVLine(int16_t x, int16_t y, + int16_t h, uint16_t color) { + startWrite(); + writeFastVLine(x, y, h, color); + endWrite(); +} + +/**************************************************************************/ +/*! + @brief Write a perfectly horizontal line - sets up transaction + @param x Left-most x coordinate + @param y Left-most y coordinate + @param w Width in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ +void Adafruit_SPITFT::drawFastHLine(int16_t x, int16_t y, + int16_t w, uint16_t color) { + startWrite(); + writeFastHLine(x, y, w, color); + endWrite(); +} + +/**************************************************************************/ +/*! + @brief Fill a rectangle completely with one color. + @param x Top left corner x coordinate + @param y Top left corner y coordinate + @param w Width in pixels + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ +void Adafruit_SPITFT::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, + uint16_t color) { + startWrite(); + writeFillRect(x,y,w,h,color); + endWrite(); +} + + +/**************************************************************************/ +/*! + @brief Invert the display using built-in hardware command + @param i True if you want to invert, false to make 'normal' +*/ +/**************************************************************************/ +void Adafruit_SPITFT::invertDisplay(boolean i) { + startWrite(); + writeCommand(i ? invertOnCommand : invertOffCommand); + endWrite(); +} + + +/**************************************************************************/ +/*! + @brief Draw a 16-bit image (RGB 5/6/5) at the specified (x,y) position. + For 16-bit display devices; no color reduction performed. + Adapted from https://github.com/PaulStoffregen/ILI9341_t3 + by Marc MERLIN. See examples/pictureEmbed to use this. + 5/6/2017: function name and arguments have changed for compatibility + with current GFX library and to avoid naming problems in prior + implementation. Formerly drawBitmap() with arguments in different order. + + @param x Top left corner x coordinate + @param y Top left corner y coordinate + @param pcolors 16-bit array with 16-bit color bitmap + @param w Width of bitmap in pixels + @param h Height of bitmap in pixels +*/ +/**************************************************************************/ +void Adafruit_SPITFT::drawRGBBitmap(int16_t x, int16_t y, + uint16_t *pcolors, int16_t w, int16_t h) { + + int16_t x2, y2; // Lower-right coord + if(( x >= _width ) || // Off-edge right + ( y >= _height) || // " top + ((x2 = (x+w-1)) < 0 ) || // " left + ((y2 = (y+h-1)) < 0) ) return; // " bottom + + int16_t bx1=0, by1=0, // Clipped top-left within bitmap + saveW=w; // Save original bitmap width value + if(x < 0) { // Clip left + w += x; + bx1 = -x; + x = 0; + } + if(y < 0) { // Clip top + h += y; + by1 = -y; + y = 0; + } + if(x2 >= _width ) w = _width - x; // Clip right + if(y2 >= _height) h = _height - y; // Clip bottom + + pcolors += by1 * saveW + bx1; // Offset bitmap ptr to clipped top-left + startWrite(); + setAddrWindow(x, y, w, h); // Clipped area + while(h--) { // For each (clipped) scanline... + writePixels(pcolors, w); // Push one (clipped) row + pcolors += saveW; // Advance pointer by one full (unclipped) line + } + endWrite(); +} + +#endif // !__AVR_ATtiny85__ diff --git a/lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT.h b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT.h new file mode 100644 index 000000000..53cdd985d --- /dev/null +++ b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT.h @@ -0,0 +1,125 @@ +#ifndef _ADAFRUIT_SPITFT_ +#define _ADAFRUIT_SPITFT_ + +#if ARDUINO >= 100 + #include "Arduino.h" + #include "Print.h" +#else + #include "WProgram.h" +#endif +#include +#include "Adafruit_GFX.h" + +#define USE_FAST_PINIO + +#if defined(__AVR__) + typedef volatile uint8_t RwReg; +#elif defined(ARDUINO_STM32_FEATHER) + typedef volatile uint32 RwReg; + #undef USE_FAST_PINIO +#elif defined(__OPENCR__) || defined (__OPENCM904__) + #undef USE_FAST_PINIO +#elif defined(ARDUINO_FEATHER52) || defined(__arm__) + typedef volatile uint32_t RwReg; +#elif defined(ESP32) || defined(ESP8266) + typedef volatile uint32_t RwReg; + #undef USE_FAST_PINIO +#else + #undef USE_FAST_PINIO +#endif + +#include "Adafruit_SPITFT_Macros.h" + +/// A heavily optimized SPI display subclass of GFX. Manages SPI bitbanging, transactions, DMA, etc! Despite being called SPITFT, the classic SPI data/command interface is also used by OLEDs. +class Adafruit_SPITFT : public Adafruit_GFX { + protected: + + public: + Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST = -1, int8_t _MISO = -1); + Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _RST = -1); + + virtual void begin(uint32_t freq) = 0; ///< Virtual begin() function to set SPI frequency, must be overridden in subclass. @param freq Maximum SPI hardware clock speed + + void initSPI(uint32_t freq); + + // Required Non-Transaction + void drawPixel(int16_t x, int16_t y, uint16_t color); + + // Transaction API + void startWrite(void); + void endWrite(void); + + void writePixel(int16_t x, int16_t y, uint16_t color); + void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); + void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); + void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); + + // Transaction API not used by GFX + + /*! + @brief SPI displays set an address window rectangle for blitting pixels + @param x Top left corner x coordinate + @param y Top left corner x coordinate + @param w Width of window + @param h Height of window + */ + virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0; + + /*! + @brief Write a 2-byte color (must have a transaction in progress) + @param color 16-bit 5-6-5 Color to draw + */ + void inline writePixel(uint16_t color) { SPI_WRITE16(color); } + void writePixels(uint16_t * colors, uint32_t len); + void writeColor(uint16_t color, uint32_t len); + void pushColor(uint16_t color); + + // Recommended Non-Transaction + void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); + void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); + void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); + + using Adafruit_GFX::drawRGBBitmap; // Check base class first + void drawRGBBitmap(int16_t x, int16_t y, + uint16_t *pcolors, int16_t w, int16_t h); + void invertDisplay(boolean i); + + uint16_t color565(uint8_t r, uint8_t g, uint8_t b); + + protected: + uint32_t _freq; ///< SPI clock frequency (for hardware SPI) +#if defined (__AVR__) || defined(TEENSYDUINO) || defined (ESP8266) || defined (ESP32) + int8_t _cs, _dc, _rst, _sclk, _mosi, _miso; +#else + int32_t _cs, ///< Arduino pin # for chip-select pin + _dc, ///< Arduino pin # for data-command pin + _rst, ///< Arduino pin # for reset pin + _sclk, ///< Arduino pin # for SPI clock pin + _mosi, ///< Arduino pin # for SPI MOSI pin + _miso; ///< Arduino pin # for SPI MISO pin +#endif + +#ifdef USE_FAST_PINIO + volatile RwReg *mosiport, ///< Direct chip register for toggling MOSI with fast bitbang IO + *misoport, ///< Direct chip register for toggling MISO with fast bitbang IO + *clkport, ///< Direct chip register for toggling CLK with fast bitbang IO + *dcport, ///< Direct chip register for toggling DC with fast bitbang IO + *csport; ///< Direct chip register for toggling CS with fast bitbang IO + RwReg mosipinmask, ///< bitmask for turning on/off MOSI with fast register bitbang IO + misopinmask, ///< bitmask for turning on/off MISO with fast register bitbang IO + clkpinmask, ///< bitmask for turning on/off CLK with fast register bitbang IO + cspinmask, ///< bitmask for turning on/off CS with fast register bitbang IO + dcpinmask; ///< bitmask for turning on/off DC with fast register bitbang IO +#endif + + void writeCommand(uint8_t cmd); + void spiWrite(uint8_t v); + uint8_t spiRead(void); + + uint8_t invertOnCommand = 0, ///< SPI command byte to turn on invert + invertOffCommand = 0; ///< SPI command byte to turn off invert + int16_t _xstart = 0; ///< Many displays don't have pixels starting at (0,0) of the internal framebuffer, this is the x offset from 0 to align + int16_t _ystart = 0; ///< Many displays don't have pixels starting at (0,0) of the internal framebuffer, this is the y offset from 0 to align +}; + +#endif diff --git a/lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT_Macros.h b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT_Macros.h similarity index 90% rename from lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT_Macros.h rename to lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT_Macros.h index 74391daa7..f0466ef5f 100644 --- a/lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT_Macros.h +++ b/lib/Adafruit-GFX-Library-1.2.9/Adafruit_SPITFT_Macros.h @@ -1,3 +1,5 @@ +#ifndef _ADAFRUIT_SPITFT_MACROS +#define _ADAFRUIT_SPITFT_MACROS /* * Control Pins @@ -6,13 +8,13 @@ #ifdef USE_FAST_PINIO #define SPI_DC_HIGH() *dcport |= dcpinmask #define SPI_DC_LOW() *dcport &= ~dcpinmask -#define SPI_CS_HIGH() *csport |= cspinmask +#define SPI_CS_HIGH() *csport |= cspinmask #define SPI_CS_LOW() *csport &= ~cspinmask #else #define SPI_DC_HIGH() digitalWrite(_dc, HIGH) #define SPI_DC_LOW() digitalWrite(_dc, LOW) -#define SPI_CS_HIGH() digitalWrite(_cs, HIGH) -#define SPI_CS_LOW() digitalWrite(_cs, LOW) +#define SPI_CS_HIGH() { if(_cs >= 0) digitalWrite(_cs, HIGH); } +#define SPI_CS_LOW() { if(_cs >= 0) digitalWrite(_cs, LOW); } #endif /* @@ -22,8 +24,8 @@ #ifdef USE_FAST_PINIO #define SSPI_MOSI_HIGH() *mosiport |= mosipinmask #define SSPI_MOSI_LOW() *mosiport &= ~mosipinmask -#define SSPI_SCK_HIGH() *clkport |= clkpinmask -#define SSPI_SCK_LOW() *clkport &= ~clkpinmask +#define SSPI_SCK_HIGH() *clkport |= clkpinmask +#define SSPI_SCK_LOW() *clkport &= ~clkpinmask #define SSPI_MISO_READ() ((*misoport & misopinmask) != 0) #else #define SSPI_MOSI_HIGH() digitalWrite(_mosi, HIGH) @@ -44,7 +46,7 @@ * Hardware SPI Macros * */ -#define SPI_OBJECT SPI +#define SPI_OBJECT SPI #if defined (__AVR__) || defined(TEENSYDUINO) || defined(ARDUINO_ARCH_STM32F1) #define HSPI_SET_CLOCK() SPI_OBJECT.setClockDivider(SPI_CLOCK_DIV2); @@ -112,3 +114,5 @@ static inline uint8_t _avr_spi_read(void) { #define SPI_WRITE16(s) if(_sclk < 0){HSPI_WRITE16(s);}else{SSPI_WRITE16(s);} #define SPI_WRITE32(l) if(_sclk < 0){HSPI_WRITE32(l);}else{SSPI_WRITE32(l);} #define SPI_WRITE_PIXELS(c,l) if(_sclk < 0){HSPI_WRITE_PIXELS(c,l);}else{SSPI_WRITE_PIXELS(c,l);} + +#endif // _ADAFRUIT_SPITFT_MACROS diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMono12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMono12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMono12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMono12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMono18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMono18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMono18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMono18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMono24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMono24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMono24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMono24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMono9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMono9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMono9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMono9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBold12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBold12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBold12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBold12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBold18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBold18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBold18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBold18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBold24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBold24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBold24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBold24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBold9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBold9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBold9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBold9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBoldOblique12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBoldOblique12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBoldOblique12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBoldOblique12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBoldOblique18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBoldOblique18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBoldOblique18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBoldOblique18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBoldOblique24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBoldOblique24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBoldOblique24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBoldOblique24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBoldOblique9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBoldOblique9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoBoldOblique9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoBoldOblique9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoOblique12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoOblique12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoOblique12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoOblique12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoOblique18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoOblique18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoOblique18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoOblique18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoOblique24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoOblique24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoOblique24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoOblique24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoOblique9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoOblique9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeMonoOblique9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeMonoOblique9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSans12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSans12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSans12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSans12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSans18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSans18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSans18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSans18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSans24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSans24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSans24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSans24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSans9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSans9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSans9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSans9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBold12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBold12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBold12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBold12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBold18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBold18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBold18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBold18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBold24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBold24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBold24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBold24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBold9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBold9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBold9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBold9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBoldOblique12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBoldOblique12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBoldOblique12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBoldOblique12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBoldOblique18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBoldOblique18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBoldOblique18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBoldOblique18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBoldOblique24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBoldOblique24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBoldOblique24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBoldOblique24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBoldOblique9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBoldOblique9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansBoldOblique9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansBoldOblique9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansOblique12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansOblique12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansOblique12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansOblique12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansOblique18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansOblique18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansOblique18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansOblique18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansOblique24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansOblique24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansOblique24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansOblique24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansOblique9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansOblique9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSansOblique9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSansOblique9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerif12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerif12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerif12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerif12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerif18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerif18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerif18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerif18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerif24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerif24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerif24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerif24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerif9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerif9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerif9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerif9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBold12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBold12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBold12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBold12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBold18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBold18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBold18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBold18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBold24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBold24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBold24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBold24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBold9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBold9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBold9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBold9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBoldItalic12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBoldItalic12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBoldItalic12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBoldItalic12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBoldItalic18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBoldItalic18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBoldItalic18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBoldItalic18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBoldItalic24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBoldItalic24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBoldItalic24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBoldItalic24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBoldItalic9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBoldItalic9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifBoldItalic9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifBoldItalic9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifItalic12pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifItalic12pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifItalic12pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifItalic12pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifItalic18pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifItalic18pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifItalic18pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifItalic18pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifItalic24pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifItalic24pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifItalic24pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifItalic24pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifItalic9pt7b.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifItalic9pt7b.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/FreeSerifItalic9pt7b.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/FreeSerifItalic9pt7b.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/Org_01.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/Org_01.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/Org_01.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/Org_01.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/Picopixel.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/Picopixel.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/Picopixel.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/Picopixel.h diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/Tiny3x3a2pt7b b/lib/Adafruit-GFX-Library-1.2.9/Fonts/Tiny3x3a2pt7b similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/Tiny3x3a2pt7b rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/Tiny3x3a2pt7b diff --git a/lib/Adafruit_GFX-1.2.2.07/Fonts/TomThumb.h b/lib/Adafruit-GFX-Library-1.2.9/Fonts/TomThumb.h similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/Fonts/TomThumb.h rename to lib/Adafruit-GFX-Library-1.2.9/Fonts/TomThumb.h diff --git a/lib/Adafruit_GFX-1.2.2.07/README.md b/lib/Adafruit-GFX-Library-1.2.9/README.md similarity index 83% rename from lib/Adafruit_GFX-1.2.2.07/README.md rename to lib/Adafruit-GFX-Library-1.2.9/README.md index 21f2bc8eb..cd27c33b6 100644 --- a/lib/Adafruit_GFX-1.2.2.07/README.md +++ b/lib/Adafruit-GFX-Library-1.2.9/README.md @@ -1,4 +1,4 @@ -# Adafruit GFX Library +# Adafruit GFX Library # [![Build Status](https://travis-ci.org/adafruit/Adafruit_GFX.svg?branch=master)](https://travis-ci.org/adafruit/Adafruit_GFX) This is the core graphics library for all our displays, providing a common set of graphics primitives (points, lines, circles, etc.). It needs to be paired with a hardware-specific library for each display device we carry (to handle the lower-level functions). @@ -8,7 +8,7 @@ Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information. All text above must be included in any redistribution. -Recent Arduino IDE releases include the Library Manager for easy installation. Otherwise, to download, click the DOWNLOAD ZIP button, uncompress and rename the uncompressed folder Adafruit_GFX. Confirm that the Adafruit_GFX folder contains Adafruit_GFX.cpp and Adafruit_GFX.h. Place the Adafruit_GFX library folder your /Libraries/ folder. You may need to create the Libraries subfolder if its your first library. Restart the IDE. +Recent Arduino IDE releases include the Library Manager for easy installation. Otherwise, to download, click the DOWNLOAD ZIP button, uncompress and rename the uncompressed folder Adafruit_GFX. Confirm that the Adafruit_GFX folder contains Adafruit_GFX.cpp and Adafruit_GFX.h. Place the Adafruit_GFX library folder your ArduinoSketchFolder/Libraries/ folder. You may need to create the Libraries subfolder if its your first library. Restart the IDE. # Useful Resources @@ -16,9 +16,9 @@ Recent Arduino IDE releases include the Library Manager for easy installation. O - drawXBitmap function: You can use the GIMP photo editor to save a .xbm file and use the array saved in the file to draw a bitmap with the drawXBitmap function. See the pull request here for more details: https://github.com/adafruit/Adafruit-GFX-Library/pull/31 -- 'Fonts' folder contains bitmap fonts for use with recent (1.1 and later) Adafruit_GFX. To use a font in your Arduino sketch, #include the corresponding .h file and pass address of GFXfont struct to setFont(). Pass NULL to revert to 'classic' fixed-space bitmap font. +- 'Fonts' folder contains bitmap fonts for use with recent (1.1 and later) Adafruit_GFX. To use a font in your Arduino sketch, \#include the corresponding .h file and pass address of GFXfont struct to setFont(). Pass NULL to revert to 'classic' fixed-space bitmap font. -- 'fontconvert' folder contains a command-line tool for converting TTF fonts to Adafruit_GFX .h format. +- 'fontconvert' folder contains a command-line tool for converting TTF fonts to Adafruit_GFX header format. --- diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/graphicstest/graphicstest.ino b/lib/Adafruit-GFX-Library-1.2.9/examples/mock_ili9341/mock_ili9341.ino similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/graphicstest/graphicstest.ino rename to lib/Adafruit-GFX-Library-1.2.9/examples/mock_ili9341/mock_ili9341.ino diff --git a/lib/Adafruit_GFX-1.2.2.07/fontconvert/Makefile b/lib/Adafruit-GFX-Library-1.2.9/fontconvert/Makefile similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/fontconvert/Makefile rename to lib/Adafruit-GFX-Library-1.2.9/fontconvert/Makefile diff --git a/lib/Adafruit_GFX-1.2.2.07/fontconvert/fontconvert.c b/lib/Adafruit-GFX-Library-1.2.9/fontconvert/fontconvert.c similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/fontconvert/fontconvert.c rename to lib/Adafruit-GFX-Library-1.2.9/fontconvert/fontconvert.c diff --git a/lib/Adafruit_GFX-1.2.2.07/fontconvert/fontconvert_win.md b/lib/Adafruit-GFX-Library-1.2.9/fontconvert/fontconvert_win.md similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/fontconvert/fontconvert_win.md rename to lib/Adafruit-GFX-Library-1.2.9/fontconvert/fontconvert_win.md diff --git a/lib/Adafruit_GFX-1.2.2.07/fontconvert/makefonts.sh b/lib/Adafruit-GFX-Library-1.2.9/fontconvert/makefonts.sh similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/fontconvert/makefonts.sh rename to lib/Adafruit-GFX-Library-1.2.9/fontconvert/makefonts.sh diff --git a/lib/Adafruit-GFX-Library-1.2.9/gfxfont.h b/lib/Adafruit-GFX-Library-1.2.9/gfxfont.h new file mode 100644 index 000000000..c691de645 --- /dev/null +++ b/lib/Adafruit-GFX-Library-1.2.9/gfxfont.h @@ -0,0 +1,29 @@ +// Font structures for newer Adafruit_GFX (1.1 and later). +// Example fonts are included in 'Fonts' directory. +// To use a font in your Arduino sketch, #include the corresponding .h +// file and pass address of GFXfont struct to setFont(). Pass NULL to +// revert to 'classic' fixed-space bitmap font. + +#ifndef _GFXFONT_H_ +#define _GFXFONT_H_ + +/// Font data stored PER GLYPH +typedef struct { + uint16_t bitmapOffset; ///< Pointer into GFXfont->bitmap + uint8_t width; ///< Bitmap dimensions in pixels + uint8_t height; ///< Bitmap dimensions in pixels + uint8_t xAdvance; ///< Distance to advance cursor (x axis) + int8_t xOffset; ///< X dist from cursor pos to UL corner + int8_t yOffset; ///< Y dist from cursor pos to UL corner +} GFXglyph; + +/// Data stored for FONT AS A WHOLE +typedef struct { + uint8_t *bitmap; ///< Glyph bitmaps, concatenated + GFXglyph *glyph; ///< Glyph array + uint8_t first; ///< ASCII extents (first char) + uint8_t last; ///< ASCII extents (last char) + uint8_t yAdvance; ///< Newline distance (y axis) +} GFXfont; + +#endif // _GFXFONT_H_ diff --git a/lib/Adafruit_GFX-1.2.2.07/glcdfont.c b/lib/Adafruit-GFX-Library-1.2.9/glcdfont.c similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/glcdfont.c rename to lib/Adafruit-GFX-Library-1.2.9/glcdfont.c diff --git a/lib/Adafruit_GFX-1.2.2.07/library.properties b/lib/Adafruit-GFX-Library-1.2.9/library.properties similarity index 96% rename from lib/Adafruit_GFX-1.2.2.07/library.properties rename to lib/Adafruit-GFX-Library-1.2.9/library.properties index c6b0c4751..eea478015 100644 --- a/lib/Adafruit_GFX-1.2.2.07/library.properties +++ b/lib/Adafruit-GFX-Library-1.2.9/library.properties @@ -1,5 +1,5 @@ name=Adafruit GFX Library -version=1.2.2 +version=1.2.9 author=Adafruit maintainer=Adafruit sentence=Adafruit GFX graphics core library, this is the 'core' class that all our other graphics libraries derive from. diff --git a/lib/Adafruit_GFX-1.2.2.07/license.txt b/lib/Adafruit-GFX-Library-1.2.9/license.txt similarity index 100% rename from lib/Adafruit_GFX-1.2.2.07/license.txt rename to lib/Adafruit-GFX-Library-1.2.9/license.txt diff --git a/lib/Adafruit_GFX-1.2.2.07/.gitignore b/lib/Adafruit_GFX-1.2.2.07/.gitignore deleted file mode 100644 index 7b2fd3a2f..000000000 --- a/lib/Adafruit_GFX-1.2.2.07/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -default.vim -fontconvert/fontconvert diff --git a/lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.cpp b/lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.cpp deleted file mode 100644 index 9b6c8bbb6..000000000 --- a/lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/*************************************************** - This is our library for generic SPI TFT Displays with - address windows and 16 bit color (e.g. ILI9341, HX8357D, ST7735...) - - Check out the links above for our tutorials and wiring diagrams - These displays use SPI to communicate, 4 or 5 pins are required to - interface (RST is optional) - Adafruit invests time and resources providing this open source code, - please support Adafruit and open-source hardware by purchasing - products from Adafruit! - - Written by Limor Fried/Ladyada for Adafruit Industries. - MIT license, all text above must be included in any redistribution - ****************************************************/ - - -#include "Adafruit_SPITFT.h" -#ifndef ARDUINO_STM32_FEATHER - #include "pins_arduino.h" -#ifndef RASPI - #include "wiring_private.h" -#endif -#endif -#include - -#include "Adafruit_SPITFT_Macros.h" - - - -// Pass 8-bit (each) R,G,B, get back 16-bit packed color -uint16_t Adafruit_SPITFT::color565(uint8_t r, uint8_t g, uint8_t b) { - return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3); -} - -Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, - int8_t cs, int8_t dc, int8_t mosi, - int8_t sclk, int8_t rst, int8_t miso) - : Adafruit_GFX(w, h) { - _cs = cs; - _dc = dc; - _rst = rst; - _sclk = sclk; - _mosi = mosi; - _miso = miso; - _freq = 0; -#ifdef USE_FAST_PINIO - csport = portOutputRegister(digitalPinToPort(_cs)); - cspinmask = digitalPinToBitMask(_cs); - dcport = portOutputRegister(digitalPinToPort(_dc)); - dcpinmask = digitalPinToBitMask(_dc); - clkport = portOutputRegister(digitalPinToPort(_sclk)); - clkpinmask = digitalPinToBitMask(_sclk); - mosiport = portOutputRegister(digitalPinToPort(_mosi)); - mosipinmask = digitalPinToBitMask(_mosi); - if(miso >= 0){ - misoport = portInputRegister(digitalPinToPort(_miso)); - misopinmask = digitalPinToBitMask(_miso); - } else { - misoport = 0; - misopinmask = 0; - } -#endif -} - -Adafruit_SPITFT::Adafruit_SPITFT(uint16_t w, uint16_t h, - int8_t cs, int8_t dc, int8_t rst) - : Adafruit_GFX(w, h) { - _cs = cs; - _dc = dc; - _rst = rst; - _sclk = -1; - _mosi = -1; - _miso = -1; - _freq = 0; -#ifdef USE_FAST_PINIO - csport = portOutputRegister(digitalPinToPort(_cs)); - cspinmask = digitalPinToBitMask(_cs); - dcport = portOutputRegister(digitalPinToPort(_dc)); - dcpinmask = digitalPinToBitMask(_dc); - clkport = 0; - clkpinmask = 0; - mosiport = 0; - mosipinmask = 0; - misoport = 0; - misopinmask = 0; -#endif -} - - -void Adafruit_SPITFT::initSPI(uint32_t freq) -{ - _freq = freq; - - // Control Pins - pinMode(_dc, OUTPUT); - digitalWrite(_dc, LOW); - pinMode(_cs, OUTPUT); - digitalWrite(_cs, HIGH); - - // Software SPI - if(_sclk >= 0){ - pinMode(_mosi, OUTPUT); - digitalWrite(_mosi, LOW); - pinMode(_sclk, OUTPUT); - digitalWrite(_sclk, HIGH); - if(_miso >= 0){ - pinMode(_miso, INPUT); - } - } - - // Hardware SPI - SPI_BEGIN(); - - // toggle RST low to reset - if (_rst >= 0) { - pinMode(_rst, OUTPUT); - digitalWrite(_rst, HIGH); - delay(100); - digitalWrite(_rst, LOW); - delay(100); - digitalWrite(_rst, HIGH); - delay(200); - } -} - -uint8_t Adafruit_SPITFT::spiRead() { - if(_sclk < 0){ - return HSPI_READ(); - } - if(_miso < 0){ - return 0; - } - uint8_t r = 0; - for (uint8_t i=0; i<8; i++) { - SSPI_SCK_LOW(); - SSPI_SCK_HIGH(); - r <<= 1; - if (SSPI_MISO_READ()){ - r |= 0x1; - } - } - return r; -} - -void Adafruit_SPITFT::spiWrite(uint8_t b) { - if(_sclk < 0){ - HSPI_WRITE(b); - return; - } - for(uint8_t bit = 0x80; bit; bit >>= 1){ - if((b) & bit){ - SSPI_MOSI_HIGH(); - } else { - SSPI_MOSI_LOW(); - } - SSPI_SCK_LOW(); - SSPI_SCK_HIGH(); - } -} - - -/* - * Transaction API - * */ - -void Adafruit_SPITFT::startWrite(void){ - SPI_BEGIN_TRANSACTION(); - SPI_CS_LOW(); -} - -void Adafruit_SPITFT::endWrite(void){ - SPI_CS_HIGH(); - SPI_END_TRANSACTION(); -} - -void Adafruit_SPITFT::writeCommand(uint8_t cmd){ - SPI_DC_LOW(); - spiWrite(cmd); - SPI_DC_HIGH(); -} - -void Adafruit_SPITFT::pushColor(uint16_t color) { - startWrite(); - SPI_WRITE16(color); - endWrite(); -} - - -void Adafruit_SPITFT::writePixel(uint16_t color){ - SPI_WRITE16(color); -} - -void Adafruit_SPITFT::writePixels(uint16_t * colors, uint32_t len){ - SPI_WRITE_PIXELS((uint8_t*)colors , len * 2); -} - -void Adafruit_SPITFT::writeColor(uint16_t color, uint32_t len){ -#ifdef SPI_HAS_WRITE_PIXELS - if(_sclk >= 0){ - for (uint32_t t=0; t SPI_MAX_PIXELS_AT_ONCE)?SPI_MAX_PIXELS_AT_ONCE:len; - uint16_t tlen = 0; - - for (uint32_t t=0; tblen)?blen:len; - writePixels(temp, tlen); - len -= tlen; - } -#else - uint8_t hi = color >> 8, lo = color; - if(_sclk < 0){ //AVR Optimization - for (uint32_t t=len; t; t--){ - HSPI_WRITE(hi); - HSPI_WRITE(lo); - } - return; - } - for (uint32_t t=len; t; t--){ - spiWrite(hi); - spiWrite(lo); - } -#endif -} - -void Adafruit_SPITFT::writePixel(int16_t x, int16_t y, uint16_t color) { - if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return; - setAddrWindow(x,y,1,1); - writePixel(color); -} - -void Adafruit_SPITFT::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color){ - if((x >= _width) || (y >= _height)) return; - int16_t x2 = x + w - 1, y2 = y + h - 1; - if((x2 < 0) || (y2 < 0)) return; - - // Clip left/top - if(x < 0) { - x = 0; - w = x2 + 1; - } - if(y < 0) { - y = 0; - h = y2 + 1; - } - - // Clip right/bottom - if(x2 >= _width) w = _width - x; - if(y2 >= _height) h = _height - y; - - int32_t len = (int32_t)w * h; - setAddrWindow(x, y, w, h); - writeColor(color, len); -} - -void Adafruit_SPITFT::writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color){ - writeFillRect(x, y, 1, h, color); -} - -void Adafruit_SPITFT::writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color){ - writeFillRect(x, y, w, 1, color); -} - -void Adafruit_SPITFT::drawPixel(int16_t x, int16_t y, uint16_t color){ - startWrite(); - writePixel(x, y, color); - endWrite(); -} - -void Adafruit_SPITFT::drawFastVLine(int16_t x, int16_t y, - int16_t h, uint16_t color) { - startWrite(); - writeFastVLine(x, y, h, color); - endWrite(); -} - -void Adafruit_SPITFT::drawFastHLine(int16_t x, int16_t y, - int16_t w, uint16_t color) { - startWrite(); - writeFastHLine(x, y, w, color); - endWrite(); -} - -void Adafruit_SPITFT::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, - uint16_t color) { - startWrite(); - writeFillRect(x,y,w,h,color); - endWrite(); -} - -// Adapted from https://github.com/PaulStoffregen/ILI9341_t3 -// by Marc MERLIN. See examples/pictureEmbed to use this. -// 5/6/2017: function name and arguments have changed for compatibility -// with current GFX library and to avoid naming problems in prior -// implementation. Formerly drawBitmap() with arguments in different order. -void Adafruit_SPITFT::drawRGBBitmap(int16_t x, int16_t y, - uint16_t *pcolors, int16_t w, int16_t h) { - - int16_t x2, y2; // Lower-right coord - if(( x >= _width ) || // Off-edge right - ( y >= _height) || // " top - ((x2 = (x+w-1)) < 0 ) || // " left - ((y2 = (y+h-1)) < 0) ) return; // " bottom - - int16_t bx1=0, by1=0, // Clipped top-left within bitmap - saveW=w; // Save original bitmap width value - if(x < 0) { // Clip left - w += x; - bx1 = -x; - x = 0; - } - if(y < 0) { // Clip top - h += y; - by1 = -y; - y = 0; - } - if(x2 >= _width ) w = _width - x; // Clip right - if(y2 >= _height) h = _height - y; // Clip bottom - - pcolors += by1 * saveW + bx1; // Offset bitmap ptr to clipped top-left - startWrite(); - setAddrWindow(x, y, w, h); // Clipped area - while(h--) { // For each (clipped) scanline... - writePixels(pcolors, w); // Push one (clipped) row - pcolors += saveW; // Advance pointer by one full (unclipped) line - } - endWrite(); -} diff --git a/lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.h b/lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.h deleted file mode 100644 index 0024a0193..000000000 --- a/lib/Adafruit_GFX-1.2.2.07/Adafruit_SPITFT.h +++ /dev/null @@ -1,80 +0,0 @@ - -#ifndef _ADAFRUIT_SPITFT_ -#define _ADAFRUIT_SPITFT_ - - -#if ARDUINO >= 100 - #include "Arduino.h" - #include "Print.h" -#else - #include "WProgram.h" -#endif -#include -#include "Adafruit_GFX.h" - - -#if defined(ARDUINO_STM32_FEATHER) -typedef volatile uint32 RwReg; -#endif -#if defined(ARDUINO_FEATHER52) -typedef volatile uint32_t RwReg; -#endif - -class Adafruit_SPITFT : public Adafruit_GFX { - protected: - - public: - Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST = -1, int8_t _MISO = -1); - Adafruit_SPITFT(uint16_t w, uint16_t h, int8_t _CS, int8_t _DC, int8_t _RST = -1); - - virtual void begin(uint32_t freq) = 0; - void initSPI(uint32_t freq); - - // Required Non-Transaction - void drawPixel(int16_t x, int16_t y, uint16_t color); - - // Transaction API - void startWrite(void); - void endWrite(void); - void writePixel(int16_t x, int16_t y, uint16_t color); - void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); - void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); - void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); - - // Transaction API not used by GFX - virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) = 0; - void writePixel(uint16_t color); - void writePixels(uint16_t * colors, uint32_t len); - void writeColor(uint16_t color, uint32_t len); - void pushColor(uint16_t color); - - // Recommended Non-Transaction - void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); - void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); - void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); - - using Adafruit_GFX::drawRGBBitmap; // Check base class first - void drawRGBBitmap(int16_t x, int16_t y, - uint16_t *pcolors, int16_t w, int16_t h); - - uint16_t color565(uint8_t r, uint8_t g, uint8_t b); - - protected: - uint32_t _freq; -#if defined (__AVR__) || defined(TEENSYDUINO) || defined (ESP8266) || defined (ESP32) - int8_t _cs, _dc, _rst, _sclk, _mosi, _miso; -#else - int32_t _cs, _dc, _rst, _sclk, _mosi, _miso; -#endif - -#ifdef USE_FAST_PINIO - volatile RwReg *mosiport, *misoport, *clkport, *dcport, *csport; - RwReg mosipinmask, misopinmask, clkpinmask, cspinmask, dcpinmask; -#endif - - void writeCommand(uint8_t cmd); - void spiWrite(uint8_t v); - uint8_t spiRead(void); -}; - -#endif diff --git a/lib/Adafruit_GFX-1.2.2.07/gfxfont.h b/lib/Adafruit_GFX-1.2.2.07/gfxfont.h deleted file mode 100644 index 07381eddd..000000000 --- a/lib/Adafruit_GFX-1.2.2.07/gfxfont.h +++ /dev/null @@ -1,24 +0,0 @@ -// Font structures for newer Adafruit_GFX (1.1 and later). -// Example fonts are included in 'Fonts' directory. -// To use a font in your Arduino sketch, #include the corresponding .h -// file and pass address of GFXfont struct to setFont(). Pass NULL to -// revert to 'classic' fixed-space bitmap font. - -#ifndef _GFXFONT_H_ -#define _GFXFONT_H_ - -typedef struct { // Data stored PER GLYPH - uint16_t bitmapOffset; // Pointer into GFXfont->bitmap - uint8_t width, height; // Bitmap dimensions in pixels - uint8_t xAdvance; // Distance to advance cursor (x axis) - int8_t xOffset, yOffset; // Dist from cursor pos to UL corner -} GFXglyph; - -typedef struct { // Data stored for FONT AS A WHOLE: - uint8_t *bitmap; // Glyph bitmaps, concatenated - GFXglyph *glyph; // Glyph array - uint8_t first, last; // ASCII extents - uint8_t yAdvance; // Newline distance (y axis) -} GFXfont; - -#endif // _GFXFONT_H_ diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/Adafruit_ILI9341.cpp b/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/Adafruit_ILI9341.cpp deleted file mode 100644 index f7e627396..000000000 --- a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/Adafruit_ILI9341.cpp +++ /dev/null @@ -1,683 +0,0 @@ -/*************************************************** - This is our library for the Adafruit ILI9341 Breakout and Shield - ----> http://www.adafruit.com/products/1651 - - Check out the links above for our tutorials and wiring diagrams - These displays use SPI to communicate, 4 or 5 pins are required to - interface (RST is optional) - Adafruit invests time and resources providing this open source code, - please support Adafruit and open-source hardware by purchasing - products from Adafruit! - - Written by Limor Fried/Ladyada for Adafruit Industries. - MIT license, all text above must be included in any redistribution - ****************************************************/ - -#include "Adafruit_ILI9341.h" -#ifndef ARDUINO_STM32_FEATHER - #include "pins_arduino.h" -#ifndef RASPI - #include "wiring_private.h" -#endif -#endif -#include - - -#define MADCTL_MY 0x80 -#define MADCTL_MX 0x40 -#define MADCTL_MV 0x20 -#define MADCTL_ML 0x10 -#define MADCTL_RGB 0x00 -#define MADCTL_BGR 0x08 -#define MADCTL_MH 0x04 - -/* - * Control Pins - * */ - -#ifdef USE_FAST_PINIO -#define SPI_DC_HIGH() *dcport |= dcpinmask -#define SPI_DC_LOW() *dcport &= ~dcpinmask -#define SPI_CS_HIGH() *csport |= cspinmask -#define SPI_CS_LOW() *csport &= ~cspinmask -#else -#define SPI_DC_HIGH() digitalWrite(_dc, HIGH) -#define SPI_DC_LOW() digitalWrite(_dc, LOW) -#define SPI_CS_HIGH() digitalWrite(_cs, HIGH) -#define SPI_CS_LOW() digitalWrite(_cs, LOW) -#endif - -/* - * Software SPI Macros - * */ - -#ifdef USE_FAST_PINIO -#define SSPI_MOSI_HIGH() *mosiport |= mosipinmask -#define SSPI_MOSI_LOW() *mosiport &= ~mosipinmask -#define SSPI_SCK_HIGH() *clkport |= clkpinmask -#define SSPI_SCK_LOW() *clkport &= ~clkpinmask -#define SSPI_MISO_READ() ((*misoport & misopinmask) != 0) -#else -#define SSPI_MOSI_HIGH() digitalWrite(_mosi, HIGH) -#define SSPI_MOSI_LOW() digitalWrite(_mosi, LOW) -#define SSPI_SCK_HIGH() digitalWrite(_sclk, HIGH) -#define SSPI_SCK_LOW() digitalWrite(_sclk, LOW) -#define SSPI_MISO_READ() digitalRead(_miso) -#endif - -#define SSPI_BEGIN_TRANSACTION() -#define SSPI_END_TRANSACTION() -#define SSPI_WRITE(v) spiWrite(v) -#define SSPI_WRITE16(s) SSPI_WRITE((s) >> 8); SSPI_WRITE(s) -#define SSPI_WRITE32(l) SSPI_WRITE((l) >> 24); SSPI_WRITE((l) >> 16); SSPI_WRITE((l) >> 8); SSPI_WRITE(l) -#define SSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<(l); i+=2){ SSPI_WRITE(((uint8_t*)(c))[i+1]); SSPI_WRITE(((uint8_t*)(c))[i]); } - -/* - * Hardware SPI Macros - * */ - -#ifndef ESP32 - #define SPI_OBJECT SPI -#else - #define SPI_OBJECT _spi -#endif - -#if defined (__AVR__) || defined(TEENSYDUINO) || defined(ARDUINO_ARCH_STM32F1) - #define HSPI_SET_CLOCK() SPI_OBJECT.setClockDivider(SPI_CLOCK_DIV2); -#elif defined (__arm__) - #define HSPI_SET_CLOCK() SPI_OBJECT.setClockDivider(11); -#elif defined(ESP8266) || defined(ESP32) - #define HSPI_SET_CLOCK() SPI_OBJECT.setFrequency(_freq); -#elif defined(RASPI) - #define HSPI_SET_CLOCK() SPI_OBJECT.setClock(_freq); -#elif defined(ARDUINO_ARCH_STM32F1) - #define HSPI_SET_CLOCK() SPI_OBJECT.setClock(_freq); -#else - #define HSPI_SET_CLOCK() -#endif - -#ifdef SPI_HAS_TRANSACTION - #define HSPI_BEGIN_TRANSACTION() SPI_OBJECT.beginTransaction(SPISettings(_freq, MSBFIRST, SPI_MODE0)) - #define HSPI_END_TRANSACTION() SPI_OBJECT.endTransaction() -#else - #define HSPI_BEGIN_TRANSACTION() HSPI_SET_CLOCK(); SPI_OBJECT.setBitOrder(MSBFIRST); SPI_OBJECT.setDataMode(SPI_MODE0) - #define HSPI_END_TRANSACTION() -#endif - -#ifdef ESP32 - #define SPI_HAS_WRITE_PIXELS -#endif -#if defined(ESP8266) || defined(ESP32) - // Optimized SPI (ESP8266 and ESP32) - #define HSPI_READ() SPI_OBJECT.transfer(0) - #define HSPI_WRITE(b) SPI_OBJECT.write(b) - #define HSPI_WRITE16(s) SPI_OBJECT.write16(s) - #define HSPI_WRITE32(l) SPI_OBJECT.write32(l) - #ifdef SPI_HAS_WRITE_PIXELS - #define SPI_MAX_PIXELS_AT_ONCE 32 - #define HSPI_WRITE_PIXELS(c,l) SPI_OBJECT.writePixels(c,l) - #else - #define HSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<((l)/2); i++){ SPI_WRITE16(((uint16_t*)(c))[i]); } - #endif -#else - // Standard Byte-by-Byte SPI - - #if defined (__AVR__) || defined(TEENSYDUINO) -static inline uint8_t _avr_spi_read(void) __attribute__((always_inline)); -static inline uint8_t _avr_spi_read(void) { - uint8_t r = 0; - SPDR = r; - while(!(SPSR & _BV(SPIF))); - r = SPDR; - return r; -} - #define HSPI_WRITE(b) {SPDR = (b); while(!(SPSR & _BV(SPIF)));} - #define HSPI_READ() _avr_spi_read() - #else - #define HSPI_WRITE(b) SPI_OBJECT.transfer((uint8_t)(b)) - #define HSPI_READ() HSPI_WRITE(0) - #endif - #define HSPI_WRITE16(s) HSPI_WRITE((s) >> 8); HSPI_WRITE(s) - #define HSPI_WRITE32(l) HSPI_WRITE((l) >> 24); HSPI_WRITE((l) >> 16); HSPI_WRITE((l) >> 8); HSPI_WRITE(l) - #define HSPI_WRITE_PIXELS(c,l) for(uint32_t i=0; i<(l); i+=2){ HSPI_WRITE(((uint8_t*)(c))[i+1]); HSPI_WRITE(((uint8_t*)(c))[i]); } -#endif - -/* - * Final SPI Macros - * */ -#if defined (ARDUINO_ARCH_ARC32) -#define SPI_DEFAULT_FREQ 16000000 -#elif defined (__AVR__) || defined(TEENSYDUINO) -#define SPI_DEFAULT_FREQ 8000000 -#elif defined(ESP8266) || defined(ESP32) -#define SPI_DEFAULT_FREQ 40000000 -#elif defined(RASPI) -#define SPI_DEFAULT_FREQ 80000000 -#elif defined(ARDUINO_ARCH_STM32F1) -#define SPI_DEFAULT_FREQ 36000000 -#else -#define SPI_DEFAULT_FREQ 24000000 -#endif - -#define SPI_BEGIN() if(_sclk < 0){SPI_OBJECT.begin();} -#define SPI_BEGIN_TRANSACTION() if(_sclk < 0){HSPI_BEGIN_TRANSACTION();} -#define SPI_END_TRANSACTION() if(_sclk < 0){HSPI_END_TRANSACTION();} -#define SPI_WRITE16(s) if(_sclk < 0){HSPI_WRITE16(s);}else{SSPI_WRITE16(s);} -#define SPI_WRITE32(l) if(_sclk < 0){HSPI_WRITE32(l);}else{SSPI_WRITE32(l);} -#define SPI_WRITE_PIXELS(c,l) if(_sclk < 0){HSPI_WRITE_PIXELS(c,l);}else{SSPI_WRITE_PIXELS(c,l);} - -// Pass 8-bit (each) R,G,B, get back 16-bit packed color -uint16_t Adafruit_ILI9341::color565(uint8_t r, uint8_t g, uint8_t b) { - return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | ((b & 0xF8) >> 3); -} - -Adafruit_ILI9341::Adafruit_ILI9341(int8_t cs, int8_t dc, int8_t mosi, - int8_t sclk, int8_t rst, int8_t miso) : Adafruit_GFX(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT) { - _cs = cs; - _dc = dc; - _rst = rst; - _sclk = sclk; - _mosi = mosi; - _miso = miso; - _freq = 0; -#ifdef USE_FAST_PINIO - csport = portOutputRegister(digitalPinToPort(_cs)); - cspinmask = digitalPinToBitMask(_cs); - dcport = portOutputRegister(digitalPinToPort(_dc)); - dcpinmask = digitalPinToBitMask(_dc); - clkport = portOutputRegister(digitalPinToPort(_sclk)); - clkpinmask = digitalPinToBitMask(_sclk); - mosiport = portOutputRegister(digitalPinToPort(_mosi)); - mosipinmask = digitalPinToBitMask(_mosi); - if(miso >= 0){ - misoport = portInputRegister(digitalPinToPort(_miso)); - misopinmask = digitalPinToBitMask(_miso); - } else { - misoport = 0; - misopinmask = 0; - } -#endif -} - -Adafruit_ILI9341::Adafruit_ILI9341(int8_t cs, int8_t dc, int8_t rst) : Adafruit_GFX(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT) { - _cs = cs; - _dc = dc; - _rst = rst; - _sclk = -1; - _mosi = -1; - _miso = -1; - _freq = 0; -#ifdef USE_FAST_PINIO - csport = portOutputRegister(digitalPinToPort(_cs)); - cspinmask = digitalPinToBitMask(_cs); - dcport = portOutputRegister(digitalPinToPort(_dc)); - dcpinmask = digitalPinToBitMask(_dc); - clkport = 0; - clkpinmask = 0; - mosiport = 0; - mosipinmask = 0; - misoport = 0; - misopinmask = 0; -#endif -} - - -#ifdef ESP32 -void Adafruit_ILI9341::begin(uint32_t freq, SPIClass &spi) -#else -void Adafruit_ILI9341::begin(uint32_t freq) -#endif -{ -#ifdef ESP32 - _spi = spi; -#endif - if(!freq){ - freq = SPI_DEFAULT_FREQ; - } - _freq = freq; - - // Control Pins - pinMode(_dc, OUTPUT); - digitalWrite(_dc, LOW); - pinMode(_cs, OUTPUT); - digitalWrite(_cs, HIGH); - - // Software SPI - if(_sclk >= 0){ - pinMode(_mosi, OUTPUT); - digitalWrite(_mosi, LOW); - pinMode(_sclk, OUTPUT); - digitalWrite(_sclk, HIGH); - if(_miso >= 0){ - pinMode(_miso, INPUT); - } - } - - // Hardware SPI - SPI_BEGIN(); - - // toggle RST low to reset - if (_rst >= 0) { - pinMode(_rst, OUTPUT); - digitalWrite(_rst, HIGH); - delay(100); - digitalWrite(_rst, LOW); - delay(100); - digitalWrite(_rst, HIGH); - delay(200); - } - - startWrite(); - - writeCommand(0xEF); - spiWrite(0x03); - spiWrite(0x80); - spiWrite(0x02); - - writeCommand(0xCF); - spiWrite(0x00); - spiWrite(0XC1); - spiWrite(0X30); - - writeCommand(0xED); - spiWrite(0x64); - spiWrite(0x03); - spiWrite(0X12); - spiWrite(0X81); - - writeCommand(0xE8); - spiWrite(0x85); - spiWrite(0x00); - spiWrite(0x78); - - writeCommand(0xCB); - spiWrite(0x39); - spiWrite(0x2C); - spiWrite(0x00); - spiWrite(0x34); - spiWrite(0x02); - - writeCommand(0xF7); - spiWrite(0x20); - - writeCommand(0xEA); - spiWrite(0x00); - spiWrite(0x00); - - writeCommand(ILI9341_PWCTR1); //Power control - spiWrite(0x23); //VRH[5:0] - - writeCommand(ILI9341_PWCTR2); //Power control - spiWrite(0x10); //SAP[2:0];BT[3:0] - - writeCommand(ILI9341_VMCTR1); //VCM control - spiWrite(0x3e); - spiWrite(0x28); - - writeCommand(ILI9341_VMCTR2); //VCM control2 - spiWrite(0x86); //-- - - writeCommand(ILI9341_MADCTL); // Memory Access Control - spiWrite(0x48); - - writeCommand(ILI9341_VSCRSADD); // Vertical scroll - SPI_WRITE16(0); // Zero - - writeCommand(ILI9341_PIXFMT); - spiWrite(0x55); - - writeCommand(ILI9341_FRMCTR1); - spiWrite(0x00); - spiWrite(0x18); - - writeCommand(ILI9341_DFUNCTR); // Display Function Control - spiWrite(0x08); - spiWrite(0x82); - spiWrite(0x27); - - writeCommand(0xF2); // 3Gamma Function Disable - spiWrite(0x00); - - writeCommand(ILI9341_GAMMASET); //Gamma curve selected - spiWrite(0x01); - - writeCommand(ILI9341_GMCTRP1); //Set Gamma - spiWrite(0x0F); - spiWrite(0x31); - spiWrite(0x2B); - spiWrite(0x0C); - spiWrite(0x0E); - spiWrite(0x08); - spiWrite(0x4E); - spiWrite(0xF1); - spiWrite(0x37); - spiWrite(0x07); - spiWrite(0x10); - spiWrite(0x03); - spiWrite(0x0E); - spiWrite(0x09); - spiWrite(0x00); - - writeCommand(ILI9341_GMCTRN1); //Set Gamma - spiWrite(0x00); - spiWrite(0x0E); - spiWrite(0x14); - spiWrite(0x03); - spiWrite(0x11); - spiWrite(0x07); - spiWrite(0x31); - spiWrite(0xC1); - spiWrite(0x48); - spiWrite(0x08); - spiWrite(0x0F); - spiWrite(0x0C); - spiWrite(0x31); - spiWrite(0x36); - spiWrite(0x0F); - - writeCommand(ILI9341_SLPOUT); //Exit Sleep - delay(120); - writeCommand(ILI9341_DISPON); //Display on - delay(120); - endWrite(); - - _width = ILI9341_TFTWIDTH; - _height = ILI9341_TFTHEIGHT; -} - -/*********************************************************************************************/ - -void Adafruit_ILI9341::setScrollMargins(uint16_t top, uint16_t bottom) -{ - uint16_t height = _height - (top + bottom); - - startWrite(); - writeCommand(0x33); - SPI_WRITE16(top); - SPI_WRITE16(height); - SPI_WRITE16(bottom); - endWrite(); -} - -/*********************************************************************************************/ - -void Adafruit_ILI9341::setRotation(uint8_t m) { - rotation = m % 4; // can't be higher than 3 - switch (rotation) { - case 0: - m = (MADCTL_MX | MADCTL_BGR); - _width = ILI9341_TFTWIDTH; - _height = ILI9341_TFTHEIGHT; - break; - case 1: - m = (MADCTL_MV | MADCTL_BGR); - _width = ILI9341_TFTHEIGHT; - _height = ILI9341_TFTWIDTH; - break; - case 2: - m = (MADCTL_MY | MADCTL_BGR); - _width = ILI9341_TFTWIDTH; - _height = ILI9341_TFTHEIGHT; - break; - case 3: - m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR); - _width = ILI9341_TFTHEIGHT; - _height = ILI9341_TFTWIDTH; - break; - } - - startWrite(); - writeCommand(ILI9341_MADCTL); - spiWrite(m); - endWrite(); -} - -void Adafruit_ILI9341::invertDisplay(boolean i) { - startWrite(); - writeCommand(i ? ILI9341_INVON : ILI9341_INVOFF); - endWrite(); -} - -void Adafruit_ILI9341::scrollTo(uint16_t y) { - startWrite(); - writeCommand(ILI9341_VSCRSADD); - SPI_WRITE16(y); - endWrite(); -} - -uint8_t Adafruit_ILI9341::spiRead() { - if(_sclk < 0){ - return HSPI_READ(); - } - if(_miso < 0){ - return 0; - } - uint8_t r = 0; - for (uint8_t i=0; i<8; i++) { - SSPI_SCK_LOW(); - SSPI_SCK_HIGH(); - r <<= 1; - if (SSPI_MISO_READ()){ - r |= 0x1; - } - } - return r; -} - -void Adafruit_ILI9341::spiWrite(uint8_t b) { - if(_sclk < 0){ - HSPI_WRITE(b); - return; - } - for(uint8_t bit = 0x80; bit; bit >>= 1){ - if((b) & bit){ - SSPI_MOSI_HIGH(); - } else { - SSPI_MOSI_LOW(); - } - SSPI_SCK_LOW(); - SSPI_SCK_HIGH(); - } -} - - -/* - * Transaction API - * */ - -void Adafruit_ILI9341::startWrite(void){ - SPI_BEGIN_TRANSACTION(); - SPI_CS_LOW(); -} - -void Adafruit_ILI9341::endWrite(void){ - SPI_CS_HIGH(); - SPI_END_TRANSACTION(); -} - -void Adafruit_ILI9341::writeCommand(uint8_t cmd){ - SPI_DC_LOW(); - spiWrite(cmd); - SPI_DC_HIGH(); -} - -void Adafruit_ILI9341::setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { - uint32_t xa = ((uint32_t)x << 16) | (x+w-1); - uint32_t ya = ((uint32_t)y << 16) | (y+h-1); - writeCommand(ILI9341_CASET); // Column addr set - SPI_WRITE32(xa); - writeCommand(ILI9341_PASET); // Row addr set - SPI_WRITE32(ya); - writeCommand(ILI9341_RAMWR); // write to RAM -} - -void Adafruit_ILI9341::pushColor(uint16_t color) { - startWrite(); - SPI_WRITE16(color); - endWrite(); -} - - -void Adafruit_ILI9341::writePixel(uint16_t color){ - SPI_WRITE16(color); -} - -void Adafruit_ILI9341::writePixels(uint16_t * colors, uint32_t len){ - SPI_WRITE_PIXELS((uint8_t*)colors , len * 2); -} - -void Adafruit_ILI9341::writeColor(uint16_t color, uint32_t len){ -#ifdef SPI_HAS_WRITE_PIXELS - if(_sclk >= 0){ - for (uint32_t t=0; t SPI_MAX_PIXELS_AT_ONCE)?SPI_MAX_PIXELS_AT_ONCE:len; - uint16_t tlen = 0; - - for (uint32_t t=0; tblen)?blen:len; - writePixels(temp, tlen); - len -= tlen; - } -#else - uint8_t hi = color >> 8, lo = color; - if(_sclk < 0){ //AVR Optimization - for (uint32_t t=len; t; t--){ - HSPI_WRITE(hi); - HSPI_WRITE(lo); - } - return; - } - for (uint32_t t=len; t; t--){ - spiWrite(hi); - spiWrite(lo); - } -#endif -} - -void Adafruit_ILI9341::writePixel(int16_t x, int16_t y, uint16_t color) { - if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return; - setAddrWindow(x,y,1,1); - writePixel(color); -} - -void Adafruit_ILI9341::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color){ - if((x >= _width) || (y >= _height)) return; - int16_t x2 = x + w - 1, y2 = y + h - 1; - if((x2 < 0) || (y2 < 0)) return; - - // Clip left/top - if(x < 0) { - x = 0; - w = x2 + 1; - } - if(y < 0) { - y = 0; - h = y2 + 1; - } - - // Clip right/bottom - if(x2 >= _width) w = _width - x; - if(y2 >= _height) h = _height - y; - - int32_t len = (int32_t)w * h; - setAddrWindow(x, y, w, h); - writeColor(color, len); -} - -void Adafruit_ILI9341::writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color){ - writeFillRect(x, y, 1, h, color); -} - -void Adafruit_ILI9341::writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color){ - writeFillRect(x, y, w, 1, color); -} - -uint8_t Adafruit_ILI9341::readcommand8(uint8_t c, uint8_t index) { - uint32_t freq = _freq; - if(_freq > 24000000){ - _freq = 24000000; - } - startWrite(); - writeCommand(0xD9); // woo sekret command? - spiWrite(0x10 + index); - writeCommand(c); - uint8_t r = spiRead(); - endWrite(); - _freq = freq; - return r; -} - -void Adafruit_ILI9341::drawPixel(int16_t x, int16_t y, uint16_t color){ - startWrite(); - writePixel(x, y, color); - endWrite(); -} - -void Adafruit_ILI9341::drawFastVLine(int16_t x, int16_t y, - int16_t h, uint16_t color) { - startWrite(); - writeFastVLine(x, y, h, color); - endWrite(); -} - -void Adafruit_ILI9341::drawFastHLine(int16_t x, int16_t y, - int16_t w, uint16_t color) { - startWrite(); - writeFastHLine(x, y, w, color); - endWrite(); -} - -void Adafruit_ILI9341::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, - uint16_t color) { - startWrite(); - writeFillRect(x,y,w,h,color); - endWrite(); -} - -// Adapted from https://github.com/PaulStoffregen/ILI9341_t3 -// by Marc MERLIN. See examples/pictureEmbed to use this. -// 5/6/2017: function name and arguments have changed for compatibility -// with current GFX library and to avoid naming problems in prior -// implementation. Formerly drawBitmap() with arguments in different order. -void Adafruit_ILI9341::drawRGBBitmap(int16_t x, int16_t y, - uint16_t *pcolors, int16_t w, int16_t h) { - - int16_t x2, y2; // Lower-right coord - if(( x >= _width ) || // Off-edge right - ( y >= _height) || // " top - ((x2 = (x+w-1)) < 0 ) || // " left - ((y2 = (y+h-1)) < 0) ) return; // " bottom - - int16_t bx1=0, by1=0, // Clipped top-left within bitmap - saveW=w; // Save original bitmap width value - if(x < 0) { // Clip left - w += x; - bx1 = -x; - x = 0; - } - if(y < 0) { // Clip top - h += y; - by1 = -y; - y = 0; - } - if(x2 >= _width ) w = _width - x; // Clip right - if(y2 >= _height) h = _height - y; // Clip bottom - - pcolors += by1 * saveW + bx1; // Offset bitmap ptr to clipped top-left - startWrite(); - setAddrWindow(x, y, w, h); // Clipped area - while(h--) { // For each (clipped) scanline... - writePixels(pcolors, w); // Push one (clipped) row - pcolors += saveW; // Advance pointer by one full (unclipped) line - } - endWrite(); -} diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/Adafruit_ILI9341.h b/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/Adafruit_ILI9341.h deleted file mode 100644 index 8c0b930c7..000000000 --- a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/Adafruit_ILI9341.h +++ /dev/null @@ -1,205 +0,0 @@ -/****************************************************************** - This is our library for the Adafruit ILI9341 Breakout and Shield - ----> http://www.adafruit.com/products/1651 - - Check out the links above for our tutorials and wiring diagrams - These displays use SPI to communicate, 4 or 5 pins are required - to interface (RST is optional) - Adafruit invests time and resources providing this open source - code, please support Adafruit and open-source hardware by - purchasing products from Adafruit! - - Written by Limor Fried/Ladyada for Adafruit Industries. - MIT license, all text above must be included in any redistribution - *******************************************************************/ - -#ifndef _ADAFRUIT_ILI9341H_ -#define _ADAFRUIT_ILI9341H_ - -#if ARDUINO >= 100 - #include "Arduino.h" - #include "Print.h" -#else - #include "WProgram.h" -#endif -#include -#include "Adafruit_GFX.h" - -#if defined(ARDUINO_STM32_FEATHER) -typedef volatile uint32 RwReg; -#endif -#if defined(ARDUINO_FEATHER52) -typedef volatile uint32_t RwReg; -#endif - -#define ILI9341_TFTWIDTH 240 -#define ILI9341_TFTHEIGHT 320 - -#define ILI9341_NOP 0x00 -#define ILI9341_SWRESET 0x01 -#define ILI9341_RDDID 0x04 -#define ILI9341_RDDST 0x09 - -#define ILI9341_SLPIN 0x10 -#define ILI9341_SLPOUT 0x11 -#define ILI9341_PTLON 0x12 -#define ILI9341_NORON 0x13 - -#define ILI9341_RDMODE 0x0A -#define ILI9341_RDMADCTL 0x0B -#define ILI9341_RDPIXFMT 0x0C -#define ILI9341_RDIMGFMT 0x0D -#define ILI9341_RDSELFDIAG 0x0F - -#define ILI9341_INVOFF 0x20 -#define ILI9341_INVON 0x21 -#define ILI9341_GAMMASET 0x26 -#define ILI9341_DISPOFF 0x28 -#define ILI9341_DISPON 0x29 - -#define ILI9341_CASET 0x2A -#define ILI9341_PASET 0x2B -#define ILI9341_RAMWR 0x2C -#define ILI9341_RAMRD 0x2E - -#define ILI9341_PTLAR 0x30 -#define ILI9341_MADCTL 0x36 -#define ILI9341_VSCRSADD 0x37 -#define ILI9341_PIXFMT 0x3A - -#define ILI9341_FRMCTR1 0xB1 -#define ILI9341_FRMCTR2 0xB2 -#define ILI9341_FRMCTR3 0xB3 -#define ILI9341_INVCTR 0xB4 -#define ILI9341_DFUNCTR 0xB6 - -#define ILI9341_PWCTR1 0xC0 -#define ILI9341_PWCTR2 0xC1 -#define ILI9341_PWCTR3 0xC2 -#define ILI9341_PWCTR4 0xC3 -#define ILI9341_PWCTR5 0xC4 -#define ILI9341_VMCTR1 0xC5 -#define ILI9341_VMCTR2 0xC7 - -#define ILI9341_RDID1 0xDA -#define ILI9341_RDID2 0xDB -#define ILI9341_RDID3 0xDC -#define ILI9341_RDID4 0xDD - -#define ILI9341_GMCTRP1 0xE0 -#define ILI9341_GMCTRN1 0xE1 -/* -#define ILI9341_PWCTR6 0xFC - - */ - -// Color definitions -#define ILI9341_BLACK 0x0000 /* 0, 0, 0 */ -#define ILI9341_NAVY 0x000F /* 0, 0, 128 */ -#define ILI9341_DARKGREEN 0x03E0 /* 0, 128, 0 */ -#define ILI9341_DARKCYAN 0x03EF /* 0, 128, 128 */ -#define ILI9341_MAROON 0x7800 /* 128, 0, 0 */ -#define ILI9341_PURPLE 0x780F /* 128, 0, 128 */ -#define ILI9341_OLIVE 0x7BE0 /* 128, 128, 0 */ -#define ILI9341_LIGHTGREY 0xC618 /* 192, 192, 192 */ -#define ILI9341_DARKGREY 0x7BEF /* 128, 128, 128 */ -#define ILI9341_BLUE 0x001F /* 0, 0, 255 */ -#define ILI9341_GREEN 0x07E0 /* 0, 255, 0 */ -#define ILI9341_CYAN 0x07FF /* 0, 255, 255 */ -#define ILI9341_RED 0xF800 /* 255, 0, 0 */ -#define ILI9341_MAGENTA 0xF81F /* 255, 0, 255 */ -#define ILI9341_YELLOW 0xFFE0 /* 255, 255, 0 */ -#define ILI9341_WHITE 0xFFFF /* 255, 255, 255 */ -#define ILI9341_ORANGE 0xFD20 /* 255, 165, 0 */ -#define ILI9341_GREENYELLOW 0xAFE5 /* 173, 255, 47 */ -#define ILI9341_PINK 0xF81F - -#if defined (ARDUINO_STM32_FEATHER) // doesnt work on wiced feather - #undef USE_FAST_PINIO -#elif defined (__AVR__) || defined(TEENSYDUINO) || defined(ESP8266) || defined (ESP32) || defined(__arm__) - #define USE_FAST_PINIO -#endif - -class Adafruit_ILI9341 : public Adafruit_GFX { - protected: - - public: - Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST = -1, int8_t _MISO = -1); - Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _RST = -1); - -#ifndef ESP32 - void begin(uint32_t freq = 0); -#else - void begin(uint32_t freq = 0, SPIClass &spi=SPI); -#endif - - void setScrollMargins(uint16_t top, uint16_t bottom); - - void setRotation(uint8_t r); - void invertDisplay(boolean i); - void scrollTo(uint16_t y); - - // Required Non-Transaction - void drawPixel(int16_t x, int16_t y, uint16_t color); - - // Transaction API - void startWrite(void); - void endWrite(void); - void writePixel(int16_t x, int16_t y, uint16_t color); - void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); - void writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); - void writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); - - // Transaction API not used by GFX - void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h); - void writePixel(uint16_t color); - void writePixels(uint16_t * colors, uint32_t len); - void writeColor(uint16_t color, uint32_t len); - void pushColor(uint16_t color); - - // Recommended Non-Transaction - void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); - void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); - void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color); - - using Adafruit_GFX::drawRGBBitmap; // Check base class first - void drawRGBBitmap(int16_t x, int16_t y, - uint16_t *pcolors, int16_t w, int16_t h); - - uint8_t readcommand8(uint8_t reg, uint8_t index = 0); - - uint16_t color565(uint8_t r, uint8_t g, uint8_t b); - - private: -#ifdef ESP32 - SPIClass _spi; -#endif - uint32_t _freq; -#if defined (__AVR__) || defined(TEENSYDUINO) - int8_t _cs, _dc, _rst, _sclk, _mosi, _miso; -#ifdef USE_FAST_PINIO - volatile uint8_t *mosiport, *misoport, *clkport, *dcport, *csport; - uint8_t mosipinmask, misopinmask, clkpinmask, cspinmask, dcpinmask; -#endif -#elif defined (__arm__) - int32_t _cs, _dc, _rst, _sclk, _mosi, _miso; -#ifdef USE_FAST_PINIO - volatile RwReg *mosiport, *misoport, *clkport, *dcport, *csport; - uint32_t mosipinmask, misopinmask, clkpinmask, cspinmask, dcpinmask; -#endif -#elif defined (ESP8266) || defined (ESP32) - int8_t _cs, _dc, _rst, _sclk, _mosi, _miso; -#ifdef USE_FAST_PINIO - volatile uint32_t *mosiport, *misoport, *clkport, *dcport, *csport; - uint32_t mosipinmask, misopinmask, clkpinmask, cspinmask, dcpinmask; -#endif -#else - int8_t _cs, _dc, _rst, _sclk, _mosi, _miso; -#endif - - void writeCommand(uint8_t cmd); - void spiWrite(uint8_t v); - uint8_t spiRead(void); -}; - -#endif diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/.github/ISSUE_TEMPLATE.md b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.github/ISSUE_TEMPLATE.md similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/.github/ISSUE_TEMPLATE.md rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.github/ISSUE_TEMPLATE.md diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/.github/PULL_REQUEST_TEMPLATE.md b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/.github/PULL_REQUEST_TEMPLATE.md rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.github/PULL_REQUEST_TEMPLATE.md diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.gitignore b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.gitignore new file mode 100644 index 000000000..c2a26c038 --- /dev/null +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.gitignore @@ -0,0 +1,4 @@ +# Our handy .gitignore for automation ease +Doxyfile* +doxygen_sqlite3.db +html diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.travis.yml b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.travis.yml new file mode 100644 index 000000000..3e5672cd6 --- /dev/null +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/.travis.yml @@ -0,0 +1,38 @@ +language: c +sudo: false + +cache: + directories: + - ~/arduino_ide + # Caches Arduino IDE + ESP32 platform + - ~/.arduino15/packages/ + # Caches Arduino platforms +git: + depth: false + quiet: true + +# Blacklist +branches: + except: + - gh-pages + +env: + global: + - PRETTYNAME="Adafruit ILI9341 Arduino Library" +# Optional, will default to "$TRAVIS_BUILD_DIR/Doxyfile" +# - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile + +before_install: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh) + +install: + - arduino --install-library "Adafruit GFX Library","Adafruit STMPE610","Adafruit TouchScreen" + +script: + - build_main_platforms + +# Generate and deploy documentation +after_success: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh) + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh) + diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/Adafruit_ILI9341.cpp b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/Adafruit_ILI9341.cpp new file mode 100644 index 000000000..442975ada --- /dev/null +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/Adafruit_ILI9341.cpp @@ -0,0 +1,282 @@ +/*! +* @file Adafruit_ILI9341.cpp +* +* @mainpage Adafruit ILI9341 TFT Displays +* +* @section intro_sec Introduction +* +* This is the documentation for Adafruit's ILI9341 driver for the +* Arduino platform. +* +* This library works with the Adafruit 2.8" Touch Shield V2 (SPI) +* http://www.adafruit.com/products/1651 +* +* Adafruit 2.4" TFT LCD with Touchscreen Breakout w/MicroSD Socket - ILI9341 +* https://www.adafruit.com/product/2478 +* +* 2.8" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 +* https://www.adafruit.com/product/1770 +* +* 2.2" 18-bit color TFT LCD display with microSD card breakout - ILI9340 +* https://www.adafruit.com/product/1770 +* +* TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers +* https://www.adafruit.com/product/3315 +* +* These displays use SPI to communicate, 4 or 5 pins are required +* to interface (RST is optional). +* +* Adafruit invests time and resources providing this open source code, +* please support Adafruit and open-source hardware by purchasing +* products from Adafruit! +* +* @section dependencies Dependencies +* +* This library depends on +* Adafruit_GFX being present on your system. Please make sure you have +* installed the latest version before using this library. +* +* @section author Author +* +* Written by Limor "ladyada" Fried for Adafruit Industries. +* +* @section license License +* +* BSD license, all text here must be included in any redistribution. +* +*/ + +#include "Adafruit_ILI9341.h" +#ifndef ARDUINO_STM32_FEATHER + #include "pins_arduino.h" + #ifndef RASPI + #include "wiring_private.h" + #endif +#endif +#include + +#if defined (ARDUINO_ARCH_ARC32) || defined (ARDUINO_MAXIM) + #define SPI_DEFAULT_FREQ 16000000 +#elif defined (__AVR__) || defined(TEENSYDUINO) + #define SPI_DEFAULT_FREQ 8000000 +#elif defined(ESP8266) || defined(ESP32) + #define SPI_DEFAULT_FREQ 40000000 +#elif defined(RASPI) + #define SPI_DEFAULT_FREQ 80000000 +#elif defined(ARDUINO_ARCH_STM32F1) + #define SPI_DEFAULT_FREQ 36000000 +#else + #define SPI_DEFAULT_FREQ 24000000 ///< Default SPI data clock frequency +#endif + +#define MADCTL_MY 0x80 ///< Bottom to top +#define MADCTL_MX 0x40 ///< Right to left +#define MADCTL_MV 0x20 ///< Reverse Mode +#define MADCTL_ML 0x10 ///< LCD refresh Bottom to top +#define MADCTL_RGB 0x00 ///< Red-Green-Blue pixel order +#define MADCTL_BGR 0x08 ///< Blue-Green-Red pixel order +#define MADCTL_MH 0x04 ///< LCD refresh right to left + +/**************************************************************************/ +/*! + @brief Instantiate Adafruit ILI9341 driver with software SPI + @param cs Chip select pin # + @param dc Data/Command pin # + @param mosi SPI MOSI pin # + @param sclk SPI Clock pin # + @param rst Reset pin # (optional, pass -1 if unused) + @param miso SPI MISO pin # (optional, pass -1 if unused) +*/ +/**************************************************************************/ +Adafruit_ILI9341::Adafruit_ILI9341(int8_t cs, int8_t dc, int8_t mosi, + int8_t sclk, int8_t rst, int8_t miso) : Adafruit_SPITFT(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT, cs, dc, mosi, sclk, rst, miso) { +} + +/**************************************************************************/ +/*! + @brief Instantiate Adafruit ILI9341 driver with hardware SPI + @param cs Chip select pin # + @param dc Data/Command pin # + @param rst Reset pin # (optional, pass -1 if unused) +*/ +/**************************************************************************/ +Adafruit_ILI9341::Adafruit_ILI9341(int8_t cs, int8_t dc, int8_t rst) : Adafruit_SPITFT(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT, cs, dc, rst) { +} + +static const uint8_t PROGMEM initcmd[] = { + 0xEF, 3, 0x03, 0x80, 0x02, + 0xCF, 3, 0x00, 0xC1, 0x30, + 0xED, 4, 0x64, 0x03, 0x12, 0x81, + 0xE8, 3, 0x85, 0x00, 0x78, + 0xCB, 5, 0x39, 0x2C, 0x00, 0x34, 0x02, + 0xF7, 1, 0x20, + 0xEA, 2, 0x00, 0x00, + ILI9341_PWCTR1 , 1, 0x23, // Power control VRH[5:0] + ILI9341_PWCTR2 , 1, 0x10, // Power control SAP[2:0];BT[3:0] + ILI9341_VMCTR1 , 2, 0x3e, 0x28, // VCM control + ILI9341_VMCTR2 , 1, 0x86, // VCM control2 + ILI9341_MADCTL , 1, 0x48, // Memory Access Control + ILI9341_VSCRSADD, 1, 0x00, // Vertical scroll zero + ILI9341_PIXFMT , 1, 0x55, + ILI9341_FRMCTR1 , 2, 0x00, 0x18, + ILI9341_DFUNCTR , 3, 0x08, 0x82, 0x27, // Display Function Control + 0xF2, 1, 0x00, // 3Gamma Function Disable + ILI9341_GAMMASET , 1, 0x01, // Gamma curve selected + ILI9341_GMCTRP1 , 15, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, // Set Gamma + 0x4E, 0xF1, 0x37, 0x07, 0x10, 0x03, 0x0E, 0x09, 0x00, + ILI9341_GMCTRN1 , 15, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, // Set Gamma + 0x31, 0xC1, 0x48, 0x08, 0x0F, 0x0C, 0x31, 0x36, 0x0F, + ILI9341_SLPOUT , 0x80, // Exit Sleep + ILI9341_DISPON , 0x80, // Display on + 0x00 // End of list +}; + +/**************************************************************************/ +/*! + @brief Initialize ILI9341 chip + Connects to the ILI9341 over SPI and sends initialization procedure commands + @param freq Desired SPI clock frequency +*/ +/**************************************************************************/ +void Adafruit_ILI9341::begin(uint32_t freq) { + if(!freq) freq = SPI_DEFAULT_FREQ; + _freq = freq; + + initSPI(freq); + + startWrite(); + + uint8_t cmd, x, numArgs; + const uint8_t *addr = initcmd; + while((cmd = pgm_read_byte(addr++)) > 0) { + writeCommand(cmd); + x = pgm_read_byte(addr++); + numArgs = x & 0x7F; + while(numArgs--) spiWrite(pgm_read_byte(addr++)); + if(x & 0x80) delay(120); + } + + endWrite(); + + _width = ILI9341_TFTWIDTH; + _height = ILI9341_TFTHEIGHT; +} + + +/**************************************************************************/ +/*! + @brief Set origin of (0,0) and orientation of TFT display + @param m The index for rotation, from 0-3 inclusive +*/ +/**************************************************************************/ +void Adafruit_ILI9341::setRotation(uint8_t m) { + rotation = m % 4; // can't be higher than 3 + switch (rotation) { + case 0: + m = (MADCTL_MX | MADCTL_BGR); + _width = ILI9341_TFTWIDTH; + _height = ILI9341_TFTHEIGHT; + break; + case 1: + m = (MADCTL_MV | MADCTL_BGR); + _width = ILI9341_TFTHEIGHT; + _height = ILI9341_TFTWIDTH; + break; + case 2: + m = (MADCTL_MY | MADCTL_BGR); + _width = ILI9341_TFTWIDTH; + _height = ILI9341_TFTHEIGHT; + break; + case 3: + m = (MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR); + _width = ILI9341_TFTHEIGHT; + _height = ILI9341_TFTWIDTH; + break; + } + + startWrite(); + writeCommand(ILI9341_MADCTL); + spiWrite(m); + endWrite(); +} + +/**************************************************************************/ +/*! + @brief Enable/Disable display color inversion + @param invert True to invert, False to have normal color +*/ +/**************************************************************************/ +void Adafruit_ILI9341::invertDisplay(boolean invert) { + startWrite(); + writeCommand(invert ? ILI9341_INVON : ILI9341_INVOFF); + endWrite(); +} + +/**************************************************************************/ +/*! + @brief Scroll display memory + @param y How many pixels to scroll display by +*/ +/**************************************************************************/ +void Adafruit_ILI9341::scrollTo(uint16_t y) { + startWrite(); + writeCommand(ILI9341_VSCRSADD); + SPI_WRITE16(y); + endWrite(); +} + +/**************************************************************************/ + +void Adafruit_ILI9341::setScrollMargins(uint16_t top, uint16_t bottom) +{ + uint16_t height = _height - (top + bottom); + + startWrite(); + writeCommand(0x33); + SPI_WRITE16(top); + SPI_WRITE16(height); + SPI_WRITE16(bottom); + endWrite(); +} + +/**************************************************************************/ +/*! + @brief Set the "address window" - the rectangle we will write to RAM with the next chunk of SPI data writes. The ILI9341 will automatically wrap the data as each row is filled + @param x TFT memory 'x' origin + @param y TFT memory 'y' origin + @param w Width of rectangle + @param h Height of rectangle +*/ +/**************************************************************************/ +void Adafruit_ILI9341::setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) { + uint32_t xa = ((uint32_t)x << 16) | (x+w-1); + uint32_t ya = ((uint32_t)y << 16) | (y+h-1); + writeCommand(ILI9341_CASET); // Column addr set + SPI_WRITE32(xa); + writeCommand(ILI9341_PASET); // Row addr set + SPI_WRITE32(ya); + writeCommand(ILI9341_RAMWR); // write to RAM +} + +/**************************************************************************/ +/*! + @brief Read 8 bits of data from ILI9341 configuration memory. NOT from RAM! + This is highly undocumented/supported, it's really a hack but kinda works? + @param command The command register to read data from + @param index The byte index into the command to read from + @return Unsigned 8-bit data read from ILI9341 register +*/ +/**************************************************************************/ +uint8_t Adafruit_ILI9341::readcommand8(uint8_t command, uint8_t index) { + uint32_t freq = _freq; + if(_freq > 24000000) _freq = 24000000; + startWrite(); + writeCommand(0xD9); // woo sekret command? + spiWrite(0x10 + index); + writeCommand(command); + uint8_t r = spiRead(); + endWrite(); + _freq = freq; + return r; +} + diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/Adafruit_ILI9341.h b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/Adafruit_ILI9341.h new file mode 100644 index 000000000..368e1cc0f --- /dev/null +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/Adafruit_ILI9341.h @@ -0,0 +1,144 @@ +/*! +* @file Adafruit_ILI9341.h +* +* This is the documentation for Adafruit's ILI9341 driver for the +* Arduino platform. +* +* This library works with the Adafruit 2.8" Touch Shield V2 (SPI) +* http://www.adafruit.com/products/1651 +* Adafruit 2.4" TFT LCD with Touchscreen Breakout w/MicroSD Socket - ILI9341 +* https://www.adafruit.com/product/2478 +* 2.8" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 +* https://www.adafruit.com/product/1770 +* 2.2" 18-bit color TFT LCD display with microSD card breakout - ILI9340 +* https://www.adafruit.com/product/1770 +* TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers +* https://www.adafruit.com/product/3315 +* +* These displays use SPI to communicate, 4 or 5 pins are required +* to interface (RST is optional). +* +* Adafruit invests time and resources providing this open source code, +* please support Adafruit and open-source hardware by purchasing +* products from Adafruit! +* +* +* This library depends on +* Adafruit_GFX being present on your system. Please make sure you have +* installed the latest version before using this library. +* +* Written by Limor "ladyada" Fried for Adafruit Industries. +* +* BSD license, all text here must be included in any redistribution. +* +*/ + +#ifndef _ADAFRUIT_ILI9341H_ +#define _ADAFRUIT_ILI9341H_ + +#include "Arduino.h" +#include "Print.h" +#include +#include "Adafruit_GFX.h" +#include +#include + +#define ILI9341_TFTWIDTH 240 ///< ILI9341 max TFT width +#define ILI9341_TFTHEIGHT 320 ///< ILI9341 max TFT height + +#define ILI9341_NOP 0x00 ///< No-op register +#define ILI9341_SWRESET 0x01 ///< Software reset register +#define ILI9341_RDDID 0x04 ///< Read display identification information +#define ILI9341_RDDST 0x09 ///< Read Display Status + +#define ILI9341_SLPIN 0x10 ///< Enter Sleep Mode +#define ILI9341_SLPOUT 0x11 ///< Sleep Out +#define ILI9341_PTLON 0x12 ///< Partial Mode ON +#define ILI9341_NORON 0x13 ///< Normal Display Mode ON + +#define ILI9341_RDMODE 0x0A ///< Read Display Power Mode +#define ILI9341_RDMADCTL 0x0B ///< Read Display MADCTL +#define ILI9341_RDPIXFMT 0x0C ///< Read Display Pixel Format +#define ILI9341_RDIMGFMT 0x0D ///< Read Display Image Format +#define ILI9341_RDSELFDIAG 0x0F ///< Read Display Self-Diagnostic Result + +#define ILI9341_INVOFF 0x20 ///< Display Inversion OFF +#define ILI9341_INVON 0x21 ///< Display Inversion ON +#define ILI9341_GAMMASET 0x26 ///< Gamma Set +#define ILI9341_DISPOFF 0x28 ///< Display OFF +#define ILI9341_DISPON 0x29 ///< Display ON + +#define ILI9341_CASET 0x2A ///< Column Address Set +#define ILI9341_PASET 0x2B ///< Page Address Set +#define ILI9341_RAMWR 0x2C ///< Memory Write +#define ILI9341_RAMRD 0x2E ///< Memory Read + +#define ILI9341_PTLAR 0x30 ///< Partial Area +#define ILI9341_MADCTL 0x36 ///< Memory Access Control +#define ILI9341_VSCRSADD 0x37 ///< Vertical Scrolling Start Address +#define ILI9341_PIXFMT 0x3A ///< COLMOD: Pixel Format Set + +#define ILI9341_FRMCTR1 0xB1 ///< Frame Rate Control (In Normal Mode/Full Colors) +#define ILI9341_FRMCTR2 0xB2 ///< Frame Rate Control (In Idle Mode/8 colors) +#define ILI9341_FRMCTR3 0xB3 ///< Frame Rate control (In Partial Mode/Full Colors) +#define ILI9341_INVCTR 0xB4 ///< Display Inversion Control +#define ILI9341_DFUNCTR 0xB6 ///< Display Function Control + +#define ILI9341_PWCTR1 0xC0 ///< Power Control 1 +#define ILI9341_PWCTR2 0xC1 ///< Power Control 2 +#define ILI9341_PWCTR3 0xC2 ///< Power Control 3 +#define ILI9341_PWCTR4 0xC3 ///< Power Control 4 +#define ILI9341_PWCTR5 0xC4 ///< Power Control 5 +#define ILI9341_VMCTR1 0xC5 ///< VCOM Control 1 +#define ILI9341_VMCTR2 0xC7 ///< VCOM Control 2 + +#define ILI9341_RDID1 0xDA ///< Read ID 1 +#define ILI9341_RDID2 0xDB ///< Read ID 2 +#define ILI9341_RDID3 0xDC ///< Read ID 3 +#define ILI9341_RDID4 0xDD ///< Read ID 4 + +#define ILI9341_GMCTRP1 0xE0 ///< Positive Gamma Correction +#define ILI9341_GMCTRN1 0xE1 ///< Negative Gamma Correction +//#define ILI9341_PWCTR6 0xFC + +// Color definitions +#define ILI9341_BLACK 0x0000 ///< 0, 0, 0 +#define ILI9341_NAVY 0x000F ///< 0, 0, 123 +#define ILI9341_DARKGREEN 0x03E0 ///< 0, 125, 0 +#define ILI9341_DARKCYAN 0x03EF ///< 0, 125, 123 +#define ILI9341_MAROON 0x7800 ///< 123, 0, 0 +#define ILI9341_PURPLE 0x780F ///< 123, 0, 123 +#define ILI9341_OLIVE 0x7BE0 ///< 123, 125, 0 +#define ILI9341_LIGHTGREY 0xC618 ///< 198, 195, 198 +#define ILI9341_DARKGREY 0x7BEF ///< 123, 125, 123 +#define ILI9341_BLUE 0x001F ///< 0, 0, 255 +#define ILI9341_GREEN 0x07E0 ///< 0, 255, 0 +#define ILI9341_CYAN 0x07FF ///< 0, 255, 255 +#define ILI9341_RED 0xF800 ///< 255, 0, 0 +#define ILI9341_MAGENTA 0xF81F ///< 255, 0, 255 +#define ILI9341_YELLOW 0xFFE0 ///< 255, 255, 0 +#define ILI9341_WHITE 0xFFFF ///< 255, 255, 255 +#define ILI9341_ORANGE 0xFD20 ///< 255, 165, 0 +#define ILI9341_GREENYELLOW 0xAFE5 ///< 173, 255, 41 +#define ILI9341_PINK 0xFC18 ///< 255, 130, 198 + +///< Class to manage hardware interface with ILI9341 chipset (also seems to work with ILI9340) +class Adafruit_ILI9341 : public Adafruit_SPITFT { + public: + Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK, int8_t _RST = -1, int8_t _MISO = -1); + Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _RST = -1); + + void begin(uint32_t freq=0); + void setRotation(uint8_t r); + void invertDisplay(boolean i); + void scrollTo(uint16_t y); + + void setScrollMargins(uint16_t top, uint16_t bottom); + + // Transaction API not used by GFX + void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h); + + uint8_t readcommand8(uint8_t reg, uint8_t index=0); +}; + +#endif // _ADAFRUIT_ILI9341H_ diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/README.txt b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/README.md similarity index 60% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/README.txt rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/README.md index 7c5905014..b08f63086 100644 --- a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/README.txt +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/README.md @@ -1,8 +1,22 @@ +# Adafruit ILI9341 Arduino Library [![Build Status](https://travis-ci.org/adafruit/Adafruit_ILI9341.svg?branch=master)](https://travis-ci.org/adafruit/Adafruit_ILI9341) + This is a library for the Adafruit ILI9341 display products This library works with the Adafruit 2.8" Touch Shield V2 (SPI) - ----> http://www.adafruit.com/products/1651 - + * http://www.adafruit.com/products/1651 + +Adafruit 2.4" TFT LCD with Touchscreen Breakout w/MicroSD Socket - ILI9341 + * https://www.adafruit.com/product/2478 + +2.8" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 + * https://www.adafruit.com/product/1770 + +2.2" 18-bit color TFT LCD display with microSD card breakout - ILI9340 + * https://www.adafruit.com/product/1480 + +TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers + * https://www.adafruit.com/product/3315 + Check out the links above for our tutorials and wiring diagrams. These displays use SPI to communicate, 4 or 5 pins are required to interface (RST is optional). diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/breakouttouchpaint/.esp8266.test.skip b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/breakouttouchpaint/.esp8266.test.skip new file mode 100644 index 000000000..e69de29bb diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/breakouttouchpaint/breakouttouchpaint.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/breakouttouchpaint/breakouttouchpaint.ino similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/breakouttouchpaint/breakouttouchpaint.ino rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/breakouttouchpaint/breakouttouchpaint.ino diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/fulltest_featherwing/.mega2560.test.skip b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/fulltest_featherwing/.mega2560.test.skip new file mode 100644 index 000000000..e69de29bb diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/fulltest_featherwing/fulltest_featherwing.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/fulltest_featherwing/fulltest_featherwing.ino similarity index 93% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/fulltest_featherwing/fulltest_featherwing.ino rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/fulltest_featherwing/fulltest_featherwing.ino index 05432eaae..25f32f2e6 100644 --- a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/fulltest_featherwing/fulltest_featherwing.ino +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/fulltest_featherwing/fulltest_featherwing.ino @@ -32,12 +32,6 @@ #define TFT_DC 33 #define SD_CS 14 #endif -#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) - #define STMPE_CS 6 - #define TFT_CS 9 - #define TFT_DC 10 - #define SD_CS 5 -#endif #ifdef TEENSYDUINO #define TFT_DC 10 #define TFT_CS 4 @@ -56,6 +50,20 @@ #define STMPE_CS 30 #define SD_CS 27 #endif +#if defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR) + #define TFT_DC P5_4 + #define TFT_CS P5_3 + #define STMPE_CS P3_3 + #define SD_CS P3_2 +#endif + +// Anything else! +#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__) || defined(__SAM3X8E__) + #define STMPE_CS 6 + #define TFT_CS 9 + #define TFT_DC 10 + #define SD_CS 5 +#endif Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS); @@ -102,7 +110,6 @@ void loop() { Serial.print("\tY = "); Serial.print(p.y); Serial.print("\tPressure = "); Serial.println(p.z); - // Scale from ~0->4000 to tft.width using the calibration #'s p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width()); p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height()); @@ -122,7 +129,7 @@ void loop() { #define BUFFPIXEL 20 -void bmpDraw(char *filename, uint8_t x, uint16_t y) { +void bmpDraw(char *filename, int16_t x, int16_t y) { File bmpFile; int bmpWidth, bmpHeight; // W+H in pixels @@ -188,7 +195,8 @@ void bmpDraw(char *filename, uint8_t x, uint16_t y) { if((y+h-1) >= tft.height()) h = tft.height() - y; // Set TFT address window to clipped image bounds - tft.setAddrWindow(x, y, x+w-1, y+h-1); + tft.startWrite(); + tft.setAddrWindow(x, y, w, h); for (row=0; row= sizeof(sdbuffer)) { // Indeed + tft.endWrite(); bmpFile.read(sdbuffer, sizeof(sdbuffer)); + tft.startWrite(); buffidx = 0; // Set index to beginning } @@ -220,6 +231,7 @@ void bmpDraw(char *filename, uint8_t x, uint16_t y) { r = sdbuffer[buffidx++]; tft.pushColor(tft.color565(r,g,b)); } // end pixel + tft.endWrite(); } // end scanline Serial.print(F("Loaded in ")); Serial.print(millis() - startTime); diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest/graphicstest.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest/graphicstest.ino new file mode 100644 index 000000000..3154d4095 --- /dev/null +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest/graphicstest.ino @@ -0,0 +1,365 @@ +/*************************************************** + This is our GFX example for the Adafruit ILI9341 Breakout and Shield + ----> http://www.adafruit.com/products/1651 + + Check out the links above for our tutorials and wiring diagrams + These displays use SPI to communicate, 4 or 5 pins are required to + interface (RST is optional) + Adafruit invests time and resources providing this open source code, + please support Adafruit and open-source hardware by purchasing + products from Adafruit! + + Written by Limor Fried/Ladyada for Adafruit Industries. + MIT license, all text above must be included in any redistribution + ****************************************************/ + + +#include "SPI.h" +#include "Adafruit_GFX.h" +#include "Adafruit_ILI9341.h" + +// For the Adafruit shield, these are the default. +#define TFT_DC 9 +#define TFT_CS 10 + +// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC +Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); +// If using the breakout, change pins as desired +//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO); + +void setup() { + Serial.begin(9600); + Serial.println("ILI9341 Test!"); + + tft.begin(); + + // read diagnostics (optional but can help debug problems) + uint8_t x = tft.readcommand8(ILI9341_RDMODE); + Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX); + x = tft.readcommand8(ILI9341_RDMADCTL); + Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX); + x = tft.readcommand8(ILI9341_RDPIXFMT); + Serial.print("Pixel Format: 0x"); Serial.println(x, HEX); + x = tft.readcommand8(ILI9341_RDIMGFMT); + Serial.print("Image Format: 0x"); Serial.println(x, HEX); + x = tft.readcommand8(ILI9341_RDSELFDIAG); + Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); + + Serial.println(F("Benchmark Time (microseconds)")); + delay(10); + Serial.print(F("Screen fill ")); + Serial.println(testFillScreen()); + delay(500); + + Serial.print(F("Text ")); + Serial.println(testText()); + delay(3000); + + Serial.print(F("Lines ")); + Serial.println(testLines(ILI9341_CYAN)); + delay(500); + + Serial.print(F("Horiz/Vert Lines ")); + Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE)); + delay(500); + + Serial.print(F("Rectangles (outline) ")); + Serial.println(testRects(ILI9341_GREEN)); + delay(500); + + Serial.print(F("Rectangles (filled) ")); + Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA)); + delay(500); + + Serial.print(F("Circles (filled) ")); + Serial.println(testFilledCircles(10, ILI9341_MAGENTA)); + + Serial.print(F("Circles (outline) ")); + Serial.println(testCircles(10, ILI9341_WHITE)); + delay(500); + + Serial.print(F("Triangles (outline) ")); + Serial.println(testTriangles()); + delay(500); + + Serial.print(F("Triangles (filled) ")); + Serial.println(testFilledTriangles()); + delay(500); + + Serial.print(F("Rounded rects (outline) ")); + Serial.println(testRoundRects()); + delay(500); + + Serial.print(F("Rounded rects (filled) ")); + Serial.println(testFilledRoundRects()); + delay(500); + + Serial.println(F("Done!")); + +} + + +void loop(void) { + for(uint8_t rotation=0; rotation<4; rotation++) { + tft.setRotation(rotation); + testText(); + delay(1000); + } +} + +unsigned long testFillScreen() { + unsigned long start = micros(); + tft.fillScreen(ILI9341_BLACK); + yield(); + tft.fillScreen(ILI9341_RED); + yield(); + tft.fillScreen(ILI9341_GREEN); + yield(); + tft.fillScreen(ILI9341_BLUE); + yield(); + tft.fillScreen(ILI9341_BLACK); + yield(); + return micros() - start; +} + +unsigned long testText() { + tft.fillScreen(ILI9341_BLACK); + unsigned long start = micros(); + tft.setCursor(0, 0); + tft.setTextColor(ILI9341_WHITE); tft.setTextSize(1); + tft.println("Hello World!"); + tft.setTextColor(ILI9341_YELLOW); tft.setTextSize(2); + tft.println(1234.56); + tft.setTextColor(ILI9341_RED); tft.setTextSize(3); + tft.println(0xDEADBEEF, HEX); + tft.println(); + tft.setTextColor(ILI9341_GREEN); + tft.setTextSize(5); + tft.println("Groop"); + tft.setTextSize(2); + tft.println("I implore thee,"); + tft.setTextSize(1); + tft.println("my foonting turlingdromes."); + tft.println("And hooptiously drangle me"); + tft.println("with crinkly bindlewurdles,"); + tft.println("Or I will rend thee"); + tft.println("in the gobberwarts"); + tft.println("with my blurglecruncheon,"); + tft.println("see if I don't!"); + return micros() - start; +} + +unsigned long testLines(uint16_t color) { + unsigned long start, t; + int x1, y1, x2, y2, + w = tft.width(), + h = tft.height(); + + tft.fillScreen(ILI9341_BLACK); + yield(); + + x1 = y1 = 0; + y2 = h - 1; + start = micros(); + for(x2=0; x20; i-=6) { + i2 = i / 2; + start = micros(); + tft.fillRect(cx-i2, cy-i2, i, i, color1); + t += micros() - start; + // Outlines are not included in timing results + tft.drawRect(cx-i2, cy-i2, i, i, color2); + yield(); + } + + return t; +} + +unsigned long testFilledCircles(uint8_t radius, uint16_t color) { + unsigned long start; + int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2; + + tft.fillScreen(ILI9341_BLACK); + start = micros(); + for(x=radius; x10; i-=5) { + start = micros(); + tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, + tft.color565(0, i*10, i*10)); + t += micros() - start; + tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i, + tft.color565(i*10, i*10, 0)); + yield(); + } + + return t; +} + +unsigned long testRoundRects() { + unsigned long start; + int w, i, i2, + cx = tft.width() / 2 - 1, + cy = tft.height() / 2 - 1; + + tft.fillScreen(ILI9341_BLACK); + w = min(tft.width(), tft.height()); + start = micros(); + for(i=0; i20; i-=6) { + i2 = i / 2; + tft.fillRoundRect(cx-i2, cy-i2, i, i, i/8, tft.color565(0, i, 0)); + yield(); + } + + return micros() - start; +} \ No newline at end of file diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest_featherwing/.mega2560.test.skip b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest_featherwing/.mega2560.test.skip new file mode 100644 index 000000000..e69de29bb diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/graphicstest_featherwing/graphicstest_featherwing.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest_featherwing/graphicstest_featherwing.ino similarity index 97% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/graphicstest_featherwing/graphicstest_featherwing.ino rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest_featherwing/graphicstest_featherwing.ino index f58f20877..2a108d29c 100644 --- a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/graphicstest_featherwing/graphicstest_featherwing.ino +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/graphicstest_featherwing/graphicstest_featherwing.ino @@ -28,12 +28,6 @@ #define TFT_DC 33 #define SD_CS 14 #endif -#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) - #define STMPE_CS 6 - #define TFT_CS 9 - #define TFT_DC 10 - #define SD_CS 5 -#endif #ifdef TEENSYDUINO #define TFT_DC 10 #define TFT_CS 4 @@ -52,6 +46,21 @@ #define STMPE_CS 30 #define SD_CS 27 #endif +#if defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR) + #define TFT_DC P5_4 + #define TFT_CS P5_3 + #define STMPE_CS P3_3 + #define SD_CS P3_2 +#endif + +// Anything else! +#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__) || defined(__SAM3X8E__) + #define STMPE_CS 6 + #define TFT_CS 9 + #define TFT_DC 10 + #define SD_CS 5 +#endif + Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/onoffbutton/onoffbutton.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/onoffbutton/onoffbutton.ino similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/onoffbutton/onoffbutton.ino rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/onoffbutton/onoffbutton.ino diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/onoffbutton_breakout/.esp8266.test.skip b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/onoffbutton_breakout/.esp8266.test.skip new file mode 100644 index 000000000..e69de29bb diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/onoffbutton_breakout/onoffbutton_breakout.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/onoffbutton_breakout/onoffbutton_breakout.ino similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/onoffbutton_breakout/onoffbutton_breakout.ino rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/onoffbutton_breakout/onoffbutton_breakout.ino diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/pictureEmbed/dragon.h b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/pictureEmbed/dragon.h similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/pictureEmbed/dragon.h rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/pictureEmbed/dragon.h diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/pictureEmbed/pictureEmbed.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/pictureEmbed/pictureEmbed.ino similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/pictureEmbed/pictureEmbed.ino rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/pictureEmbed/pictureEmbed.ino diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/spitftbitmap/spitftbitmap.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/spitftbitmap/spitftbitmap.ino similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/spitftbitmap/spitftbitmap.ino rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/spitftbitmap/spitftbitmap.ino diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/touchpaint/touchpaint.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/touchpaint/touchpaint.ino similarity index 100% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/touchpaint/touchpaint.ino rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/touchpaint/touchpaint.ino diff --git a/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/touchpaint_featherwing/.mega2560.test.skip b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/touchpaint_featherwing/.mega2560.test.skip new file mode 100644 index 000000000..e69de29bb diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/touchpaint_featherwing/touchpaint_featherwing.ino b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/touchpaint_featherwing/touchpaint_featherwing.ino similarity index 94% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/touchpaint_featherwing/touchpaint_featherwing.ino rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/touchpaint_featherwing/touchpaint_featherwing.ino index 6e41dc486..5d317abcd 100644 --- a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/examples/touchpaint_featherwing/touchpaint_featherwing.ino +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/examples/touchpaint_featherwing/touchpaint_featherwing.ino @@ -31,12 +31,6 @@ #define TFT_DC 33 #define SD_CS 14 #endif -#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) - #define STMPE_CS 6 - #define TFT_CS 9 - #define TFT_DC 10 - #define SD_CS 5 -#endif #ifdef TEENSYDUINO #define TFT_DC 10 #define TFT_CS 4 @@ -55,6 +49,21 @@ #define STMPE_CS 30 #define SD_CS 27 #endif +#if defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR) + #define TFT_DC P5_4 + #define TFT_CS P5_3 + #define STMPE_CS P3_3 + #define SD_CS P3_2 +#endif + +// Anything else! +#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__) || defined(__SAM3X8E__) + #define STMPE_CS 6 + #define TFT_CS 9 + #define TFT_DC 10 + #define SD_CS 5 +#endif + Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS); diff --git a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/library.properties b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/library.properties similarity index 94% rename from lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/library.properties rename to lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/library.properties index 3ede82b5f..8c93d49ee 100644 --- a/lib/Adafruit_ILI9341-1.0.11-Tasmota-1.0/library.properties +++ b/lib/Adafruit_ILI9341-1.2.0-Tasmota-1.0/library.properties @@ -1,5 +1,5 @@ name=Adafruit ILI9341 -version=1.0.11 +version=1.2.0 author=Adafruit maintainer=Adafruit sentence=Library for Adafruit ILI9341 displays