Git Product home page Git Product logo

adafruit_ili9341's Introduction

Adafruit ILI9341 Arduino Library Build StatusDocumentation

This is a library for the Adafruit ILI9341 display products

This library works with the Adafruit 2.8" Touch Shield V2 (SPI)

Adafruit 2.4" TFT LCD with Touchscreen Breakout w/MicroSD Socket - ILI9341

2.8" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341

2.2" 18-bit color TFT LCD display with microSD card breakout - ILI9340

TFT FeatherWing - 2.4" 320x240 Touchscreen For All Feathers

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).

BMP image-loading examples have been moved to the Adafruit_ImageReader library: https://github.com/adafruit/Adafruit_ImageReader

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

To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_ILI9341. Check that the Adafruit_ILI9341 folder contains Adafruit_ILI9341.cpp and Adafruit_ILI9341.

Place the Adafruit_ILI9341 library folder your arduinosketchfolder/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE

Also requires the Adafruit_GFX library for Arduino.

adafruit_ili9341's People

Contributors

aagan avatar alkhimey avatar ardnew avatar bitbank2 avatar blitzcitydiy avatar dlech avatar driverblock avatar evaherrada avatar gregjohnstewart avatar hathach avatar hoffmannjan avatar kurte avatar ladyada avatar makermelissa avatar marcmerlin avatar me-no-dev avatar microbuilder avatar paintyourdragon avatar paulstoffregen avatar siddacious avatar tdicola avatar tyeth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_ili9341's Issues

rst logic broken for arm

For arm rst pin is declared unsigned, so " if (_rst <0) ... " stuff is broken. Probably need to use unsigned for avr too, and preset/test with 255

Could add additional conditionals for Arduino ZERO vs DUE

Latest update (1.3.1) causes artifacts on display

Hi,

with the latest update 1.3.1 the display will get artifacts (text are not readable anymore and don't update) after around 10/15 minutes of run time. After downgrading back to 1.2.0 everything is fine again. Could you please fix that?
My setup:
ESP32 + 2.4 Touchscreen (ILI9341, XPT2046)

Fail to run the example 'graphicstest_featherwing'

'TFT_CS' was not declared in this scope
I got the above statement when trying to compile graphicstest_featherwing.ino
I reviewed the code and found that TFT_CS is already declared
There's something that I missed?
I'm using Arduino 1.6.12 in Windows 7

Please add SPI DMA

Hello,

Can you please add in SPI DMA capabilities to your library.

Thanks,

Missing: setScrollMargins(uint16_t top, uint16_t bottom);

This function is missing from the library. Its needed to allow hardware scrolling, its available in many other library's.


for .h file
void setScrollMargins(uint16_t top, uint16_t bottom);

for .cpp file
// *****************************************************************************
// Added by TRL 29 Feb 2018 <------

void Adafruit_ILI9341::setScrollMargins(uint16_t top, uint16_t bottom) {
// TFA+VSA+BFA must equal 320
startWrite();
writeCommand(0x33); // Vertical Scroll definition.
SPI_WRITE16(top);
SPI_WRITE16(ILI9341_TFTHEIGHT-(top+bottom));
SPI_WRITE16(bottom);
endWrite();
}

// *****************************************************************************


Query related to speed

Hi

This post is more of a query and not an "issue". :)

I am driving a 240x320 display with the ILI9341 using a NodeMCU ESP8266. I am trying to display a full screen BMP and measure the time taken.

  • ESP8266 running at 160Mhz
  • SPI freq at 40000000
  • I was using the the library version 1.0.2. But then I saw a commit with the following change :
#if defined (__AVR__) || defined(TEENSYDUINO) || defined (__arm__) || **defined (ESP8266)**
#define USE_FAST_PINIO
#endif

So, I moved to that version.

I had to tweak a lot of code here and there to get it to work.

  1. Made a small binary to make a HEX dump of the BMP.
  2. Made an array in PROGMEM using the hex dump.
  3. Modified a drawBMP sample code I found to use the array instead of reading from SD card.

The time taken to draw the image is around 534ms. Now my question is :

Is it possible to draw any faster ? I did see many "optimized" version online, but could not find one that worked for the ESP8266.

Main Class Not Found

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: Wemos D1 Mini

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.9

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Try to open GUI Builder. Will show the message:

Error: Could not find or load main class com.baeldung.fatjar.Application
Caused by: java.lang.ClassNotFoundException: com.baeldung.fatjar.Application

ESP8266 support

Hello, is the Adafruit ILI9341 lib already compatible to ESP8266?

Example code will not compile with latest changes to Adafruit-GFX-Library

  • Arduino board: Adafruit PyPortal M4 (SAMD51)
  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.9
  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Simply follow the Arduino setup guide for PyPortal and try compiling the self-test sketch

see the most recent commit to the Adafruit-GFX-Library: 1b03380

the tftBusWidth enum value tft8 was changed to tft8bitbus because class Adafruit_SPITFT had a protected anon union containing a named member struct with the same name.

