code explanation on a: http: 3.5inch_SPI_Module_ILI9488

//could someone please explain this section of code: I
//http://www.lcdwiki.com/3.5inch_SPI_Module_ILI9488_SKU:MSP3520#top=============================================================================
// do i comment out one area for a teensy 4.1 and a different for 3.6?
// I will start coding on a 3.6 and move it over to a 4.1 when I have it working

//display ILI9488 9488_colortest=============================================================================

#include <ILI9488_t3.h>
#include <ILI9488_t3_font_Arial.h>
#include <ILI9488_t3_font_ArialBold.h>
//#define TEENSY64

#if defined(__MK66FX1M0__) && !defined(TEENSY64) // this line
#define TFT_RST 255
#define TFT_DC 20
#define TFT_CS 21
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);

#elif defined(__IMXRT1052__) || defined(__IMXRT1062__) // this line
// On Teensy 4 beta with Paul's breakout out:
// Using pins (MOSI, MISO, SCK which are labeled on Audio board breakout location
// which are not in the Normal processor positions
// Also DC=10(CS), CS=9(BCLK) and RST 23(MCLK)
#define TFT_RST 23
#define TFT_DC 9
#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);

#elif defined(TEENSY64) // this line
#define TFT_RST 255
#define TFT_DC 20
#define TFT_CS 21
#define TFT_SCK 14
#define TFT_MISO 39
#define TFT_MOSI 28
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);
#else
#error "This example App will only work with Teensy 3.6 or Teensy 4."
#endif
//=============================================================================
// Setup
//=============================================================================
 
TEENSY64 is a Commodore C64 emulation that runs on T3.6, by Frank Boesing. If you are running that emulation you would un-comment the #define TEENSY64. After that, the conditional logic means:

Code:
if (T3.6 and NOT running TEENSY64)
    use these T3.6 pins
else if (T4.x)
    use these normal T4.x pins
else if (TEENSY64)
    use these special pin assignments
else
    error
 
Last edited:
so this would be the correct setup?:
//http://www.lcdwiki.com/3.5inch_SPI_Module_ILI9488_SKU:MSP3520#top=============================================================================
//display ILI9488 9488_colortest=============================================================================

#include <ILI9488_t3.h>
#include <ILI9488_t3_font_Arial.h>
#include <ILI9488_t3_font_ArialBold.h>
//#define TEENSY64

#if defined(__MK66FX1M0__) && !defined(TEENSY64)
#define TFT_RST 255//*****************************is this a typo?
#define TFT_DC 20
#define TFT_CS 21
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);

#elif defined(__IMXRT1052__) || defined(__IMXRT1062__)
// On Teensy 4 beta with Paul's breakout out:
// Using pins (MOSI, MISO, SCK which are labeled on Audio board breakout location
// which are not in the Normal processor positions
// Also DC=10(CS), CS=9(BCLK) and RST 23(MCLK)
#define TFT_RST 23
#define TFT_DC 9
#define TFT_CS 10
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
/*
#elif defined(TEENSY64)
#define TFT_RST 255
#define TFT_DC 20
#define TFT_CS 21
#define TFT_SCK 14
#define TFT_MISO 39
#define TFT_MOSI 28
ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);
*/
#else
#error "This example App will only work with Teensy 3.6 or Teensy 4."
#endif
//=============================================================================
// Setup
 
Reset of 255 means you are not using a reset pin. You should then wire any reset pin on the display to 3.3v
on the 3.6 it helps to have the DC/CS pins on hardware CS pins. Which 20 and 21 are.

On t4.x it might help a little if DC is on an hardware CS pin. Pin 10 is one, which the code looks like it is using for CS 9 it shows for DC is not
But again the gains are not as dramatic on the T4.x for this.
 
Back
Top