Giter Site home page Giter Site logo

ili9341_t3's Introduction

Discussion regarding this optimized version:

http://forum.pjrc.com/threads/26305-Highly-optimized-ILI9341-%28320x240-TFT-color-display%29-library

------------------------------------------

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

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.

ili9341_t3's People

Contributors

bitbank2 avatar frankboesing avatar impulseadventure avatar ivankravets avatar iwanders avatar kurte avatar nqbit avatar paulstoffregen avatar softegg avatar spirou42 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

ili9341_t3's Issues

Not compiling for Arduino Mega

The library is not compiling for arduino mega and is giving the following error :
'SPI_PUSHR_EOQ' was not declared in this scope

KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_EOQ;

Smoothscrolling: Printing fonts line-by-line

It would be cool to have smooth-scrolling
This requires a way to print the fonts per (pixel-)line.
In addition, a way to determine the screen-width of string would be needed to detect newlines

private

Hi Paul,
all low-level functions are private, which makes it impossible to use them for own fast functions without changing the library. For example, for my spectrum-bargraph display it would be good to have an own specialized fillrect function - this is not possible without changing the library code, now.

What do you think ? Would it be possible to remove the "private" ?

undeclared variable KINETISK_SPI0 compiling for UNO

compiling the examples provided with the library using arduino studio for arduino uno r3

Arduino: 1.8.13 (Windows 7), Board: "Arduino Uno". Looks like some undeclared variables.

Am I doing it wrong?

In file included from C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3\examples\spitftbitmap\spitftbitmap.ino:17:0:

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoNotFull()':

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:178:9: error: 'KINETISK_SPI0' was not declared in this scope

sr = KINETISK_SPI0.SR;

     ^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoEmpty()':

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:187:9: error: 'KINETISK_SPI0' was not declared in this scope

sr = KINETISK_SPI0.SR;

     ^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitTransmitComplete()':

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:193:12: error: 'KINETISK_SPI0' was not declared in this scope

while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done

        ^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:193:31: error: 'SPI_SR_TCF' was not declared in this scope

while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done

                           ^~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:194:9: error: 'KINETISK_SPI0' was not declared in this scope

tmp = KINETISK_SPI0.POPR; // drain the final RX FIFO word

     ^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_cont(uint8_t)':

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:197:3: error: 'KINETISK_SPI0' was not declared in this scope

KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:197:51: error: 'SPI_PUSHR_CTAS' was not declared in this scope

KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

                                               ^~~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:197:71: error: 'SPI_PUSHR_CONT' was not declared in this scope

KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

                                                                   ^~~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_cont(uint8_t)':

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:201:3: error: 'KINETISK_SPI0' was not declared in this scope

KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:201:48: error: 'SPI_PUSHR_CTAS' was not declared in this scope

KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

                                            ^~~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:201:68: error: 'SPI_PUSHR_CONT' was not declared in this scope

KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;

                                                                ^~~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_cont(uint16_t)':

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:205:3: error: 'KINETISK_SPI0' was not declared in this scope

KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;

^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:205:48: error: 'SPI_PUSHR_CTAS' was not declared in this scope

KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;

                                            ^~~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:205:68: error: 'SPI_PUSHR_CONT' was not declared in this scope

KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;

                                                                ^~~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_last(uint8_t)':

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:210:3: error: 'KINETISK_SPI0' was not declared in this scope

KINETISK_SPI0.SR = SPI_SR_TCF;

^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:210:22: error: 'SPI_SR_TCF' was not declared in this scope

KINETISK_SPI0.SR = SPI_SR_TCF;

                  ^~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:211:51: error: 'SPI_PUSHR_CTAS' was not declared in this scope

KINETISK_SPI0.PUSHR = c | (pcs_command << 16) | SPI_PUSHR_CTAS(0);

                                               ^~~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_last(uint8_t)':

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:216:3: error: 'KINETISK_SPI0' was not declared in this scope

KINETISK_SPI0.SR = SPI_SR_TCF;

^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:216:22: error: 'SPI_SR_TCF' was not declared in this scope