to fix this, it probably would have been safer changing the union member's name instead of the enum, since the union is protected and the enum was visible externally. but as-is, the examples for this library need to update their tft8 references to tft8bitbus. otherwise, currently, none of the following examples will compile:
graphicstest_pyportal
pyportal_boing
touchpaint_pyportal
mandelbrot

also the example in Adafruit_ImageReader_Library:
PyPortal

Examples will brick Arduino Zero & Fail to Program

I have tested with a 2.8" ILI9341 LCD from EBay and hook them up to an Arduino Zero. Upon trying to upload the example sketches onto an Arduino Zero (native USB port), it will brick the USB native port. Even if the on-board EDBG is used to reprogram the bootloader, the native USB will no longer be detected by the PC (Windows 10 & Ubuntu 14.04). Before trying out on Arduino Zero, we tested them on our custom board based on Arduino Zero schematic on the native serial port. Thinking that it could be our design flaws, we tried on an original Arduino Zero and it ended as described as above.

If we try to upload the code using the programming port of the Arduino Zero instead, we'll get the following error:

** Programming Started ** auto erase enabled Info : SAMD MCU: SAMD21G18A (256KB Flash, 32KB RAM) Warn : Adding extra erase range, 00000000 to 0x00001fff wrote 40960 bytes from file /tmp/buildae05253274b53299ed1c1cf6c0dc729a.tmp/graphicstest.ino.bin in 5.396849s (7.412 KiB/s) ** Programming Finished ** ** Verify Started ** Warn : target was in unknown state when halt was requested Error: error executing cortex_m crc algorithm Runtime Error: embedded:startup.tcl:454: ** Verify Failed ** in procedure 'program' in procedure 'program_error' called at file "embedded:startup.tcl", line 498 at file "embedded:startup.tcl", line 454 the selected serial port at file "embedded:startup.tcl", line 454 does not exist or your board is not connected

Have you guys tested this on an Arduino Zero? It's best to provide some warning because it will brick many Arduino Zero (at least the native USB port will render useless after that) out there.

Error compliling :'TFT_CS' was not declared in this scope

this is the error i got after uploading the graphictest featherwing

graphicstest_featherwing:50: error: 'TFT_CS' was not declared in this scope

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

                                     ^

graphicstest_featherwing:50: error: 'TFT_DC' was not declared in this scope

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

Error while compiling example code

