ILI9488_t3 Library 'ambiguous' error?

smarrocco

Active member
I using two ILI9488 display wia two hardware SPI connections on a Teensy 4.1. Creating two instances (one for each display) fails when providing the first display constructor with #define'd pins numbers, but fails for the second display. It will succeed if I provide the constructor with actual variables.

Can anyone provide a clue as to why this would be happening? I've provided a simple source example below. Uncommand any one of the three lines for "second display" to see the results after a compile.

C++:
#include "ILI9488_t3.h"
#include "ILI9488_t3_font_Arial.h"

// TFT1/LCD1
#define TFT1__RST        2       
#define TFT1__DC        15       
#define TFT1__SPI0_CS    10   
#define TFT1__SPI0_SCLK 13   
#define TFT1__SPI0_MOSI    11   
#define TFT1__SPI0_MISO    12

// TFT2/LCD2
#define TFT2__RST        4       
#define TFT2__DC        5       
#define TFT2__SPI1_CS    0   
#define TFT2__SPI1_SCLK 27   
#define TFT2__SPI1_MOSI 26   
#define TFT2__SPI1_MISO 1

uint8_t a =                0;
uint8_t b =                5;
uint8_t c =                4;
uint8_t d =                26;
uint8_t e =                27;
uint8_t f =                1;



//FIRST DISPLAY: Successfully compiles for single display
ILI9488_t3 tft1 = ILI9488_t3(TFT1__SPI0_CS, TFT1__DC, TFT1__RST, TFT1__SPI0_MOSI, TFT1__SPI0_SCLK, TFT1__SPI0_MISO);

//SECOND DISPLAY: This line fails to compile for second display with 'ambiguous' error.
ILI9488_t3 tft2 = ILI9488_t3(TFT2__SPI1_CS, TFT2__DC, TFT2__RST, TFT2__SPI1_MOSI, TFT2__SPI1_SCLK, TFT2__SPI1_MISO);

//SECOND DISPLAY: This line successfully compiles for second display
//ILI9488_t3 tft2 = ILI9488_t3(a, TFT2__DC, TFT2__RST, TFT2__SPI1_MOSI, TFT2__SPI1_SCLK, TFT2__SPI1_MISO);

//SECOND DISPLAY: This line successfully compiles for second display
//ILI9488_t3 tft2 = ILI9488_t3(a, b, c, d, e, f);


void setup() {
}

void loop() {
}
 
The issue is: #define TFT2__SPI1_CS 0

And the compiler is not sure if this specifies 0 for a CS pin or 0 for pointer to SPI object... (nullptr),

Simple work around:
Code:
ILI9488_t3 tft2 = ILI9488_t3((uint8_t)TFT2__SPI1_CS, TFT2__DC, TFT2__RST, TFT2__SPI1_MOSI, TFT2__SPI1_SCLK, TFT2__SPI1_MISO);

That tells the compiler that it is not a pointer...
 
Understood KurtE. I'm no compiler expert, but shouldn't the error have also happened for the first tft1, since it also does not have a cast to an uint8_t for the first argument to it's constructor?
 
My guess is it only is an issue for the value 0.
The other one was 10, which it assumed was not a pointer....

But like you I am not a compiler expert, just a user of the compilers...
 
Your 'guess' was correct. If I changed the value of 0 to another pin number (non-zero) then the original constructor works, as did the casting of the original #define value of 0 that was being seen as a pointer.
Thank you for the suggestions.
 
Back
Top