KINETISK_SPI0.SR = SPI_SR_TCF;

                  ^~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:217:48: error: 'SPI_PUSHR_CTAS' was not declared in this scope

KINETISK_SPI0.PUSHR = c | (pcs_data << 16) | SPI_PUSHR_CTAS(0);

                                            ^~~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_last(uint16_t)':

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:222:3: error: 'KINETISK_SPI0' was not declared in this scope

KINETISK_SPI0.SR = SPI_SR_TCF;

^~~~~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:222:22: error: 'SPI_SR_TCF' was not declared in this scope

KINETISK_SPI0.SR = SPI_SR_TCF;

                  ^~~~~~~~~~

C:\Users\radu\Documents\Arduino\libraries\ILI9341_t3/ILI9341_t3.h:223:48: error: 'SPI_PUSHR_CTAS' was not declared in this scope

KINETISK_SPI0.PUSHR = d | (pcs_data << 16) | SPI_PUSHR_CTAS(1);

                                            ^~~~~~~~~~~~~~

exit status 1

Error compiling for board Arduino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Adafruit GFX updates

Any chance you could update this lib to the newer adafruit GFXlib.

It supports things like returning the size box that a given string will fill. which would be very useful.

many thanks

ILI9341_t3 - "touchpaint" example not working - found possible fix

Description

When attempting to use the "touchpaint" example sketch included in the ILI9341_t3 library, the touchscreen does not function, and locks up the whole SPI bus.

Steps To Reproduce Problem

  • Load the example code from the aforementioned example sketch, and delete the if-while lockout loop in setup.
    Connect an ILI9341 display identical to the one PJRC sells (I purchased mine directly from pjrc.com) in the manner prescribed on pjrc.com.
    Flash the sketch.

Hardware & Software

Board: Teensy 4.1 (w/PSRAM chip)
Shields / modules used: "Color 320x240 TFT Touchscreen, ILI9341 Controller Chip"
Arduino IDE version: 1.8.13
Teensyduino version: 1.5.3
Operating system & version: MacOS High Sierra (10.13.6)
Other software or hardware: 10k pullup resistor on reset, breadboard, wires, 2x220 resistor in parallel for backlight

Arduino Sketch

/***************************************************
  This is our touchscreen painting example for the Adafruit ILI9341 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 <Wire.h>      // this is needed even tho we aren't using it
#include <ILI9341_t3.h>
#include <Adafruit_STMPE610.h>

// This is calibration data for the raw touch data to the screen coordinates
#define TS_MINX 150
#define TS_MINY 130
#define TS_MAXX 3800
#define TS_MAXY 4000

// The STMPE610 uses hardware SPI on the shield, and #8
#define STMPE_CS 8
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);

// The display also uses hardware SPI, plus #9 & #10
#define TFT_CS 10
#define TFT_DC  9
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);

// Size of the color selection boxes and the paintbrush size
#define BOXSIZE 40
#define PENRADIUS 3
int oldcolor, currentcolor;

void setup(void) {
 // while (!Serial);     // used for leonardo debugging
 
  Serial.begin(9600);
  Serial.println(F("Touch Paint!"));
  
  tft.begin();

  if (!ts.begin()) {
    Serial.println("Couldn't start touchscreen controller");
    while (1);
  }
  Serial.println("Touchscreen started");
  
  tft.fillScreen(ILI9341_BLACK);
  
  // make the color selection boxes
  tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
  tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
  tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
  tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
  tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
  tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
 
  // select the current color 'red'
  tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
  currentcolor = ILI9341_RED;
}


void loop()
{
  // See if there's any  touch data for us
  if (ts.bufferEmpty()) {
    return;
  }
  /*
  // You can also wait for a touch
  if (! ts.touched()) {
    return;
  }
  */

  // Retrieve a point  
  TS_Point p = ts.getPoint();
  
 /*
  Serial.print("X = "); Serial.print(p.x);
  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());

  /*
  Serial.print("("); Serial.print(p.x);
  Serial.print(", "); Serial.print(p.y);
  Serial.println(")");
  */

  if (p.y < BOXSIZE) {
     oldcolor = currentcolor;

     if (p.x < BOXSIZE) { 
       currentcolor = ILI9341_RED; 
       tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
     } else if (p.x < BOXSIZE*2) {
       currentcolor = ILI9341_YELLOW;
       tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
     } else if (p.x < BOXSIZE*3) {
       currentcolor = ILI9341_GREEN;
       tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
     } else if (p.x < BOXSIZE*4) {
       currentcolor = ILI9341_CYAN;
       tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
     } else if (p.x < BOXSIZE*5) {
       currentcolor = ILI9341_BLUE;
       tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
     } else if (p.x < BOXSIZE*6) {
       currentcolor = ILI9341_MAGENTA;
       tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
     }

     if (oldcolor != currentcolor) {
        if (oldcolor == ILI9341_RED) 
          tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
        if (oldcolor == ILI9341_YELLOW) 
          tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
        if (oldcolor == ILI9341_GREEN) 
          tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
        if (oldcolor == ILI9341_CYAN) 
          tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
        if (oldcolor == ILI9341_BLUE) 
          tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
        if (oldcolor == ILI9341_MAGENTA) 
          tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
     }
  }
  if (((p.y-PENRADIUS) > BOXSIZE) && ((p.y+PENRADIUS) < tft.height())) {
    tft.fillCircle(p.x, p.y, PENRADIUS, currentcolor);
  }
}