In file included from /home/username/Arduino/libraries/Adafruit_ILI9341/examples/graphicstest/graphicstest.ino:19:0:
/home/username/Arduino/libraries/Adafruit_ILI9341/Adafruit_ILI9341.h:140:38: error: expected ')' before 'busWidth'
Adafruit_ILI9341(tftBusWidth busWidth, int8_t d0, int8_t wr, int8_t dc,
^

How to set resolution?

I have a no-name 320x240 ILI9341 display, the example code works great but only uses 240x240, how do I set the width?

Issue with running the example 'graphicstest'

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "Arduino Uno"
graphicstest.ino: In function 'long unsigned int testFillScreen()':
graphicstest:113: error: 'yield' was not declared in this scope
graphicstest.ino: In function 'long unsigned int testLines(uint16_t)':
graphicstest:159: error: 'yield' was not declared in this scope
graphicstest.ino: In function 'long unsigned int testFilledRects(uint16_t, uint16_t)':
graphicstest:255: error: 'yield' was not declared in this scope
graphicstest.ino: In function 'long unsigned int testFilledTriangles()':
graphicstest:327: error: 'yield' was not declared in this scope
graphicstest.ino: In function 'long unsigned int testFilledRoundRects()':
graphicstest:361: error: 'yield' was not declared in this scope

Unable to compile examples for NodeMCU 0.9 board

I downloaded the latest version (1.0.1) of Adafruit ILI9341 library and set my board to NodeMCU 0.9 (ESP-12 Module). I'm using Arduino IDE 1.6.12.

I wanted to upload the graphicstest example to my NodeMCU device but during compile I'm getting lots of error messages:

Adafruit_ILI9341.cpp:30:3: error: '_cs' was not declared in this scope
Adafruit_ILI9341.cpp:31:3: error: '_dc' was not declared in this scope
Adafruit_ILI9341.cpp:32:3: error: '_mosi' was not declared in this scope
...

If I set the board to Arduino UNO the examples are compilling just fine.
What do you think?

driver slow on (at least) ESP32 due to SPIClass::transfer()

This driver works on ESP32 in software SPI and also hardware SPI mode, but is very slow.

This drivers method "spiwrite" calls SPI.transfer(uint8_t) witch is declared within the SPI driver.
SPIClass::transfer() writes this byte to the SPI bus and reads it afterwards for returning.
Since the returned result of re-reading the previously written byte is not used, it can be optimized away and speeds up things a lot.

Also the SPI driver of (at least) the ESP32 does also support sending 16 or 32 bit at once, there should be more optimizing possible.

ILI9341V compatibility

Hi,
I plan to use 2.4" display with ILI9341V controller. But I cannot find any information if ILI9341V is back-compatible with ILI9341. Only information I can find is that V is improved version of ILI9341.
ILI9341V that I plan to use can be configured to use different interfaces.
Confusing thing is that datasheet mentions two types of 4-wire interface:

  • 4-wire 8-bit data serial interface Ⅰ (SCL,SDA,D/CX,CSX)
  • 4-wire 8-bit data serial interface Ⅱ (SCL,SDI,D/CX,SDO, CSX )

Will it be possible to use ILI9341V with this library and what interface to configure in order to be compatible with this library?

compatibility with other spi devices

hello, thanks for this great library, i'm trying to use a microsd card con the same spi port of the display, just with a different cs pin to select the sd but if i initialize the sdcard with SPI.begin(sd_cs) the display doesn't work. is there a way to fix it? i use esp32. is the library compatible with other libraries?

thank you

git TOT library does not work with teensy 3.6

I have graphicstest working fine on ESP32.
I also have teensy 3.6 working fine with the same TFT using ILI9341_t3, but I'd rather not use it as it's a different and somewhat incompatible API.

I did init with
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
which uses software SPI and works fine on ESP32. With teensy 3.6 (arduino 1.8.8 + teensyduino-1.45), I get:

/home/merlin/Arduino/libraries/Adafruit_ILI9341/Adafruit_ILI9341.h:140:38: error: expected ')' before 'busWidth'
         Adafruit_ILI9341(tftBusWidth busWidth, int8_t d0, int8_t wr, int8_t dc,
                                      ^
Multiple libraries were found for "Adafruit_ILI9341.h"
 Used: /home/merlin/Arduino/libraries/Adafruit_ILI9341
 Not used: /var/local/arduino-1.8.8-teensyduino-1.45/hardware/teensy/avr/libraries/Adafruit_ILI9341

If I comment out this constructor line I'm not using in your library, I get:

/home/merlin/Arduino/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp: In constructor 'Adafruit_ILI9341::Adafruit_ILI9341(SPIClass*, int8_t, int8_t, int8_t)':
/home/merlin/Arduino/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp:122:77: error: invalid conversion from 'SPIClass*' to 'int8_t {aka signed char}' [-fpermissive]
   Adafruit_SPITFT(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT, spiClass, cs, dc, rst) {
                                                                             ^
In file included from /home/merlin/Arduino/libraries/Adafruit_ILI9341/Adafruit_ILI9341.h:43:0,
                 from /home/merlin/Arduino/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp:49:
/var/local/arduino-1.8.8-teensyduino-1.45/hardware/teensy/avr/libraries/Adafruit_GFX/Adafruit_SPITFT.h:27:9: note:   initializing argument 3 of 'Adafruit_SPITFT::Adafruit_SPITFT(uint16_t, uint16_t, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)'
         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);
         ^
/home/merlin/Arduino/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp: At global scope:
/home/merlin/Arduino/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp:141:35: error: expected constructor, destructor, or type conversion before '(' token
 Adafruit_ILI9341::Adafruit_ILI9341(tftBusWidth busWidth,

If I switch to the ILI9341 library shipped with in teensyduino, things work
( /var/local/arduino-1.8.8-teensyduino-1.45/hardware/teensy/avr/libraries/Adafruit_ILI9341 )
Looks like your recent changes made it incompatible with teensy?

The teensy version works, but it's too old, and doesn't work with my code because it doesn't use/inherit from your new SPITFT lib.

/home/merlin/Arduino/libraries/FastLED_SPITFT_GFX/FastLED_SPITFT_GFX.h:29:5: note:   no known conversion for argument 6 from 'Adafruit_ILI9341*' to 'Adafruit_SPITFT*'

Move SPI macros to header file to make them reusable?

I like the abtraction layers for hardware/software SPI and different MCUs. I'm wondering if these macros in Adafruit_ILI9341.cpp line 68-201 could be moved to Adafruit_ILI9341.h? By doing this, these great macros could be easily reused in other platform independet, more generic libraries/classes when needing to interface with other SPI devices like touch? (I.e. I could simply include Adafruit_ILI9341.h there and work with the given SPI macros abstracting from MCU and hardware/software SPI).

ESP8266 Bitmap not showing.

The move from 1.0.2 to 1.0.3 appears to cause bitmaps to no longer be displayed when using the Huzzah ESP8266.

I did a diff between the versions and there appears to be significant changes including removal of ESP8266 defined sections.

Is this a permanent change to remove the ESP8266 from the supported devices in favor of the ESP32? If so then there needs to be a branch so the EPS8266 users don't keep retrieving code that won't work.

img_2477

__AVR__ optimizations in spiwrite, spiread don't work on Arduino Uno Wifi

  • Arduino board: Arduino Uno Wifi
    (note: board made by by ardiuno.org)

  • Arduino IDE version (found in Arduino -> About Arduino menu): 2:1.0.5+dfsg2-4
    (note: IDE made by arduino.cc, distributed by Debian Jessie. It doesn't have support for the Arduino Uno Wifi, so I selected Arduino Uno in the IDE. I copied the Wifi library from the arduino.org IDE.)

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

  • I re-flashed the Wifi chip on the Arduino with self-made firmware. I think this step is irrelevant, since the Wifi chip isn't connected to the Arduino SPI, and my self-made firmware isn't supposed to do anything anyway.
  • I attached the 2.8" TFT Touch shield to the Arduino (box refers to http://adafru.it/1651, and PCB says it's a v2.0 shield)
  • I installed the Adafruit_GFX, Adafruit_ILI9341 and Adafruit_STMPE610 libraries
  • I tested the Adafruit_STMPE610/TouchTest example; it worked after modifying it a bit (had to use hardware SPI with CS 8 instead of I2C)
  • I tested the Adafruit_ILI9341/graphicstest example. This didn't work:
    • it printed "ILI9341 Test!"
    • then: nothing (no printing, no screen changes)

After some debugging, I found that it started working by disabling the __AVR__ specific code in the spiwrite and spiread functions in Adafruit_ILI9341.cpp. So, in both functions, where the original code says
#if defined (__AVR__)
my modified code says
#if defined (DISABLED) && defined (__AVR__)

With this change, I force that the generic SPI.transfer(..) code is used instead of the __AVR__ specific code in the library. Somehow, that fixed the problem: the graphicstest example works, and the touchpaint example also works, so I assume I now have a completely working touch shield.

I don't know if this problem is specific to my situation, or if other people are going to run into it. In the second case, you might use this report to improve your library. If you know why my system has this problem, please let me know: maybe it could be beneficial to me to use the __AVR__ specific code if there is some way to do that (I assume it's there for some reason - maybe an optimization?).

PS. One final hint on what went wrong: the original library code kept hanging in this loop:
while(!(SPSR & _BV(SPIF)));
I have no idea why it hangs there, or why the generic SPI library does work.

Support for SPI Settings

  • Arduino board: Arduino Uno

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.9

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Use device that needs SPI_MODE1. Example: ADS1220
    ADS1220 LIB: https://github.com/Protocentral/Protocentral_ADS1220 using modified tommz9 pull request

Hello.
I would like to request support for SPI settings as i got a ADS1220 which users spiMode1 and the ILI display uses SPImode0. This gives some problems and as of now Arduino also recommends using SPIsettings for libraries to ensure that it runs at the correct SPI settings

SPI settings reference:
https://www.arduino.cc/en/Reference/SPIbeginTransaction

Compatibility problems with AVR Dx series microcontrollers.

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: AVR128DB28 with DxCore

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.13

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): **Using SPI1 mapped to portc to use the internal level shifter it doesn't work but works when using spi0 mapped to porta. Everything compiles just fine but when the tft.begin() function is called the microcontroller freezes and becomes unresponsive. Other libraries appear to all operate properly with the spi interface on portc except for this one.

#include <SPI.h>
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

#define TFT_DC PIN_PA3
#define TFT_CS PIN_PA7
//#define TFT_RST PIN_PF1 //tied high with resistor
#define TFT_MOSI PIN_PC0
#define TFT_CLK PIN_PC2
#define TFT_MISO PIN_PC1

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

void setup() {
SPI.swap(SPI1_SWAP0); //Swaps to the portc MVIO to use internal level shifters
SPI.begin();
Serial.begin(9600);
Serial.println("STARTED"); //Before function is called the print is successful
tft.begin(); //gets stuck somewhere in here
Serial.println("SUCCESSFUL"); //This print never occurs
}

void loop{ //do nothing

}**

Please re-add pushColors (plural of pushColor)

It seems that during the refactoring and optimization of the code, the pushColors functions was removed.

I see that the pushColor was re-added later, but I have some code relaying on the former pushColors (plural) which in turn could also take into consideration if data alignment has big/littleEndian.

Unfortunately I am not sure how to re-add the function myself.

ILI9341V (3wire)

Hello,
I have a "shanyan tft module 2.4v" with no DC-wire. After reading some manuals I understand, that it is in "3 wire SPI"-mode.
Is it possible to get support for that?

SPITFT performance on Teensy 3

I am working on a number of extensions to the Adafruit-GFX library (true color, indexed color canvasses etc) and I have finally updated my development system to the new style of display driver libraries utilizing the SPITFT class instead of re-implementing the basic routines for every single display class. All my testing is done on a Teensy 3.2 using the platformio / MSC environment (so not teensyduino directly)

Now with that new class, I see a considerable drop in performance. Drawing a 40x50 canvas went from ~17ms to ~27ms - now, that encompasses more than just drawing on screen, but the major difference is the update of the display driver to the SPITFT model.

It would seem that the optimizations from the original ILI9341_t3 didn't make it to the SPITFT implementation.

setAddrWindow + pushColor on ESP32 not working properly

I'm using the JpegDecoder lib (https://github.com/Bodmer/JPEGDecoder) for displaying jpegs on the ILI9341 display.
All functions (including graphicstest example) are just working fine.
But as soon I'm using the pushColor function in combination with setAddrWindow it doesn't work as expected (blank screen or misaligned pixel fragments).
Since the drawPixel function is working fine (which calls writepixel which uses setAddrWindow(x,y,1,1) too) I tried to make it minimalistic as possible.
So when I do something like this:

tft.setAddrWindow(0,0,32,32); 
i = 32*32;
while(i--) tft.pushColor(ILI9341_CYAN);

I expected to see a Cyan colored square with 32x32 pixels on the top left. But what I see is a Cyan Line all over the 240px width and 4 px height. So it seems like the controller doesn't limit the frame.

Board: ESP32 Devkit v1.0
Libs: Adafruit ILI9341 v1.2.0 + Adafruit GFX v1.2.9
Framework: ESP-IDF v3.1 (1.4.0)

With my ST7735 everything is working as expected.

The Adafruit 4311 seems to be inverted b3r2g3 instead of r5g6b5

  • Arduino board: arduino Uno

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.7

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): Run the pictureEmbed demo on a https://www.adafruit.com/product/4311

Instead of the flag of Wales, what you will get is a per fess black and blue, a dragon passant to sinister green.

I have been experimenting, and it seems the u16 pixels are being interpreted as b3r2g3 inverted instead of r5g6b5. And by inverted I mean 0xff is black and 0x00 is white.

I am unable to find anything in the ili9341 data sheet to help me enable 16-bit color.

ESP8266, most recent version does not work, 1.0.2 is ok.

Hello, I’m using an ESP8266 and a ILI9341, with the 1.0.2 it just works fine, with the most recent version it fails, just shows a white screen. I use the 2.0.3 SPI Driver and Adafruit_GFX from May.27. 2017 . My guess is that the tft.begin(), which was changed may cause the issiue,... .

I get a Stacktrace:

<<<stack<<<
ÆU)��
ôŒ

