Getting error messages from library

Hello. I am using Adafruit's TFTLCD library to drive a 2.8in ILI9341 display, however when trying to compile my code several errors show up with things that are not in explicitly in my program(excluding libraries), namely errors from the TFTLCD library.

Below is my code:

#include <Adafruit_GFX.h>
#include <Adafruit_TFTLCD.h>
#include <SPI.h>
#include <Keypad.h>
#include <ctype.h> //for keypad, refer to github

#define USE_ADAFRUIT_SHIELD_PINOUT 0

#define LCD_CS 40 //chip select
#define LCD_CD 41 //data in
#define LCD_WR 42 //write
#define LCD_RD 43 //read

#define LCD_RESET 9 //reset pin

#define BLACK 0x0000 //colour definitions, taken from TFTLCD library
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); //display declaration

int modeButton = 36; //shift button, hold-enable, release-disable, separate from main matrix
volatile bool state = false; //init pin state

int modeButton2 = 35; //alpha button, hold-enable, release-disable, separate from main matrix
volatile bool state2 = false; //init pin state

const byte ROWS = 4;
const byte COLS = 4;

char standardKeys[ROWS][COLS] = {
  {'7','8','9','+'},
  {'4','5','6','-'},
  {'1','2','3','/'},
  {'0','.','=','*'}
};

char shiftKeys[ROWS][COLS] = {
  {'sin','cos','tan','+'},
  {'pi','sqrt','pow','-'},
  {'x','y','z','/'},
  {'x10pow','.','=','*'}
};

char alphaKeys[ROWS][COLS] = {
  {'sin-1','cos-1','tan-1','+'},
  {'e','cbsqrt','log','-'},  //'e' for euler's number
  {'a','b','c','/'},
  {'x10pow','.','=','*'}
};

boolean shift = false; // disable shifted and alpha keypads on startup
boolean alpha = false;
boolean standard = true;

byte rowPins[ROWS] = {40, 39, 38, 37};
byte colPins[COLS] = {22, 23, 24, 25};

Keypad stdpad( makeKeymap(standardKeys), rowPins, colPins, sizeof(rowPins), sizeof(colPins) ); //defining keypads for standard, shifted and alpha keys
Keypad shfpad( makeKeymap(shiftKeys), rowPins, colPins, sizeof(rowPins), sizeof(colPins) );
Keypad alhpad( makeKeymap(alphaKeys), rowPins, colPins, sizeof(rowPins), sizeof(colPins) );

unsigned long startTime;

float y; // y=mx+c, linear equation
float m;
float x;
float c;
float a; // ax+bx^2+c, quadratic equation(x and c reused)
float b;

float pi = 3.14159;

int xmin;
int xmax = -xmin;

static const uint8_t PROGMEM boot[] = 
{
//new bmp required for new display
};

void shiftPressed() //shift ISR
  {
    if (digitalRead(20) == HIGH)
      state = true;
    else
      state = false;
  };

void alphaPressed() //alpha ISR
  {
    if (digitalRead(21) == HIGH)
      state2 = true;
    else
      state2 = false;
  };

char key;

void setup() {
  // put your setup code here, to run once:
pinMode(20, INPUT);
pinMode(21, INPUT);

stdpad.begin( makeKeymap(standardKeys) );
shfpad.begin( makeKeymap(shiftKeys) );
alhpad.begin( makeKeymap(alphaKeys) );

stdpad.addEventListener(KeypadEvent(standardKeys));
stdpad.setHoldTime(500);
shfpad.addEventListener(KeypadEvent(shiftKeys));
shfpad.setHoldTime(500);
alhpad.addEventListener(KeypadEvent(alphaKeys));
alhpad.setHoldTime(500);

pinMode(modeButton, INPUT);
attachInterrupt(digitalPinToInterrupt(36), shiftPressed, RISING);

pinMode(modeButton2, INPUT);
attachInterrupt(digitalPinToInterrupt(35), alphaPressed, RISING);

tft.begin(); //automatically assumes ILI9341 driver IC
tft.fillScreen(BLACK); // clear screen
tft.drawXBitmap(0, 0, boot, 240, 320, WHITE); //boot bitmap
delay(1000);
tft.fillScreen(BLACK);

  struct formula
  {
    String sy;
    String sm;
    String sc;
    String sx;
    String sa;//other variables for more complex equations, c already included previously
    String sb;
  };
}