Errors or Incorrect Output

The touchscreen does not function when its data is connected, and locks up the normal screen as well. When the touchscreen's data is disconnected, the normal screen functions properly, on the same code.

ILI9341_t3

Hello Paul,

Do you have any plans on updating this to support Teensey 4.0 boards? I am trying to follow a guide on Adafruit (https://learn.adafruit.com/animated-electronic-eyes/customizing) abd doing everything in the guide, but I'm using a teensey 4.0 board as I could not buy a 3.2 or 3.6 because of stocking shortages. When I compile I receive the following output.

uncannyEyes: In function 'void drawEye(uint8_t, uint16_t, uint8_t, uint8_t, uint8_t, uint8_t)':
uncannyEyes:466: error: 'KINETISK_SPI0' was not declared in this scope
while(KINETISK_SPI0.SR & 0xC000); // Wait for space in FIFO
^
uncannyEyes:467: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = p | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
uncannyEyes:467: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = p | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
uncannyEyes:467: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = p | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
uncannyEyes:504: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.SR |= SPI_SR_TCF; // Clear transfer flag
^
uncannyEyes:504: error: 'SPI_SR_TCF' was not declared in this scope
KINETISK_SPI0.SR |= SPI_SR_TCF; // Clear transfer flag
^
'KINETISK_SPI0' was not declared in this scope

I am using Arduino 1.8.13, the recommended teensy board versions and the required "Using the Arduino Library Manager (Sketch→Include Library→Library Manager…) install Adafruit_GFX, Adafruit_BusIO and Adafruit_ZeroDMA, plus the library compatible with your display: Adafruit_SSD1351 for the OLED display, Adafruit_ST7735 for TFT LCD."

I have the Adafruit_ST7735 for TFT LCD.

I have validated that the config.h to ensure I have the TFT driver in use.

//#include <Adafruit_SSD1351.h> // OLED display library -OR-
#include <Adafruit_ST7735.h> // TFT display library (enable one only)

I should add that if I try to compile for 3.2 or 3.6 the sketch does compile.

Best regards,
Shawn

spitftbitmap.ino Drawing at 0,0

This bitmap drawing example always draws at 0, 0 regardless of the x and y setting.
I believe this is due to the following line:
tft.writeRect(0, row, w, 1, awColors);

By altering this to
tft.writeRect(x, row+y, w, 1, awColors);

The bitmap is drawn correctly to the desired location in the screen.

Unable to get display working

Hi,

I spent a few hours yesterday trying to get this library to work wit a 2.2in ili9341 display. Same pinout as the docs page has. I used the graphictest sketch. I tried with both standard and alt pins with and without the audio shield. Triple checked connections which worked with another micro. Then I tried the original Adafruit library and it worked fine with the same code.

Only changes from standard graphictest sketch are below, each in their respective places.

define TFT_DC 20

define TFT_CS 21

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

SPI.setMOSI(7);
SPI.setSCK(14);

I haven't looked at the differences in the libraries to see if I can spot it yet.

Thanks.

Missing Symbols using Arduino IDE 1.6.7

Getting some compilation errors while attempting to compile in 1.6.7 due to missing symbols:

ILI9341_t3/ILI9341_t3.h:178:9: error: 'KINETISK_SPI0' was not declared in this scope
ILI9341_t3/ILI9341_t3.h:193:31: error: 'SPI_SR_TCF' was not declared in this scope
ILI9341_t3/ILI9341_t3.h:197:67: error: 'SPI_PUSHR_CTAS' was not declared in this scope
ILI9341_t3/ILI9341_t3.h:197:71: error: 'SPI_PUSHR_CONT' was not declared in this scope

Any idea where these should be declared?

what is KINETISK_SPI0.SR?

Please use this form only to report code defects or bugs.

For any question, even questions directly pertaining to this code, post your question on the forum.

Teensy: forum.pjrc.com

If you are experiencing trouble but not certain of the cause, or need help using this code, ask on the forum. This is not the place to ask for support or help, even directly related to this code. Only use this form you are certain you have discovered a defect in this code!

Please verify the problem occurs when using the very latest version, using the newest version of Arduino and any other related software.

----------------------------- Remove above -----------------------------

Description

Describe your problem.
When I try to run an example program on a Nano 33 IOT, the compiler complains about all the references to KINETISK that are not defined. Is the else clause at all tested or valid?

Steps To Reproduce Problem

Please give detailed instructions needed for anyone to attempt to reproduce the problem.
Install the library
Try to compile graphicstest example
Look at compiler output.
I know this happens with an Nano 33 IOT as the source. I'm trying to use the xpt2046 in 8 bit mode, but that has nothing to do with the library behavior.

Hardware & Software

As mentioned, I'm trying to get this to run on a Nano 33 IOT

Board
Shields / modules used
Arduino IDE version
Teensyduino version
Operating system & version
Any other software or hardware?

Arduino Sketch

// Change the code below by your sketch (please try to give the smallest code which demonstrates the problem)
#include <Arduino.h>

// libraries: give links/details so anyone can compile your code for the same result

void setup() {
}

void loop() {
}

Errors or Incorrect Output

If you see any errors or incorrect output, please show it here. Please use copy & paste to give an exact copy of the message. Details matter, so please show (not merely describe) the actual message or error exactly as it appears.

"Does not work with Teensy or Teensy 2.0+" on arduino mega

Hey,

When I try to upload my arduino sketch with your example "graphicstest", I get the following error:
"Sorry, ILI9341_t3 does not work with Teensy 2.0 or Teensy++ 2.0. Use Adafruit_ILI9341."
I don't really know what Teensy is, but from a quick google search it seems it's some form of board that I don't have. I have a mega 2560 arduino board.

swap clashes with c++ header <functional>

#include "ILI9341_t3.h"
#include <functional>

void setup()
{
}

void loop()
{
}

Does not compile. However, including <functional> before the ILI header works.

The problem is the definition of the swap macro in ILI9341_t3.h which clashes with some definitions in <functional> (and possibly other standard c++ headers)

ILI9341_t3/ILI9341_t3.h

Lines 555 to 559 in ff4bba3

#ifndef swap
#define swap(a, b) { typeof(a) t = a; a = b; b = t; }
#endif

Since the macro is not used in the header you might consider moving its definition to the cpp file to avoid name clashes with other headers.

Also see: https://forum.pjrc.com/threads/59112-TeensyTimerTool?p=246670&viewfull=1#post246670

Library does not work with ILI9341 modules that are natively Landscape, or RGB (vs BGR).

Description

  1. Library does not support ILI9341 modules that are natively landscape (320x240, instead of 240x320).
  2. Library does not support ILI9341 modules that are natively RGB (instead of BGR).

I've submitted a Pull Request to add support for both these: #67

Steps To Reproduce Problem

  1. Buy a cheap knock-off ILI9341 module, such as https://www.ebay.com/itm/324442623660
  2. Use this ILI9341_t3 library to write to it. (Note: Adafruit_ILI9341 has the same problem.)
  3. Run the graphicstest sketch.
  4. Note that in "unrotated" mode, it's printing in Landscape mode. Since the library assumes the display is Portrait, it only uses the left most 240 columns, and the bottom most 80 rows wrap around to the top 80 rows.
  5. Note further that the loop() code, which runs the display through different setRotation() values, has the same problem. That is, calling setRotation() does not fix this problem.

Hardware & Software

Board: Teensy 3.5
Shields / modules used: cheap ILI9341 off eBay: https://www.ebay.com/itm/324442623660
Arduino IDE version: 1.8.16
Teensyduino version: 1.55
Operating system & version: Ubuntu 20.04 LTS, up to date.
Any other software or hardware?

Arduino Sketch

// Change the code below by your sketch (please try to give the smallest code which demonstrates the problem)

/*
 * Use the `graphicstest` sketch that comes with the ILI9341_t3 library.
 */

Errors or Incorrect Output

If you see any errors or incorrect output, please show it here. Please use copy & paste to give an exact copy of the message. Details matter, so please show (not merely describe) the actual message or error exactly as it appears.

None.

Provided solution

#67

Not for Nano ?

I get the Error "Does not work with Teensy ..." but I use a Nano.
Do I miss something ?

Off-by-one bug in readRect

I found that readRect will never read the last pixel.

The below sketch reproduces the problem using the Teensy 3.1, the Adafruit shield and the latest stable Teensyduino.

I fixed it by just incrementing c in readRect, but that's probably not the correct solution.
It seems on the last byte you clear the SR register, which makes the check if there are 3 bytes in the FIFO fail, but not knowing the meaning of all the SPI registers I was unable to quickly see the correct solution.

#include <ILI9341_t3.h> // Hardware-specific library
#include <SPI.h>

#define TFT_DC  9
#define TFT_CS 10
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);