ÿ(Š**š¢Š�¢•ÍÑ…

Soft WDT reset

ctx: cont
sp: 3ffef270 end: 3ffef4d0 offset: 01b0

stack>>>
3ffef420: 0000013f 000000ef 3ffee3ac 4020246f
3ffef430: 00000000 3ffee460 000018f0 40202b06
3ffef440: feefeffe 00000001 3ffee3ac 00000140
3ffef450: 00012c00 00000000 3ffee3ac 40202bd5
3ffef460: 000000f0 00000000 3ffee3ac 4020392c
3ffef470: 00000000 00000000 3ffee3ac 4020246f
3ffef480: 3fffdad0 00000028 3ffee3ac 3ffee4a8
3ffef490: 3fffdad0 00000000 3ffee3ac 40203c59
3ffef4a0: 3fffdad0 00000000 3ffee3ac 40201c49
3ffef4b0: feefeffe feefeffe 3ffee4a0 402035a0
3ffef4c0: feefeffe feefeffe 3ffee4b0 40100718
<<<stack<<<
R�)��
ôŒ

ÿ(Š**š¢Š�¢•ÍÑ…


Following pin’s are used:

ILI9341 :ESP8266
D/C :GPIO16
SCLK :GPIO14(SCK)
MISO :GPIO12(MISO)
MOSI :GPIO13(MOSI)
CS :GPIO0
RESET :RESET

The Code used is:

#include <Arduino.h>
#include <stdint.h>
#include <SPI.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_GFX.h>

#define TFT_DC D2
#define TFT_CS D8

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

void setup()
{
tft.begin(500000);
tft.setRotation(1);
}

void loop()
{
tft.fillScreen(ILI9341_BLACK);
delay(500);
tft.fillScreen(ILI9341_GREEN);
delay(500);
}

tamplates based design

hi would Adafruit consider making a c++ template based design for this?
a reason is that as the 'platforms' get more varied it adds more code bloat as each 'platform' (mcu/boards) is added
e.g. platforms that supports hardware SPI probably won't need software SPI and that code is simply unused but built and compiled into the binaries.

common codes (e.g. the public, protected (callback) api parts) can go into the template, so that each different 'platform' (hard spi, soft spi, mcu, board etc) is perhaps a different class

default HWSpi on teensy 3.6 is slightly slower than swspi, and 2.1x slower than ESP32

  • Arduino board: teensy 3.6
  • Arduino IDE version arduino-1.8.9-teensyduino-1.4

I'm not sure how much of this is WAI, feel free to close if so. Suggestions though:

  1. default HWSPI speed on teensy 3.6 is too slow (slower than SWSPI even). tft.begin(40000000) makes things about 2x faster than SWSPI
  2. even then, it's still 2x slower than the optimized T3 teensy library
  3. more interestingly graphicstest on ESP32 with HWSPI using your exact same git TOT lib, is 2x faster than HWSPI on teensy, and your lib with ESP32 is still a bit faster than the optimized teensy library on teensy 3.6
Using library SPI at version 1.0 in folder: /var/local/arduino-1.8.9-teensyduino-1.46/hardware/teensy/avr/libraries/SPI 
Using library Adafruit-GFX-Library at version 1.5.1 in folder: /home/merlin/Arduino/libraries/Adafruit-GFX-Library 
Using library Adafruit_ILI9341 at version 1.5.0 in folder: /home/merlin/Arduino/libraries/Adafruit_ILI9341 

I'm using both your libraries from git TOT

#define TFT_MISO 12
#define TFT_CLK 13
#define TFT_MOSI 11
#define TFT_DC 10
#define TFT_RST 23
#define TFT_CS 22
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

When using swSPI, screen fill is 890029, almost 1 sec.
When using hwSPI, screen fill is 954115, even slower.

When using hwSPI, using tft.begin(40000000) takes the speed down to 416309 (0.4s). Higher values do not go faster.

For comparison, ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC) does a screenfill in 224904

