The ILI9431 display I am using is like the Adafruit 1774 display. I have my own carrier board for the Teensy that the display module connects to.
The display itself is connected as:
Code:
#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 23
#define TFT_LITE 22
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST);
The touchscreen part is connected as:
Code:
#define YP A6 // must be an analog pin, use "An" notation!
#define XM A3 // must be an analog pin, use "An" notation!
#define YM 16 // can be a digital pin
#define XP 21 // can be a digital pin
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
I just retested the original Teensy 3.2 code using the 1.8.13 compiler on my home system. It works perfectly.
I then tried changing the board type to Teensy 4.0 but the code does not compile correctly. I'm getting some odd errors which lead me down the path of updating the ILI9341_t3 and Touchscreen libraries before:
Code:
Arduino: 1.8.13 (Linux), TD: 1.53, Board: "Teensy 4.0, Raw HID, 600 MHz, Faster, US English"
/tmp/arduino_build_782512/sketch/TouchScreen.cpp: In constructor 'TouchScreen::TouchScreen(uint8_t, uint8_t, uint8_t, uint8_t, uint16_t)':
TouchScreen.cpp:42: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'RwReg* {aka volatile unsigned char*}' in assignment
xp_port = portOutputRegister(digitalPinToPort(_xp));
^
TouchScreen.cpp:43: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'RwReg* {aka volatile unsigned char*}' in assignment
yp_port = portOutputRegister(digitalPinToPort(_yp));
^
TouchScreen.cpp:44: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'RwReg* {aka volatile unsigned char*}' in assignment
xm_port = portOutputRegister(digitalPinToPort(_xm));
^
TouchScreen.cpp:45: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'RwReg* {aka volatile unsigned char*}' in assignment
ym_port = portOutputRegister(digitalPinToPort(_ym));
^
In file included from /home/bigguiness/Arduino/test/test.ino:12:0:
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoNotFull()':
ILI9341_t3.h:345: error: 'KINETISK_SPI0' was not declared in this scope
sr = KINETISK_SPI0.SR;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoEmpty()':
ILI9341_t3.h:354: error: 'KINETISK_SPI0' was not declared in this scope
sr = KINETISK_SPI0.SR;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::waitTransmitComplete()':
ILI9341_t3.h:362: error: 'KINETISK_SPI0' was not declared in this scope
while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done
^
ILI9341_t3.h:362: error: 'SPI_SR_TCF' was not declared in this scope
while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done
^
ILI9341_t3.h:363: error: 'KINETISK_SPI0' was not declared in this scope
tmp = KINETISK_SPI0.POPR; // drain the final RX FIFO word
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::waitTransmitComplete(uint32_t)':
ILI9341_t3.h:370: error: 'KINETISK_SPI0' was not declared in this scope
uint32_t sr = KINETISK_SPI0.SR;
^
ILI9341_t3.h:371: error: 'SPI_SR_EOQF' was not declared in this scope
if (sr & SPI_SR_EOQF) break; // wait for last transmit
^
ILI9341_t3.h:374: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.SR = SPI_SR_EOQF;
^
ILI9341_t3.h:374: error: 'SPI_SR_EOQF' was not declared in this scope
KINETISK_SPI0.SR = SPI_SR_EOQF;
^
ILI9341_t3.h:375: error: 'SPI0_MCR' was not declared in this scope
SPI0_MCR = mcr;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_cont(uint8_t)':
ILI9341_t3.h:382: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:382: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:382: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_last(uint8_t)':
ILI9341_t3.h:388: error: 'SPI0_MCR' was not declared in this scope
uint32_t mcr = SPI0_MCR;
^
ILI9341_t3.h:389: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:389: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:389: error: 'SPI_PUSHR_EOQ' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_cont(uint8_t)':
ILI9341_t3.h:395: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:395: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:395: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_last(uint8_t)':
ILI9341_t3.h:401: error: 'SPI0_MCR' was not declared in this scope
uint32_t mcr = SPI0_MCR;
^
ILI9341_t3.h:402: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:402: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:402: error: 'SPI_PUSHR_EOQ' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_cont(uint16_t)':
ILI9341_t3.h:408: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:408: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:408: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_last(uint16_t)':
ILI9341_t3.h:414: error: 'SPI0_MCR' was not declared in this scope
uint32_t mcr = SPI0_MCR;
^
ILI9341_t3.h:415: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:415: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:415: error: 'SPI_PUSHR_EOQ' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_EOQ;
^
In file included from /tmp/arduino_build_782512/sketch/ILI9341_t3.cpp:84:0:
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoNotFull()':
ILI9341_t3.h:345: error: 'KINETISK_SPI0' was not declared in this scope
sr = KINETISK_SPI0.SR;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoEmpty()':
ILI9341_t3.h:354: error: 'KINETISK_SPI0' was not declared in this scope
sr = KINETISK_SPI0.SR;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::waitTransmitComplete()':
ILI9341_t3.h:362: error: 'KINETISK_SPI0' was not declared in this scope
while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done
^
ILI9341_t3.h:362: error: 'SPI_SR_TCF' was not declared in this scope
while (!(KINETISK_SPI0.SR & SPI_SR_TCF)) ; // wait until final output done
^
ILI9341_t3.h:363: error: 'KINETISK_SPI0' was not declared in this scope
tmp = KINETISK_SPI0.POPR; // drain the final RX FIFO word
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::waitTransmitComplete(uint32_t)':
ILI9341_t3.h:370: error: 'KINETISK_SPI0' was not declared in this scope
uint32_t sr = KINETISK_SPI0.SR;
^
ILI9341_t3.h:371: error: 'SPI_SR_EOQF' was not declared in this scope
if (sr & SPI_SR_EOQF) break; // wait for last transmit
^
ILI9341_t3.h:374: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.SR = SPI_SR_EOQF;
^
ILI9341_t3.h:374: error: 'SPI_SR_EOQF' was not declared in this scope
KINETISK_SPI0.SR = SPI_SR_EOQF;
^
ILI9341_t3.h:375: error: 'SPI0_MCR' was not declared in this scope
SPI0_MCR = mcr;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_cont(uint8_t)':
ILI9341_t3.h:382: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:382: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:382: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writecommand_last(uint8_t)':
ILI9341_t3.h:388: error: 'SPI0_MCR' was not declared in this scope
uint32_t mcr = SPI0_MCR;
^
ILI9341_t3.h:389: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:389: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:389: error: 'SPI_PUSHR_EOQ' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_cont(uint8_t)':
ILI9341_t3.h:395: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:395: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:395: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata8_last(uint8_t)':
ILI9341_t3.h:401: error: 'SPI0_MCR' was not declared in this scope
uint32_t mcr = SPI0_MCR;
^
ILI9341_t3.h:402: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:402: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:402: error: 'SPI_PUSHR_EOQ' was not declared in this scope
KINETISK_SPI0.PUSHR = c | (_pcs_data << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_EOQ;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_cont(uint16_t)':
ILI9341_t3.h:408: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:408: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
ILI9341_t3.h:408: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_CONT;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.h: In member function 'void ILI9341_t3::writedata16_last(uint16_t)':
ILI9341_t3.h:414: error: 'SPI0_MCR' was not declared in this scope
uint32_t mcr = SPI0_MCR;
^
ILI9341_t3.h:415: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:415: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_EOQ;
^
ILI9341_t3.h:415: error: 'SPI_PUSHR_EOQ' was not declared in this scope
KINETISK_SPI0.PUSHR = d | (_pcs_data << 16) | SPI_PUSHR_CTAS(1) | SPI_PUSHR_EOQ;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.cpp: In member function 'uint8_t ILI9341_t3::readcommand8(uint8_t, uint8_t)':
ILI9341_t3.cpp:1358: error: 'KINETISK_SPI0' was not declared in this scope
while (((KINETISK_SPI0.SR) & (15 << 12)) && (--wTimeout)) ; // wait until empty
^
ILI9341_t3.cpp:1361: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.SR = SPI_SR_TCF; // dlear it out;
^
ILI9341_t3.cpp:1361: error: 'SPI_SR_TCF' was not declared in this scope
KINETISK_SPI0.SR = SPI_SR_TCF; // dlear it out;
^
ILI9341_t3.cpp:1372: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = 0xD9 | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
ILI9341_t3.cpp:1372: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = 0xD9 | (_pcs_command << 16) | SPI_PUSHR_CTAS(0) | SPI_PUSHR_CONT;
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.cpp: In member function 'uint16_t ILI9341_t3::readPixel(int16_t, int16_t)':
ILI9341_t3.cpp:1418: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = 0 | (_pcs_data << 16) | SPI_PUSHR_CTAS(0)| SPI_PUSHR_CONT;
^
ILI9341_t3.cpp:1418: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = 0 | (_pcs_data << 16) | SPI_PUSHR_CTAS(0)| SPI_PUSHR_CONT;
^
ILI9341_t3.cpp:1418: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = 0 | (_pcs_data << 16) | SPI_PUSHR_CTAS(0)| SPI_PUSHR_CONT;
^
ILI9341_t3.cpp:1423: error: 'SPI_PUSHR_EOQ' was not declared in this scope
KINETISK_SPI0.PUSHR = 0 | (_pcs_data << 16) | SPI_PUSHR_CTAS(0)| SPI_PUSHR_EOQ;
^
ILI9341_t3.cpp:1426: error: 'SPI_SR_EOQF' was not declared in this scope
while ((KINETISK_SPI0.SR & SPI_SR_EOQF) == 0) ;
^
ILI9341_t3.cpp:1427: error: 'SPI_SR_EOQF' was not declared in this scope
KINETISK_SPI0.SR = SPI_SR_EOQF; // make sure it is clear
^
/tmp/arduino_build_782512/sketch/ILI9341_t3.cpp: In member function 'void ILI9341_t3::readRect(int16_t, int16_t, int16_t, int16_t, uint16_t*)':
ILI9341_t3.cpp:1451: error: 'KINETISK_SPI0' was not declared in this scope
KINETISK_SPI0.PUSHR = 0 | (_pcs_data << 16) | SPI_PUSHR_CTAS(0)| SPI_PUSHR_CONT | SPI_PUSHR_EOQ;
^
ILI9341_t3.cpp:1451: error: 'SPI_PUSHR_CTAS' was not declared in this scope
KINETISK_SPI0.PUSHR = 0 | (_pcs_data << 16) | SPI_PUSHR_CTAS(0)| SPI_PUSHR_CONT | SPI_PUSHR_EOQ;
^
ILI9341_t3.cpp:1451: error: 'SPI_PUSHR_CONT' was not declared in this scope
KINETISK_SPI0.PUSHR = 0 | (_pcs_data << 16) | SPI_PUSHR_CTAS(0)| SPI_PUSHR_CONT | SPI_PUSHR_EOQ;
^
ILI9341_t3.cpp:1451: error: 'SPI_PUSHR_EOQ' was not declared in this scope
KINETISK_SPI0.PUSHR = 0 | (_pcs_data << 16) | SPI_PUSHR_CTAS(0)| SPI_PUSHR_CONT | SPI_PUSHR_EOQ;
^
ILI9341_t3.cpp:1452: error: 'SPI_SR_EOQF' was not declared in this scope
while ((KINETISK_SPI0.SR & SPI_SR_EOQF) == 0) ;
^
ILI9341_t3.cpp:1453: error: 'SPI_SR_EOQF' was not declared in this scope
KINETISK_SPI0.SR = SPI_SR_EOQF; // make sure it is clear
^
cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'RwReg* {aka volatile unsigned char*}' in assignment
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
But the updated libraries are giving my the multiple press/release codes.
Any ideas?