void setup(void) {

  tft.begin();
  tft.fillScreen(ILI9341_BLUE);

  Serial.begin(9600);
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
  tft.println(F("Waiting for Arduino Serial Monitor..."));
  while (!Serial) {
    if (millis() > 8000) break;
  }

  tft.fillScreen(ILI9341_BLUE);


  uint16_t buf[32*32];
  tft.readRect(0, 0, 32, 32, buf);

  for(int i=0; i<32*32;i++) {
    if(buf[i] != ILI9341_BLUE) {
      Serial.print("Error ");
      Serial.print(i);
      Serial.print(" ");
      Serial.print(buf[i], HEX);
    }
  }

}

void loop() {
}

Using your enhanced library with other chips

Hi,
I found your library on
https://forum.pjrc.com/threads/26305-Highly-optimized-ILI9341-(320x240-TFT-color-display)-library?s=0f903ddac2e0f07c2725be15c8738a95
although I have an ESP32 with which I can't get your library to build, mostly due to KINETISK_SPI0 which doesn't exist on the ESP32 arduino emulation layer.
I don't actually really need your faster library that much since ESP32 has a fast ILI9341 already, but I wanted to use your library for the extra functions you've added, and more importantly the new demos you have like pictureEmbed.ino and DemoSauce which don't exist in the adafruit library and won't work with it due to lack of methods in there.
Unless you have a better idea, I think my best bet is to make your library work on ESP32. Would you have a suggestion of how I can replace/revert KINETISK_SPI0 into something more arduino compatible?

ESP8266 Hardware causing compile error due to missing KINETISK_SPI0, SPI_SR_EOQF, etc

Greetings -

I was hoping to use this cool library with the ESP8266 from the Arduino environment (I am using Visual Micro in Visual Studio). The problem I am having is related to a missing declaration (perhaps for different target hardware?) at compile time:

error: 'KINETISK_SPI0' was not declared in this scope
error: 'SPI_SR_EOQF' was not declared in this scope
error: 'SPI_SR_TCF' was not declared in this scope
(and then a ton of related errors)

Can the ESP8266 hardware be used with this ILI9341_t3 library?

thanks

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.