Last but not least, the same Adafruit_ILI9341 with HWSPI on ESP32 does screenfill in 195277, faster than teensy's optimized t3 library.

Adafruit_ILI9341::scrollTo uint16 vs uint8

while compiling with all warnings on:
/home/merlin/Arduino/libraries/Adafruit_ILI9341/Adafruit_ILI9341.cpp:259:46: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
sendCommand(ILI9341_VSCRSADD, (uint8_t*) y, 2);

Sure enough, the function is
void Adafruit_ILI9341::scrollTo(uint16_t y) {
sendCommand(ILI9341_VSCRSADD, (uint8_t*) y, 2);
}

Given that a TFT can be wider than 256 chars, uint16_t seems reasonable, but spiWrite(*dataBytes) may only allow a single byte, i.e. a scroll of up to 255 pixels?

If so, changing scrollTo to take uint8_t seems reasonable?

Adafruit_ILI0341 and Adafruit_SPIFlash compatibility issue

Adafruit_ILI0341 and Adafruit_SPIFlash libraries seem to have some incompatibility issue for the board Adafruit nrf52840 express when compiling with Arduino IDE on mac.

Code to reproduce the problem (using most recent versions of both libraries):

#include <Adafruit_ILI9341.h>
#include <Adafruit_SPIFlash.h>