void loop() {
  // put your main code here, to run repeatedly:
  {
    if(state == true); //disable all other keymaps other than activated
      standard = false; 
      alpha = false;
      shift = true;

    if(state2 == true); //disable all other keymaps other than activated
      shift = false; 
      standard = false;
      alpha = true;
    
    if(state && state2 == false); // default, if both shift and alpha keys are disengaged standard mode is enabled
      shift = false;
      alpha = false;
      standard = true;

      if( shift ) {
        key = shfpad.getKey(  );
      if( alpha )
        key = alhpad.getKey(  );
      else
        key = stdpad.getKey(  );
    };
  }    
}


and here are the errors I am getting when verifying:

In file included from c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:17:0:
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\pin_magic.h:467:2: error: #error "Board type unsupported / not recognized"
 #error "Board type unsupported / not recognized"
  ^~~~~
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp: In member function 'void Adafruit_TFTLCD::write8(uint8_t)':
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:1102:47: error: 'write8inline' was not declared in this scope
 void Adafruit_TFTLCD::write8(uint8_t value) { write8inline(value); }
                                               ^~~~~~~~~~~~
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:1102:47: note: suggested alternative: 'writeLine'
 void Adafruit_TFTLCD::write8(uint8_t value) { write8inline(value); }
                                               ^~~~~~~~~~~~
                                               writeLine
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp: In member function 'uint8_t Adafruit_TFTLCD::read8fn()':
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:1108:3: error: 'read8inline' was not declared in this scope
   read8inline(result);
   ^~~~~~~~~~~
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:1108:3: note: suggested alternative: 'read8fn'
   read8inline(result);
   ^~~~~~~~~~~
   read8fn
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp: In member function 'void Adafruit_TFTLCD::setWriteDir()':
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:1114:43: error: 'setWriteDirInline' was not declared in this scope
 void Adafruit_TFTLCD::setWriteDir(void) { setWriteDirInline(); }
                                           ^~~~~~~~~~~~~~~~~
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:1114:43: note: suggested alternative: 'setWriteDir'
 void Adafruit_TFTLCD::setWriteDir(void) { setWriteDirInline(); }
                                           ^~~~~~~~~~~~~~~~~
                                           setWriteDir
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp: In member function 'void Adafruit_TFTLCD::setReadDir()':
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:1118:42: error: 'setReadDirInline' was not declared in this scope
 void Adafruit_TFTLCD::setReadDir(void) { setReadDirInline(); }
                                          ^~~~~~~~~~~~~~~~
c:\Users\user\OneDrive\Documents\Arduino\libraries\Adafruit_TFTLCD_Library\Adafruit_TFTLCD.cpp:1118:42: note: suggested alternative: 'setReadDir'
 void Adafruit_TFTLCD::setReadDir(void) { setReadDirInline(); }
                                          ^~~~~~~~~~~~~~~~
                                          setReadDir

exit status 1

Compilation error: exit status 1

How do I fix these errors? For context, I am attempting to make a calculator with a 1284P as its core using said display, hence the need for the Keypad and TFTLCD libraries. Any help would be greatly appreciated.

Yes, it are the errors from the library, but it closely related to your code and configuration. Look at the error message below:

it obviously means that the library dot not support the 1284P controller,

1 Like

Is there any workaround for this(apart from replacing the controller)?
The description for the TFTLCD library from Adafruit does say the following:

This library is compatible with all architectures so you should be able to use it on all the Arduino boards.

The 1284P uses a Harvard architecture, same as the 328p.(it is not an ARM controller by any means).

You could modify the library to support your controller, or look for a library that already does support that controller.

1 Like

What's board do you selected in the Arduino IDE when compile the code?

I haven't selected a board, I have selected a microcontroller with the MightyCore index. The 1284P is not officially part of a board yet.

I think it is a key moment.

The library does not support architectures, but specific controllers. Below is the list of AVR mcu supported:

#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) ||               \
    defined(__AVR_ATmega328__) || defined(__AVR_ATmega8__)


#elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) ||            \
    defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)


#elif defined(__AVR_ATmega32U4__)

You could add your controller, if you know which of these groups it is compatible with.

But take the note, that you need a register compatibility rather than by architecture.

I haven't selected a board,

The Arduino IDE requires you to select a board, and that board must have an MCU supported by the particular library you have chosen.

For some Arduino cores, "board" and "processor type" can be considered roughly equivalent terms.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.