void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}

Error msgs:

/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::Adafruit_SPIDevice(signed char, unsigned long, BitOrder, unsigned char, SPIClass*)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:17: multiple definition of Adafruit_SPIDevice::Adafruit_SPIDevice(signed char, unsigned long, BitOrder, unsigned char, SPIClass*)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:17: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::Adafruit_SPIDevice(signed char, unsigned long, BitOrder, unsigned char, SPIClass*)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:17: multiple definition of Adafruit_SPIDevice::Adafruit_SPIDevice(signed char, unsigned long, BitOrder, unsigned char, SPIClass*)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:17: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::Adafruit_SPIDevice(signed char, signed char, signed char, signed char, unsigned long, BitOrder, unsigned char)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:43: multiple definition of Adafruit_SPIDevice::Adafruit_SPIDevice(signed char, signed char, signed char, signed char, unsigned long, BitOrder, unsigned char)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:43: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::Adafruit_SPIDevice(signed char, signed char, signed char, signed char, unsigned long, BitOrder, unsigned char)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:43: multiple definition of Adafruit_SPIDevice::Adafruit_SPIDevice(signed char, signed char, signed char, signed char, unsigned long, BitOrder, unsigned char)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:43: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::~Adafruit_SPIDevice()': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:78: multiple definition of Adafruit_SPIDevice::~Adafruit_SPIDevice()'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:78: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::~Adafruit_SPIDevice()': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:78: multiple definition of Adafruit_SPIDevice::~Adafruit_SPIDevice()'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:78: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::begin()': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:85: multiple definition of Adafruit_SPIDevice::begin()'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:85: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::transfer(unsigned char*, unsigned int)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:123: multiple definition of Adafruit_SPIDevice::transfer(unsigned char*, unsigned int)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:123: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::transfer(unsigned char)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:260: multiple definition of Adafruit_SPIDevice::transfer(unsigned char)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:260: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::beginTransaction()': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:271: multiple definition of Adafruit_SPIDevice::beginTransaction()'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:271: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::endTransaction()': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:280: multiple definition of Adafruit_SPIDevice::endTransaction()'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:280: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::setChipSelect(int)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:290: multiple definition of Adafruit_SPIDevice::setChipSelect(int)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:290: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::beginTransactionWithAssertingCS()': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:301: multiple definition of Adafruit_SPIDevice::beginTransactionWithAssertingCS()'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:301: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::endTransactionWithDeassertingCS()': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:310: multiple definition of Adafruit_SPIDevice::endTransactionWithDeassertingCS()'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:310: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::write(unsigned char const*, unsigned int, unsigned char const*, unsigned int)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:328: multiple definition of Adafruit_SPIDevice::write(unsigned char const*, unsigned int, unsigned char const*, unsigned int)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:328: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::read(unsigned char*, unsigned int, unsigned char)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:385: multiple definition of Adafruit_SPIDevice::read(unsigned char*, unsigned int, unsigned char)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:385: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::write_then_read(unsigned char const*, unsigned int, unsigned char*, unsigned int, unsigned char)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:423: multiple definition of Adafruit_SPIDevice::write_then_read(unsigned char const*, unsigned int, unsigned char*, unsigned int, unsigned char)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:423: first defined here
/Users/antti/Library/Arduino15/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp.o: in function Adafruit_SPIDevice::write_and_read(unsigned char*, unsigned int)': /Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice.cpp:485: multiple definition of Adafruit_SPIDevice::write_and_read(unsigned char*, unsigned int)'; libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp.o:/Users/antti/Documents/Arduino/libraries/Adafruit_BusIO/Adafruit_SPIDevice 2.cpp:485: first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Adafruit Feather nRF52840 Express.

Connect two ILI9341 to same esp

Hi,

I'm trying to connect two ILI9341 to same esp to show two data on the same time.

I've created an array of instance but seems that isn't working, at tft.begin feel both display are reset even if the CS pin is diffferent.
Do you have any suggestion?

Here below the code

Adafruit_ILI9341 TFTlist[]= {Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST),Adafruit_ILI9341(TFT_CS1, TFT_DC, TFT_RST)};

for (i=0;i<2;i++){
TFTlist[i].begin();
TFTlist[i].setRotation(1);
TFTlist[i].fillScreen(ILI9341_WHITE);
TFTlist[i].drawBitmap(140, 100, logo_stk_bmp, 48,48, ILI9341_BLACK, ILI9341_GRAY);
delay(2000);
TFTlist[i].fillScreen(ILI9341_WHITE);
TFTlist[i].setTextColor(ILI9341_BLACK);
delay(2000);
}
Thanks
Paolo

Screenfill ESP8266 very slow

See test case attached: Using the latest version of this repo (commit 136173b) and hardware SPI, clearing the screen with a certain color takes 319ms on an ESP8266 (WEMOS D1 mini).
The Arduino MEGA 2560 does it in 289ms, the ESP32 (DOIT ESP32 DEVKIT V1) does it in 32 ms.

Don't know what's wrong with this. Using a comparable library based on the Adafruit library, the screenfill takes only 33ms on the ESP8266.

Don't know whether this also happens with Adafruit hardware. Just wanted to let you know...

Keep up the brilliant work and all the best! P.

  • Arduino board: ESP8266 WEMOS D1 Mini, EPS32 DOIT DEVKIT V1, Arduino MEGA 2560

  • Arduino IDE version: 1.8.5

  • Test case:

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// Pin settings EPS8266
//#define TFT_CS   SS
//#define TFT_DC   4
//#define TFT_RST  5

// Pin settings EPS32
//#define TFT_CS   SS
//#define TFT_DC   15
//#define TFT_RST  2

// Pin settings Arduino MEGA 2560
#define TFT_CS   SS
#define TFT_DC   7
#define TFT_RST  6

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

void setup() {
  #ifdef ESP8266
    Serial.begin(74880);
  #else
    Serial.begin(115200);
  #endif

  tft.begin();

  unsigned long t = millis();
  tft.fillScreen(ILI9341_BLUE);
  Serial.println(millis()-t);
}

void loop() {
  delay(1000);
}


#define for nRF52832 Feather unrecognized in example sketches; differs from BSP

TL;DR:

  • Suggest changing #define identifier ARDUINO_NRF52832_FEATHER to ARDUINO_NRF52_FEATHER in example sketches.

Steps to reproduce:

  • In Arduino IDE, for board, choose Adafruit Bluefruit nRF52832 Feather
  • Open examples: graphicstest_featherwing and touchpaint_featherwing
  • Verify/Compile the sketches
  • Note the errors that appear (these are in graphicstest_featherwing.ino):
graphicstest_featherwing:66:41: error: 'TFT_CS' was not declared in this scope
 Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
                                         ^
graphicstest_featherwing:66:49: error: 'TFT_DC' was not declared in this scope
 Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
                                                 ^

On line 43 of graphicstest_featherwing the sketch uses a different #define identifier than used in the current nRF52832 Feather board support package:

#ifdef ARDUINO_NRF52832_FEATHER /* BSP 0.6.5 and higher! */
   #define TFT_DC   11
   #define TFT_CS   31
   #define STMPE_CS 30
   #define SD_CS    27
#endif

(touchpaint_featherwing example sketch also has this issue beginning line 46.)

In the current BSP, the board uses ARDUINO_NRF52_FEATHER rather than ARDUINO_NRF52832_FEATHER.

While I haven't tested with the Adafruit Feather nRF52840 Express, the pin assignments look correct, and verify/compile is successful with that board selected in the Arduino IDE.

Related discussion on Adafruit Forums: "error: 'TFT_CS' was not declared in this scope" with graphi

scrollMargin() has a typo

scrollMargin() only works for bottom == 0
e.g. // TFA+VSA+BFA must equal 320
VSA = 320 - TFA - BFA; // is correct
VSA = 320 - TFA + BFA; // only ok for 320 - TFA + 0

The same problem occurs with Adafruit_HX8357 library.
You don't implement scrollMargin() on Adafruit_ST7789 or Adafruit_ST7735

void Adafruit_ILI9341::setScrollMargins(uint16_t top, uint16_t bottom) {
  // TFA+VSA+BFA must equal 320
  if (top + bottom <= ILI9341_TFTHEIGHT) {
    uint16_t middle = ILI9341_TFTHEIGHT - top + bottom;
    uint8_t data[6];
    data[0] = top >> 8;
    data[1] = top & 0xff;
    data[2] = middle >> 8;
    data[3] = middle & 0xff;
    data[4] = bottom >> 8;
    data[5] = bottom & 0xff;
    sendCommand(ILI9341_VSCRDEF, (uint8_t *)data, 6);
  }
}

David.

Is USE_FAST_GPIO working for Feather nRF52 as a __arm__ platform?

I have tested this library for the Nordic nRF52-DK board with Sandeep Mistry's arduino-nRF5 board implementation. I got it working by inhibiting USE_FAST_GPIO for the Nordic NRF52-DK board as it is a __arm__ platform.
Doing like that:

#if defined (__AVR__) || defined(TEENSYDUINO) || defined(ESP8266) || defined (ESP32) || defined(__arm__)
#if !defined(NRF5)
#define USE_FAST_PINIO
#endif
#endif

Did it really work with the new Feather nRF52 - also based on__arm__?

QT Py ESP32-C3 SPi compatibility

  • Arduino board: QT Py ESP32-C3

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.19

Hi,

Just wondered if the ili9341 library is compatible with the QT Py ESP32-C3, as I have not been able to get an output.

I have been trying the same pins which I have been using on the QT PY ATSAMD21, plus some variations.

//QT Py ESP32-C3

// Libraries
//Espressif 2.0.7 no compile
//Espressif 2.0.6 no compile
//Espressif 2.0.5 compiles

//ili9341 1.5.12 compiles

//----------------------------------------------------------------------------------
#define TFT_CS 5
#define TFT_DC 7
#define TFT_RST 0 // also 9

/* hardware pins */
// TFT_SCLK pin 8
// TFT_MOSI pin 10

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST); // Use hardware SPI
//----------------------------------------------------------------------------------

Many thanks

Rupert

Regarding RST pin option

Hello,

As you have written in readme.txt file that these displays use SPI to communicate, 4 or 5 pins are required to interface (RST is optional). During testing of program code, I have found that if I remove the RST pin then the screen become white.
How can I make RST pin optional. Actually, I do not want to use it during interfacing to reduce the number of pin of arduino ethernet board.

Thanks in advance.

Initialization code in Adafruit_ILI9341.cpp sends 7 undocumented commands

In Adafruit_ILI9341.cpp, from lines 271 to 305, (in the begin() method) sends a series of 7 undocumented commands over the SPI bus. The commands are not included in the ILI9341 datasheet, and so they must be ignored by the controller?

Commenting them out has no effect from what I can tell. I'm testing this with the 2.8" display, capacitive touch. Maybe these are left over garbage from the other resistive touch display? That touch screen was on the SPI bus.

I suggest either removing the extra lines, or adding a code comment indicating their purpose. It would be nice to #define the magic numbers, that would have helped me understand their intent.

Arduino ILI9341 simulation 😀

Dear Team,

Good day

We are ever grateful for such wonderful libraries. I have here a permanent link for the simulation.
https://wokwi.com/arduino/projects/307567275170333248

It would be awesome if you can make this link available to the future readers.
We will be excited to hear about the feedback on the simulator as well. May we know, how we can make it better to publish such useful libraries in the future.

Thank you!
Matititam

image

Hardware SPI don't work with ILI9341 - 3 bugs and 3 solutions here

Hi,

I'm use the Adafruit_ILI9341 and the GFX library to drive a ILI9341 TFT SPI touch screen on a Arduino UNO with an Ethernet Shield 2 (for the touch pad I use URTouch.h)

I've found some bugs and also solutions :

1st :
If you use
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST)
you've got an error "call of overloaded 'Adafruit_ILI9341(int, int, int)' is ambiguous"
So you have to edit Adafruit_ILI9341.h and Adafruit_ILI9341.cpp to comment Adafruit_ILI9341() fonctions for ESP8266
I think you have to change function names to avoid this.

2nd :
ILI9341 use SPI MODE 3 and cannot work with the default SPI MODE the library uses with hardware SPI
Curiously, the software SPI use the good mode.
Thus, you have to edit Adafruit_ILI9341.cpp and replace
initSPI(freq);
by
initSPI(freq, SPI_MODE3);

3rd
When you have quite long wires (eg. 20cm dupont wire) and slow 5V/3.3V level converter (or just 10K resistors !) from the Arduino UNO and the TFT you've got a speed limitation.
Remember that in electronics :

  • long wire = coil = low pass filter
  • resistor + logical input capacitance = low pass filter
    Indeed, in the sketch, you have to use
    tft.begin(3000000);
    instead of
    tft.begin();

You can also use a fast SPI speed with short wires and a hi-speed level converter.

I found that a lot of people don't know these problems and use
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
with the hardware SPI pins...
that's very very bad...
that's very slow...
and it doesn't work with other SPI devices...

I wonder that the constructor have explicit names as "tftHardwareSPI" and "tftSoftwareSPI"

Please, can you update your library and also your documentation and sample codes ?

Bests regards.

getPixel() or readPixel()

Does anybody know how to implement a getPixel() or readPixel() for 9341 TFT controller ? I have an application where I need to save the pixel displayed at x,y location before write a new one at same location... I did not find in GFX library any function to do that...

Library is missing license file & official copyright notices

While the source code does contain a small reference to being licensed as MIT, the library does not contain a LICENSE, license.txt file etc... that clearly states and provides the license for the code.
Also, the Adafruit-GFX license is BSD vs this library stating it is MIT.
That is also something that you might want to take a look at. To see if you really want this library to be MIT vs BSD like the GFX library.

There are also no official copyright notices or dates in the source code modules like what is in the GFX library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.