Git Product home page Git Product logo

adafruit_hx8357_library's Introduction

Adafruit HX8357 Arduino Library Build StatusDocumentation

This is a library for the Adafruit HX8357 display products

This library works with the Adafruit 3.5" Breakout

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

Recent Arduino IDE releases include the Library Manager for easy installation. Otherwise, to download, click the DOWNLOAD ZIP button, uncompress and rename the uncompressed folder Adafruit_HX8357. Confirm that the Adafruit_HX8357 folder contains Adafruit_HX8357.cpp and Adafruit_HX8357.h. Place the Adafruit_HX8357 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.

adafruit_hx8357_library's People

Contributors

astromonkee avatar blitzcitydiy avatar chuckvanzant avatar driverblock avatar evaherrada avatar hathach avatar ifullgaz avatar kealper avatar ladyada avatar makermelissa avatar paintyourdragon avatar siddacious avatar tdicola avatar tyeth 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_hx8357_library's Issues

Compatiblity with Adafruit Feather M0

Trying to use the board with the Feather M0 and having these compile issues (using the latest library dated today):

Arduino: 1.6.8 (Windows 10), Board: "Adafruit Feather M0 (Native USB Port)"

C:\Users\tygris\Documents\Arduino\libraries\Adafruit_HX8357\Adafruit_HX8357.cpp: In constructor 'Adafruit_HX8357::Adafruit_HX8357(int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)':

C:\Users\tygris\Documents\Arduino\libraries\Adafruit_HX8357\Adafruit_HX8357.cpp:30:3: error: '_cs' was not declared in this scope

   _cs   = cs;

   ^


exit status 1
Error compiling for board Adafruit Feather M0 (Native USB Port).

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

how to check for attached boards by "board type names"?

in your example you check for attached boards via board names, e.g.

#ifdef ESP8266
   #define STMPE_CS 16
   #define TFT_CS   0
   #define TFT_DC   15
   #define SD_CS    2
#endif
#ifdef ESP32
   #define STMPE_CS 32
   #define TFT_CS   15
   #define TFT_DC   33
   #define SD_CS    14
#endif
#ifdef TEENSYDUINO
   #define TFT_DC   10
   #define TFT_CS   4
   #define STMPE_CS 3
   #define SD_CS    8
#endif
#ifdef ARDUINO_STM32_FEATHER
   #define TFT_DC   PB4
   #define TFT_CS   PA15
   #define STMPE_CS PC7
   #define SD_CS    PC5
#endif
#ifdef ARDUINO_FEATHER52
   #define STMPE_CS 30
   #define TFT_CS   13
   #define TFT_DC   11
   #define SD_CS    27
#endif
#if defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)
   #define TFT_DC   P5_4
   #define TFT_CS   P5_3
   #define STMPE_CS P3_3
   #define SD_CS    P3_2
#endif

// Anything else!
#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__) || defined(__SAM3X8E__)
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5
#endif

Unfortunately, some of my boards cannot be detected, i.e. my Adafruit Itsybitsy M0. For Feather Huzzah (esp8266) and Feather M4 it works well though.
How can I determine the board type name, in case also other ones still not being checked yet?

How to increase SPI clock speed for HX8357?

How to increase SPI clock speed for HX8357?
The Graphics output is too slow for my purposes.
I am using Arduino IDE 1.8.8 and the Feather M4 and the Feather ESP32 with this Featherwing HX8357 display.

Add support for Arduino Uno R4 Wifi and Minima boards

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

TFT_CS for NRF52832_FEATHER is incorrect in some samples

  • Arduino board: Adafruit Feather nRF52 Bluefruit LE - nRF52832

  • Arduino IDE version: 1.8.10

The samples gfxbuttontest_feather.ino, graphicstest_featherwing.ino, and touchpaint_featherwing.ino incorrectly have TFT_CS defined to 13. It should be 31.

bitmapdraw_featherwing has it correctly defined as 31.

very simple touch button example needed

Still a very simple touch button example is needed as the provided source codes are not understandable for a beginner to touch screen (e.g., as they are overloaded with extra features like menu arrays).

I tried with the following code, but release button is not detected (ts.justReleased() ):

after having touched (ts.justPressed() ) and lifting the finger, the button still stays in "pressed" mode,
one has to touch anywhere else on the screen apart from the button and only after that the button release is detected.

Instead, wishful would be:
detect the first button strike (button just pressed, "button down"),
wait without delay (non-blocking the running code) while the button is pressed
... until button is just released ("button up"),
and then proceed with the arbitrary button strike action (move a cursor, scroll a menu, reset values, what else).

// TFT HX8357:  Adafruit_HX8357.h
// Touchscreen: Adafruit_STMPE610.h

// Programming language: Arduino Sketch C/C++ (IDE 1.8.8)

#include <SPI.h>
#include <Wire.h>
#include <SPI.h>

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_HX8357.h>
#include <Adafruit_STMPE610.h>



#ifdef ESP8266
   #define STMPE_CS 16
   #define TFT_CS   0
   #define TFT_DC   15
   #define SD_CS    2
 
#elif defined ESP32
   #define STMPE_CS 32
   #define TFT_CS   15
   #define TFT_DC   33
   #define SD_CS    14
   
#elif defined ARDUINO_FEATHER52
   #define STMPE_CS 30
   #define TFT_CS   13
   #define TFT_DC   11
   #define SD_CS    27

// Something else!
#elif  defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__)   
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5

 // default 
#else
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5
#endif

//-------------------------------------------------------------------------
#define TFT_RST -1

Adafruit_HX8357   tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
Adafruit_STMPE610  ts = Adafruit_STMPE610(STMPE_CS);


//-------------------------------------------------------------------------
// Touch Calibration
/*
#define TS_MINX 3800
#define TS_MAXX 100
#define TS_MINY 100
#define TS_MAXY 3750
*/
#define TS_MINX 100
#define TS_MAXX 3800
#define TS_MINY 3750
#define TS_MAXY 100

 /*
 #define TS_MINX 150
 #define TS_MINY 130
 #define TS_MAXX 3800
 #define TS_MAXY 4000 
*/

//-------------------------------------------------------------------------
Adafruit_GFX_Button button1 /*, button2*/ ;

//-------------------------------------------------------------------------
/*
int16_t  RADMAX=4;
int16_t  offsx=RADMAX, offsy=0;
int16_t  canvasx=400-1, canvasy=320-offsy-1;
*/

#define BLACK       HX8357_BLACK
#define DARKGREY    HX8357_DARKGREY 
#define WHITE       HX8357_WHITE
#define RED         HX8357_RED
#define YELLOW      HX8357_YELLOW
#define CYAN        HX8357_CYAN
#define BLUE        HX8357_BLUE

#define COLOR_BKGR  WHITE // DARKGREY



//-------------------------------------------------------------------------
//-------------------------------------------------------------------------

void setup() {
  int i;

  Wire.begin();
  
  Serial.begin(115200);
  delay(1000);
   
  tft.begin(HX8357D);   
  tft.setRotation(1);
  tft.fillScreen(COLOR_BKGR);
  tft.setTextSize(2);
  
  if (!ts.begin()) {
    Serial.println("Couldn't start touchscreen controller");
    while (1);
  }
  Serial.println("Touchscreen started");   
  
  // create button
  button1.initButton(&tft, tft.width()-40, 20, 70, 40, CYAN, BLUE, YELLOW, "Reset", 2);
  button1.drawButton();  
  
}



//-------------------------------------------------------------------------
//-------------------------------------------------------------------------

void loop() {
  int i;
  float fyaw, fpitch, froll;
  char buf[20]="", buf1[20]="";
     
  TS_Point p;
  p.x=-1; p.y=-1;
  
  // Retrieve a point   
  p = ts.getPoint();
  
  // 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("X = "); Serial.print(p.x); Serial.print("\tY = "); Serial.print(p.y);  Serial.print("\tPressure = "); Serial.println(p.z);           
    Serial.println();    
    sprintf(buf, "x=%3d", p.x); sprintf(buf1, "y=%3d", p.y);
    
    tft.setTextColor(RED); 
    tft.fillRect(tft.width()-80,40, 80,40, COLOR_BKGR);  // x1,y1, dx,dy 
    tft.setCursor(tft.width()-75,40);    tft.print(buf);
    tft.setCursor(tft.width()-75,60);    tft.print(buf1);         
  
  button1.press(button1.contains(p.x, p.y)); // tell the button it is pressed
  delay(1);
  
  // ask the buttons if their state has changed 
  if (button1.justPressed()) {
     button1.drawButton(true); // draw invert! 
     tft.setTextColor(RED);    
     tft.fillRect(tft.width()-80,80, 80,40, COLOR_BKGR);  
     tft.setCursor(tft.width()-75, 80);    tft.print("just");
     tft.setCursor(tft.width()-75,100);    tft.print("press");
  }

  if (button1.justReleased() ) {
     tft.fillScreen(COLOR_BKGR);   
     button1.drawButton(); // draw normal 
     tft.setTextColor(RED);    
     tft.fillRect(tft.width()-80,80, 80,40, COLOR_BKGR); 
     tft.setCursor(tft.width()-75, 80);    tft.print("just");
     tft.setCursor(tft.width()-75,100);    tft.print("releas");
    
  }

 
  delay(1);  

}


merged-in touch button example; not working for Feather M4

re: merged-in touch button example; not working for Feather M4
#12 (comment)
(edit: regrettably this issue was locked so I could not respond there)

Thanks for merging in the touch button example #15
nonetheless, my Feather M4 board could not be detected and thus the code could not be compiled because of missing board #defines and mis-spelling TFT-pin macros (partialy spelled lower-case instead of upper-case) .

Instead, this fix works for my Feather M4:


/*
 * gfxbuttontest_featherwing
 */

#include <SPI.h>
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_HX8357.h>
#include <Adafruit_STMPE610.h>



#ifdef ESP8266
   #define STMPE_CS 16
   #define TFT_CS   0
   #define TFT_DC   15
   #define SD_CS    2
 
#elif defined ESP32
   #define STMPE_CS 32
   #define TFT_CS   15
   #define TFT_DC   33
   #define SD_CS    14
 
#elif defined TEENSYDUINO
   #define TFT_DC   10
   #define TFT_CS   4
   #define STMPE_CS 3
   #define SD_CS    8
  
#elif defined ARDUINO_STM32_FEATHER
   #define TFT_DC   PB4
   #define TFT_CS   PA15
   #define STMPE_CS PC7
   #define SD_CS    PC5
  
#elif defined ARDUINO_FEATHER52
   #define STMPE_CS 30
   #define TFT_CS   13
   #define TFT_DC   11
   #define SD_CS    27

#elif  defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)
   #define TFT_DC   P5_4
   #define TFT_CS   P5_3
   #define STMPE_CS P3_3
   #define SD_CS    P3_2

// Something else!
#elif  defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__)   
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5

 // optional different defaults 
#else
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5
#endif


#define TFT_RST -1


// Use hardware SPI and the above for CS/DC
Adafruit_HX8357  tft = Adafruit_HX8357( TFT_CS,  TFT_DC,  TFT_RST);
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);

// This is calibration data for the raw touch data to the screen coordinates
// For rotation 1, these put the buttons at the top of the screen
#define TS_MINX 3800
#define TS_MAXX 100
#define TS_MINY 100
#define TS_MAXY 3750

// Redefine original colors, add additional colors to match those available with the ILI9341 library
#define HX8357_BLACK       0x0000  ///<   0,   0,   0
#define HX8357_NAVY        0x000F  ///<   0,   0, 123
#define HX8357_DARKGREEN   0x03E0  ///<   0, 125,   0
#define HX8357_DARKCYAN    0x03EF  ///<   0, 125, 123
#define HX8357_MAROON      0x7800  ///< 123,   0,   0
#define HX8357_PURPLE      0x780F  ///< 123,   0, 123
#define HX8357_OLIVE       0x7BE0  ///< 123, 125,   0
#define HX8357_LIGHTGREY   0xC618  ///< 198, 195, 198
#define HX8357_DARKGREY    0x7BEF  ///< 123, 125, 123
#define HX8357_BLUE        0x001F  ///<   0,   0, 255
#define HX8357_GREEN       0x07E0  ///<   0, 255,   0
#define HX8357_CYAN        0x07FF  ///<   0, 255, 255
#define HX8357_RED         0xF800  ///< 255,   0,   0
#define HX8357_MAGENTA     0xF81F  ///< 255,   0, 255
#define HX8357_YELLOW      0xFFE0  ///< 255, 255,   0
#define HX8357_WHITE       0xFFFF  ///< 255, 255, 255
#define HX8357_ORANGE      0xFD20  ///< 255, 165,   0
#define HX8357_GREENYELLOW 0xAFE5  ///< 173, 255,  41
#define HX8357_PINK        0xFC18  ///< 255, 130, 198

// UI Buttondetails
#define BUTTON_X 40
#define BUTTON_Y 40
#define BUTTON_W 80
#define BUTTON_H 80
#define BUTTON_TEXTSIZE 2
#define DISPLAY_XOFFSET 80
#define DISPLAY_TEXTOFFSET 90
#define DISPLAY_YOFFSET 0

enum ButtonName {
  BTN_UP,
  BTN_SELECT,
  BTN_DOWN,
  BTN_RETURN
};

#define MENU1_BTN_CNT 4
Adafruit_GFX_Button Menu1Buttons[MENU1_BTN_CNT];
char Menu1Labels[MENU1_BTN_CNT][5] = {"Up", "Sel", "Down", "Ret"};
uint16_t Menu1Colors[MENU1_BTN_CNT] = {HX8357_DARKGREY, HX8357_DARKGREY, 
                               HX8357_DARKGREY, HX8357_DARKGREY};

#define MENU2_BTN_CNT 4
Adafruit_GFX_Button Menu2Buttons[MENU2_BTN_CNT];
char Menu2Labels[MENU2_BTN_CNT][5] = {"Up", "Sel", "Down", "Ret"};
uint16_t Menu2Colors[MENU2_BTN_CNT] = {HX8357_BLUE, HX8357_BLUE, 
                               HX8357_BLUE, HX8357_BLUE};

int textSize = 2;
int textColorIndex = 0;
uint16_t textColor[7] = {
 HX8357_WHITE,
 HX8357_RED,
 HX8357_GREEN,
 HX8357_BLUE,
 HX8357_CYAN,
 HX8357_MAGENTA,
 HX8357_YELLOW
};

//-------------------------------------------------------------------------
void setTextColorIndex(int updown) {
    textColorIndex += updown;
    if (textColorIndex > 6)  
        textColorIndex = 0;
    else if (textColorIndex < 0)
        textColorIndex = 6;
     tft.setTextColor(textColor[textColorIndex]);
}

//-------------------------------------------------------------------------
void setTextSizeIndex(int updown) {
    textSize += updown;
    if (textSize > 3)  
        textSize = 1;
    else if (textSize < 1)
        textSize = 3;
     tft.setTextSize(textSize);
}

//-------------------------------------------------------------------------
bool initializeButtons(
            Adafruit_GFX_Button menuButtons[], 
            uint16_t menuColors[], 
            char menuLabels[][5], 
            int menuButtonCount) {
     tft.fillScreen(HX8357_BLACK);

    for (uint8_t row=0; row<menuButtonCount; row++) 
    {
        menuButtons[row].initButton(& tft, 
            BUTTON_X, 
            BUTTON_Y + row *(BUTTON_H),    
            BUTTON_W, 
            BUTTON_H, 
            HX8357_BLACK, 
            menuColors[row], 
            HX8357_WHITE,
            menuLabels[row], BUTTON_TEXTSIZE);    
        menuButtons[row].drawButton();
    }
    return true;
}

//-------------------------------------------------------------------------
void tftSetCenterCursor(String str, int16_t xIn, int16_t yIn) {
  int16_t xText, yText;
  uint16_t w, h;  
  
    tft.getTextBounds(str, 0, 0, &xText, &yText, &w, &h);
    tft.setCursor(xIn-w/2, yIn-h/2);  
}

//--------------------------------------------------------------------------------
void tftPrint(String str) {
    int16_t xText, yText;
    uint16_t w, h;  

      tft.getTextBounds(str, 0, 0, &xText, &yText, &w, &h);
      tft.fillRect(  tft.getCursorX(),   tft.getCursorY(), w, h, HX8357_BLACK);
      tft.print(str);
}

//-------------------------------------------------------------------------
void tftCenterPrint(String str) {
      tft.setTextSize(textSize);
      tftSetCenterCursor(str, 
                   DISPLAY_TEXTOFFSET + (  tft.width()-DISPLAY_TEXTOFFSET)/2, 
                   DISPLAY_YOFFSET + ( tft.height()-DISPLAY_YOFFSET)/2);
     tftPrint(str);
}
            
//--------------------------------------------------------------------------------
void setup() {
    Serial.begin(115200);
    delay(100);
    Serial.println("");

    // if the touchscreen returns true, assume we have the  tft device
    if (!ts.begin())
        return;
        
    Serial.println("Touchscreen started");
     tft.begin();
     tft.setRotation(1);
     tft.setTextWrap(false);
                              
    initializeButtons(Menu1Buttons, Menu1Colors, Menu1Labels, MENU1_BTN_CNT);
}

//--------------------------------------------------------------------------------
int  tftButtonRelease(Adafruit_GFX_Button menuButtons[], int menuButtonCount) {
    int btn = -1;
    TS_Point p;
    
    if (ts.bufferSize()) 
    {
        p = ts.getPoint(); 
    } 
    else 
    {
        // this is our way of tracking touch 'release'!
        p.x = p.y = p.z = -1;
    }
  
    // Scale from ~0->4000 to  tft.width using the calibration #'s
    if (p.z != -1) 
    {
        int16_t px = p.x;
        int16_t py = p.y;
        p.x = map(py, TS_MINY, TS_MAXY, 0,  tft.width());
        p.y = map(px, TS_MINX, TS_MAXX, 0,  tft.height()); 
    }

    // go thru all the buttons, checking if they were pressed
    for (uint8_t b=0; b<menuButtonCount; b++) 
    {
        if (menuButtons[b].contains(p.x, p.y)) 
        {
          Serial.print("Pressing: "); Serial.println(b);
          menuButtons[b].press(true);  // tell the button it is pressed
        } 
        else 
        {
          menuButtons[b].press(false);  // tell the button it is NOT pressed
        }
    }
    
    // now we can ask the buttons if their state has changed
    for (uint8_t b=0; b<menuButtonCount; b++) 
    {
        if (menuButtons[b].justReleased()) 
        {
          Serial.print("Released: "); Serial.println(b);
          menuButtons[b].drawButton();  // draw normal
          btn = b;
        }

        if (menuButtons[b].justPressed()) 
        {
            menuButtons[b].drawButton(true);  // draw invert!
            delay(100); // UI debouncing
        }
    }
    return btn;
}

//--------------------------------------------------------------------------------
void processMenu2() {
    String msg = "";
    bool exitLoop = false;

    initializeButtons(Menu2Buttons, Menu2Colors, Menu2Labels, MENU2_BTN_CNT);

    msg = "   Menu 2 Up button   ";
    Serial.println(msg);
    setTextColorIndex(0);
    setTextSizeIndex(0);
     tftCenterPrint(msg);
            
    while (!exitLoop)
    {   
        int btn =  tftButtonRelease(Menu2Buttons, MENU2_BTN_CNT);
        if (btn >= 0 && btn < MENU2_BTN_CNT)
        {
            Serial.print("btn = "); Serial.println(btn);
        }

        switch (btn)
        {
          case BTN_UP:
            msg = "Menu 2 Up button      ";
            Serial.println(msg);
            setTextColorIndex(1);
             tftCenterPrint(msg);
            break;
            
          case BTN_SELECT:
            msg = "Menu 2 Select Button  ";
            Serial.println(msg);
            setTextColorIndex(0);
             tftCenterPrint(msg);
            break;
            
          case BTN_DOWN:
            msg = "Menu 2 Down Button    ";
            Serial.println(msg);
            setTextColorIndex(-1);
             tftCenterPrint(msg);
            break;
            
          case BTN_RETURN:
            msg = "Menu 2 Ret Button     ";
            Serial.println(msg);
            Serial.println("Exiting Menu2, Returing to Menu1");

            exitLoop = true;
            break;
            
          default:
            break;
        }
    }
}

//--------------------------------------------------------------------------------
void processMenu1() {
    String msg = "";
    
    int btn =  tftButtonRelease(Menu1Buttons, MENU1_BTN_CNT);
    if (btn >= 0 && btn < MENU1_BTN_CNT)
    {
        Serial.print("btn = "); Serial.println(btn);
    }

    switch (btn)
    {
      case BTN_UP:
        msg = "Menu 1 Up Button    ";
        Serial.println(msg);
         tft.fillRect(DISPLAY_XOFFSET,DISPLAY_YOFFSET, tft.width(), tft.height(), HX8357_BLACK);
        setTextColorIndex(0);
        setTextSizeIndex(1);
         tftCenterPrint(msg);
        break;
        
      case BTN_SELECT:
        msg = "Menu 1 Select Button";
        Serial.println(msg);
        processMenu2();

        initializeButtons(Menu1Buttons, Menu1Colors, Menu1Labels, MENU1_BTN_CNT);

        msg = "Returned from Menu2 ";
        Serial.println(msg);
        setTextColorIndex(0);
        setTextSizeIndex(0);
        tftCenterPrint(msg);
        break;
        
      case BTN_DOWN:
        msg = "Menu 1 Down Button  ";
        Serial.println(msg);
         tft.fillRect(DISPLAY_XOFFSET,DISPLAY_YOFFSET, tft.width(), tft.height(), HX8357_BLACK);
        setTextColorIndex(0);
        setTextSizeIndex(-1);
         tftCenterPrint(msg);
        break;
        
      case BTN_RETURN:
        msg = "Menu 1 Ret Button   ";
        Serial.println(msg);
        tftCenterPrint(msg);
        break;
        
      default:
        break;
    }
}

//--------------------------------------------------------------------------------
void loop() {

    processMenu1();
   
}

missing h in Adafruit_HX8357.h in README.txt

in the README.txt for this repository. The text has "Adafruit_HX8357." where "Adafruit_HX8357.h" should be.

the current text is:
To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_HX8357. Check that the Adafruit_HX8357 folder contains Adafruit_HX8357.cpp and Adafruit_HX8357.

the text should be:
To download. click the DOWNLOADS button in the top right corner, rename the uncompressed folder Adafruit_HX8357. Check that the Adafruit_HX8357 folder contains Adafruit_HX8357.cpp and Adafruit_HX8357.h

this current lib 1.1.4 does not compile any more for Feather M4, opposite to the former lib version 1.0.7

this current lib version does not compile any more for Feather M4 (version=1.1.4)
opposite to the former lib version
version=1.0.7

Arduino: 1.8.8 (Windows 7),
Board: "Adafruit Feather M4 Express (SAMD51), Enabled"

D:\arduino\arduino-builder -dump-prefs -logger=machine -hardware D:\arduino\hardware -hardware D:\arduino\portable\packages -tools D:\arduino\tools-builder -tools D:\arduino\hardware\tools\avr -tools D:\arduino\portable\packages -built-in-libraries D:\arduino\libraries -libraries D:\arduino\portable\sketchbook\libraries -fqbn=adafruit:samd:adafruit_feather_m4:cache=on -vid-pid=0X239A_0X8022 -ide-version=10808 -build-path C:\Users\hw\AppData\Local\Temp\arduino_build_869403 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=D:\arduino\portable\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -prefs=runtime.tools.arm-none-eabi-gcc-4.8.3-2014q1.path=D:\arduino\portable\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -prefs=runtime.tools.openocd.path=D:\arduino\portable\packages\arduino\tools\openocd\0.9.0-arduino -prefs=runtime.tools.openocd-0.9.0-arduino.path=D:\arduino\portable\packages\arduino\tools\openocd\0.9.0-arduino -prefs=runtime.tools.bossac.path=D:\arduino\portable\packages\arduino\tools\bossac\1.8.0-48-gb176eee -prefs=runtime.tools.bossac-1.8.0-48-gb176eee.path=D:\arduino\portable\packages\arduino\tools\bossac\1.8.0-48-gb176eee -prefs=runtime.tools.CMSIS-Atmel.path=D:\arduino\portable\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.CMSIS-Atmel-1.2.0.path=D:\arduino\portable\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.CMSIS.path=D:\arduino\portable\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-4.5.0.path=D:\arduino\portable\packages\arduino\tools\CMSIS\4.5.0 -verbose C:\Users\hw\AppData\Local\Temp\arduino_modified_sketch_187767\Ardubench_22G_HX8357_Adafruit.ino
D:\arduino\arduino-builder -compile -logger=machine -hardware D:\arduino\hardware -hardware D:\arduino\portable\packages -tools D:\arduino\tools-builder -tools D:\arduino\hardware\tools\avr -tools D:\arduino\portable\packages -built-in-libraries D:\arduino\libraries -libraries D:\arduino\portable\sketchbook\libraries -fqbn=adafruit:samd:adafruit_feather_m4:cache=on -vid-pid=0X239A_0X8022 -ide-version=10808 -build-path C:\Users\hw\AppData\Local\Temp\arduino_build_869403 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arm-none-eabi-gcc.path=D:\arduino\portable\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -prefs=runtime.tools.arm-none-eabi-gcc-4.8.3-2014q1.path=D:\arduino\portable\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1 -prefs=runtime.tools.openocd.path=D:\arduino\portable\packages\arduino\tools\openocd\0.9.0-arduino -prefs=runtime.tools.openocd-0.9.0-arduino.path=D:\arduino\portable\packages\arduino\tools\openocd\0.9.0-arduino -prefs=runtime.tools.bossac.path=D:\arduino\portable\packages\arduino\tools\bossac\1.8.0-48-gb176eee -prefs=runtime.tools.bossac-1.8.0-48-gb176eee.path=D:\arduino\portable\packages\arduino\tools\bossac\1.8.0-48-gb176eee -prefs=runtime.tools.CMSIS-Atmel.path=D:\arduino\portable\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.CMSIS-Atmel-1.2.0.path=D:\arduino\portable\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.CMSIS.path=D:\arduino\portable\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-4.5.0.path=D:\arduino\portable\packages\arduino\tools\CMSIS\4.5.0 -verbose C:\Users\hw\AppData\Local\Temp\arduino_modified_sketch_187767\Ardubench_22G_HX8357_Adafruit.ino
Using board 'adafruit_feather_m4' from platform in folder: D:\arduino\portable\packages\adafruit\hardware\samd\1.3.0
Using core 'arduino' from platform in folder: D:\arduino\portable\packages\adafruit\hardware\samd\1.3.0
WARNUNG: Kategorie 'Buttons' in der Bibliothek ButtonClass ist ungรผltig und wird auf 'Uncategorized' festgelegt
WARNUNG: Kategorie 'TFT menu' in der Bibliothek MenuClass ist ungรผltig und wird auf 'Uncategorized' festgelegt
WARNUNG: Kategorie '' in der Bibliothek XPT2046 ist ungรผltig und wird auf 'Uncategorized' festgelegt
Detecting libraries used...
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\sketch\\Ardubench_22G_HX8357_Adafruit.ino.cpp" -o nul
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\sketch\\Ardubench_22G_HX8357_Adafruit.ino.cpp" -o nul
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\sketch\\Ardubench_22G_HX8357_Adafruit.ino.cpp" -o nul
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master" "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\sketch\\Ardubench_22G_HX8357_Adafruit.ino.cpp" -o nul
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_STMPE610-master" "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\sketch\\Ardubench_22G_HX8357_Adafruit.ino.cpp" -o nul
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_STMPE610-master" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\Wire" "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\sketch\\Ardubench_22G_HX8357_Adafruit.ino.cpp" -o nul
Using cached library dependencies for file: D:\arduino\portable\packages\adafruit\hardware\samd\1.3.0\libraries\SPI\SPI.cpp
Using cached library dependencies for file: D:\arduino\portable\sketchbook\libraries\Adafruit-GFX-Library-master\Adafruit_GFX.cpp
Using cached library dependencies for file: D:\arduino\portable\sketchbook\libraries\Adafruit-GFX-Library-master\Adafruit_SPITFT.cpp
Using cached library dependencies for file: D:\arduino\portable\sketchbook\libraries\Adafruit-GFX-Library-master\glcdfont.c
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_STMPE610-master" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\Wire" "D:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master\\Adafruit_HX8357.cpp" -o nul
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_STMPE610-master" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\Wire" "D:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_STMPE610-master\\Adafruit_STMPE610.cpp" -o nul
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_STMPE610-master" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\Wire" "D:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\Wire\\Wire.cpp" -o nul
Generating function prototypes...
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_STMPE610-master" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\Wire" "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\sketch\\Ardubench_22G_HX8357_Adafruit.ino.cpp" -o "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"D:\\arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Sketch wird kompiliert...
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_STMPE610-master" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\Wire" "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\sketch\\Ardubench_22G_HX8357_Adafruit.ino.cpp" -o "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\sketch\\Ardubench_22G_HX8357_Adafruit.ino.cpp.o"
Compiling libraries...
Compiling library "SPI"
Zuvor kompilierte Datei wird verwendet: C:\Users\hw\AppData\Local\Temp\arduino_build_869403\libraries\SPI\SPI.cpp.o
Compiling library "Adafruit-GFX-Library-master"
Zuvor kompilierte Datei wird verwendet: C:\Users\hw\AppData\Local\Temp\arduino_build_869403\libraries\Adafruit-GFX-Library-master\glcdfont.c.o
Zuvor kompilierte Datei wird verwendet: C:\Users\hw\AppData\Local\Temp\arduino_build_869403\libraries\Adafruit-GFX-Library-master\Adafruit_GFX.cpp.o
Zuvor kompilierte Datei wird verwendet: C:\Users\hw\AppData\Local\Temp\arduino_build_869403\libraries\Adafruit-GFX-Library-master\Adafruit_SPITFT.cpp.o
Compiling library "Adafruit_HX8357_Library-master"
"D:\\arduino\\portable\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-g++" -mcpu=cortex-m4 -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -DF_CPU=120000000L -DARDUINO=10808 -DARDUINO_FEATHER_M4 -DARDUINO_ARCH_SAMD -D__SAMD51J19A__ -DADAFRUIT_FEATHER_M4_EXPRESS -D__SAMD51__ -DUSB_VID=0x239A -DUSB_PID=0x8022 -DUSBCON "-DUSB_MANUFACTURER=\"Adafruit LLC\"" "-DUSB_PRODUCT=\"Adafruit Feather M4\"" -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DENABLE_CACHE "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-ID:\\arduino\\portable\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\cores\\arduino" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\variants\\feather_m4" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\SPI" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit-GFX-Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master" "-ID:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_STMPE610-master" "-ID:\\arduino\\portable\\packages\\adafruit\\hardware\\samd\\1.3.0\\libraries\\Wire" "D:\\arduino\\portable\\sketchbook\\libraries\\Adafruit_HX8357_Library-master\\Adafruit_HX8357.cpp" -o "C:\\Users\\hw\\AppData\\Local\\Temp\\arduino_build_869403\\libraries\\Adafruit_HX8357_Library-master\\Adafruit_HX8357.cpp.o"
D:\arduino\portable\sketchbook\libraries\Adafruit_HX8357_Library-master\Adafruit_HX8357.cpp: In member function 'virtual void Adafruit_HX8357::begin(uint32_t)':

D:\arduino\portable\sketchbook\libraries\Adafruit_HX8357_Library-master\Adafruit_HX8357.cpp:273:24: error: 'sendCommand' was not declared in this scope

         sendCommand(cmd);

                        ^

D:\arduino\portable\sketchbook\libraries\Adafruit_HX8357_Library-master\Adafruit_HX8357.cpp:275:39: error: 'sendCommand' was not declared in this scope

         sendCommand(cmd, addr, numArgs);

                                       ^

D:\arduino\portable\sketchbook\libraries\Adafruit_HX8357_Library-master\Adafruit_HX8357.cpp: In member function 'virtual void Adafruit_HX8357::setRotation(uint8_t)':

D:\arduino\portable\sketchbook\libraries\Adafruit_HX8357_Library-master\Adafruit_HX8357.cpp:321:35: error: 'sendCommand' was not declared in this scope

   sendCommand(HX8357_MADCTL, &m, 1);

                                   ^

D:\arduino\portable\sketchbook\libraries\Adafruit_HX8357_Library-master\Adafruit_HX8357.cpp: In member function 'virtual void Adafruit_HX8357::invertDisplay(boolean)':

D:\arduino\portable\sketchbook\libraries\Adafruit_HX8357_Library-master\Adafruit_HX8357.cpp:331:52: error: 'sendCommand' was not declared in this scope

   sendCommand(invert ? HX8357_INVON : HX8357_INVOFF);

                                                    ^

Bibliothek SPI in Version 1.0 im Ordner: D:\arduino\portable\packages\adafruit\hardware\samd\1.3.0\libraries\SPI  wird verwendet
Bibliothek Adafruit-GFX-Library-master in Version 1.3.6 im Ordner: D:\arduino\portable\sketchbook\libraries\Adafruit-GFX-Library-master  wird verwendet
Bibliothek Adafruit_HX8357_Library-master in Version 1.1.4 im Ordner: D:\arduino\portable\sketchbook\libraries\Adafruit_HX8357_Library-master  wird verwendet
Bibliothek Adafruit_STMPE610-master in Version 1.0.1 im Ordner: D:\arduino\portable\sketchbook\libraries\Adafruit_STMPE610-master  wird verwendet
Bibliothek Wire in Version 1.0 im Ordner: D:\arduino\portable\packages\adafruit\hardware\samd\1.3.0\libraries\Wire  wird verwendet
exit status 1
Fehler beim Kompilieren fรผr das Board Adafruit Feather M4 Express (SAMD51).


test code:


// Arduino  Brickbench
// benchmark test for SoCs and MCUs
// PL: GCC,Arduino
// Autor: (C) dsyleixa 2013-2019
//
// change log:
// 2.2.G  excerpt: testing just TFT
// 2.2.   testing both 32fp and 64fp 
// 2.1.1. 32bit fp tests vs. 64bit double (ARM/32bit cores, optional)
//        low-level bitRead/Write vs. digitalRead/Write (AVR cores, optional) 
// 2.1 GPIO r/w
// 2.0 loop counts


#include <SPI.h>
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_HX8357.h>
#include <Adafruit_STMPE610.h>


#ifdef ESP8266
   #define STMPE_CS 16
   #define TFT_CS   0
   #define TFT_DC   15
   #define SD_CS    2
 
#elif defined ESP32
   #define STMPE_CS 32
   #define TFT_CS   15
   #define TFT_DC   33
   #define SD_CS    14
 
#elif defined TEENSYDUINO
   #define TFT_DC   10
   #define TFT_CS   4
   #define STMPE_CS 3
   #define SD_CS    8
  
#elif defined ARDUINO_STM32_FEATHER
   #define TFT_DC   PB4
   #define TFT_CS   PA15
   #define STMPE_CS PC7
   #define SD_CS    PC5
  
#elif defined ARDUINO_FEATHER52
   #define STMPE_CS 30
   #define TFT_CS   13
   #define TFT_DC   11
   #define SD_CS    27

#elif  defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)
   #define TFT_DC   P5_4
   #define TFT_CS   P5_3
   #define STMPE_CS P3_3
   #define SD_CS    P3_2

// Something else!
#elif  defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__)   
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5

 // default 
#else
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5
#endif

#define TFT_RST -1

Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);



#define  TimerMS() millis()

unsigned long runtime[10];

#define tpin1  11  // GPIO test pins digitalWrite
#define tpin2  12  // GPIO test pins digitalWrite
#define tpin3  13  // GPIO test pins digitalRead


void TFTprint(char sbuf[], int16_t x, int16_t y) {
  tft.setCursor(x, y);
  tft.print(sbuf);
}

int a[500], b[500], c[500], t[500];


    
//--------------------------------------------
inline void displayValues() {

  char buf[120];
  tft.fillScreen(0x0000); // clrscr()

    sprintf (buf, "%3d %9ld  int_Add",    0, runtime[0]); TFTprint(buf, 0, 9);
    sprintf (buf, "%3d %9ld  int_Mult",   1, runtime[1]); TFTprint(buf, 0,18);
    sprintf (buf, "%3d %9ld  fp32_op",    2, runtime[2]); TFTprint(buf, 0,27);
    sprintf (buf, "%3d %9ld  fp64_op",    3, runtime[3]); TFTprint(buf, 0,36);
    sprintf (buf, "%3d %9ld  randomize",  4, runtime[4]); TFTprint(buf, 0,45);
    sprintf (buf, "%3d %9ld  matrx_algb", 5, runtime[5]); TFTprint(buf, 0,54);
    sprintf (buf, "%3d %9ld  arr_sort",   6, runtime[6]); TFTprint(buf, 0,63);
    sprintf (buf, "%3d %9ld  GPIO_togg",  7, runtime[7]); TFTprint(buf, 0,72);
    sprintf (buf, "%3d %9ld  Graphics",   8, runtime[8]); TFTprint(buf, 0,80);
}

//--------------------------------------------
int32_t test_TextOut(){
  int  y;
  char buf[120];
 
  for(y=0;y<10;++y) {   
    tft.fillScreen(0x0000); // clrscr()
    sprintf (buf, "%3d %9d  int_Add",    y, 1000);  TFTprint(buf, 0, 9);
    sprintf (buf, "%3d %9d  int_Mult",   0, 1010);  TFTprint(buf, 0,18);
    sprintf (buf, "%3d %9d  fp32_op",    0, 1032);  TFTprint(buf, 0,27);
    sprintf (buf, "%3d %9d  fp64_op",    0, 1064);  TFTprint(buf, 0,36);
    sprintf (buf, "%3d %9d  randomize",  0, 1040);  TFTprint(buf, 0,45);
    sprintf (buf, "%3d %9d  matrx_algb", 0, 1050);  TFTprint(buf, 0,54);
    sprintf (buf, "%3d %9d  GPIO_togg",  0, 1060);  TFTprint(buf, 0,63);
    sprintf (buf, "%3d %9d  Graphics",   0, 1070);  TFTprint(buf, 0,72);
    sprintf (buf, "%3d %9d  testing...", 0, 1080);  TFTprint(buf, 0,80);
  }
  return y;
}


//--------------------------------------------
int32_t test_graphics(){
  int y;
  char buf[120];
 
 
  for(y=0;y<10;++y) {
    tft.fillScreen(0x0000);
    sprintf (buf, "%3d", y);  TFTprint(buf, 0,80); // outcomment for downwards compatibility

    tft.drawCircle(50, 40, 10, 0xFFFF);
    tft.fillCircle(30, 24, 10, 0xFFFF);
    tft.drawLine(10, 10, 60, 60, 0xFFFF);
    tft.drawLine(50, 20, 90, 70, 0xFFFF);
    tft.drawRect(20, 20, 40, 40, 0xFFFF);
    tft.fillRect(65, 25, 20, 30, 0xFFFF);
    tft.drawCircle(70, 30, 15, 0xFFFF); 

  }
  return y;
}


//--------------------------------------------
long test(){
 unsigned long time0, x, y;
  double s;
  char  buf[120];
  int   i;
  float f;

  

  Serial.println("start test");
  tft.println("start test");
  delay(10);

  // computational benchmark tests 0...7 skipped

  // lcd display text / graphs
  time0=TimerMS();
  s=test_TextOut();  
  s=test_graphics();
  runtime[8]=TimerMS()-time0;
  sprintf (buf, "%3d %9ld  Graphics   ", 8, runtime[8]); 
  Serial.println( buf); 
  tft.println( buf);

  Serial.println();
 
  y = 0;
  for (x = 0; x < 9; ++x) {
      y += runtime[x];
  }
 
  displayValues();
  sprintf (buf, "runtime ges.:  %-9ld ", y);
  Serial.println( buf);   TFTprint(buf, 0,90);
 
  x=50000000.0/y;
  sprintf (buf, "benchmark:     %-9ld ", x);
  Serial.println( buf);   TFTprint(buf, 0,100);


  return 1;
}

//--------------------------------------------
void setup() {
 
  Serial.begin(115200);
  Serial.println("starting Serial()");
  while(!Serial);

  // Setup the LCD
  tft.begin(HX8357D);
  //tft.begin(2);
  tft.setRotation(3);
  tft.fillScreen(0x0000);
  tft.setTextColor(0xFFFF); tft.setTextSize(1);
  Serial.println("tft started");

  pinMode(tpin1, OUTPUT);
  pinMode(tpin2, OUTPUT);
  pinMode(tpin3, INPUT_PULLUP);


  char  buf[120];
  test(); 
  sprintf (buf, "Ende brickbench");   
  Serial.println( buf);
  TFTprint(buf, 0, 110);
}

void loop() {

}

Incorrect Touchscreen Mapping Code in Example Files

Was using the Adafruit TFT FeatherWing 3.5" 480x320 Touchscreen (Version 1) with an Adafruit HUZZAH32 ESP32 Feather Board and found a mapping error in two example files.

For: examples/touchpaint_featherwing/touchpaint_featherwing.ino
Line 156
p.x = map(p.x, min_x, max_x, 0, tft.width());
should be
p.x = map(p.x, min_x, max_x, tft.width(), 0);

For: examples/gfxbuttontest_featherwing/gfxbuttontest_featherwing.ino
Line 266
int py = map(p.x, max_x, min_x, 0, tft.height());
should be
int py = map(p.x, min_x, max_x, 0, tft.height());

For both example files, the correct file for the Version 1 screen had been selected:
// If using the rev 1 with STMPE resistive touch screen controller uncomment this line:
#include <Adafruit_STMPE610.h>
// If using the rev 2 with TSC2007, uncomment this line:
//#include <Adafruit_TSC2007.h>

ESP8266 Compilation issue

I am seeing a compile failure specific to the ESP8266 when using the included example graphicstest_featherwing. Reproduced by installing a new Arduino IDE 1.8.8, downloading fresh copies of the GFX and HX8357 libraries, setting the board type to Feather M0 - compiles without errors. Change the board type to Feather HUZZAH 8266 and the compile will fail with the below error. In looking at the GfX repo I see some changes were made last week specifically for the 8266. I looked at the copy of the GfX library source and confirmed the changes are in the copy on my machine. I donโ€™t understand the libraries enough to know if the problem lies in the GfX library itself or HX8357. But since the error is reported on the HX8357 at compilation Iโ€™m filing it here.

Here are the compile errors:

Arduino: 1.8.8 (Mac OS X), Board: "Adafruit Feather HUZZAH ESP8266, 80 MHz, Flash, Disabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

/Users/ronaldg/Documents/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In constructor 'Adafruit_HX8357::Adafruit_HX8357(int8_t, int8_t, int8_t, uint8_t, SPIClass*)':
/Users/ronaldg/Documents/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:116:56: error: invalid conversion from 'SPIClass*' to 'int8_t {aka signed char}' [-fpermissive]
HX8357_TFTHEIGHT, spi, cs, dc, rst), displayType(type) {
^
In file included from /Users/ronaldg/Documents/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.h:34:0,
from /Users/ronaldg/Documents/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:42:
/Users/ronaldg/Documents/Arduino/libraries/Adafruit_GFX_Library/Adafruit_SPITFT.h:121:5: error: initializing argument 3 of 'Adafruit_SPITFT::Adafruit_SPITFT(uint16_t, uint16_t, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)' [-fpermissive]
Adafruit_SPITFT(uint16_t w, uint16_t h,
^
exit status 1
Error compiling for board Adafruit Feather HUZZAH ESP8266.

  • Arduino board: Feather Huzzah 8266
  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.8
  • GfX v1.4.2
  • HX8357 v1.1.0
  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): See above

Problem with SPI pin assignments on Challenger RP2040 LTE

  • Arduino board: Challenger RP2040 LTE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):

Only white display in Aurdino but works in CircutPython if i remap the MISO pin
"spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=microcontroller.pin.GPIO20 )"

This is the Aurdino code i try:


#include <Adafruit_GFX.h>
#include <Adafruit_HX8357.h>

#define TFT_CS   9
#define TFT_DC   10
#define TFT_RST  -1 // Set TFT_RST to -1 if not used

Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, 20, 22, TFT_RST, 23);

void setup() {
Serial.begin(115200);
while (!Serial);  

Serial.println("3.5\" HX8357D FeatherWing Test!"); 

tft.begin();
delay(500);

  // read diagnostics (optional but can help debug problems)
uint8_t x = tft.readcommand8(HX8357_RDPOWMODE);
Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(HX8357_RDMADCTL);
Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(HX8357_RDCOLMOD);
Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(HX8357_RDDIM);
Serial.print("Image Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(HX8357_RDDSDR);
Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX); 

tft.setRotation(1); // Adjust the rotation as needed (0, 1, 2, 3)
tft.fillScreen(HX8357_BLACK);
tft.setTextColor(HX8357_WHITE);
tft.setTextSize(2);

tft.setCursor(50, 100); // Adjust the cursor position as needed
tft.println("Now it is working!");

}

void loop() {
delay(1000);
}


White display and zero(0) on all diagnostic values when using Challenger RP2040 LTE
Full function and proper diagnostic values when try with a Adafruit feather M4

Rebuild after Travis issue fixed

It seems there is an issue with Travis and from what I can narrow it down to has to do with DNS Multicasts causing a Java Error on M4 builds (all examples). However, it builds and runs just fine on the Arduino IDE. I noticed Travis was updated to use Arduino 1.8.9 instead of 1.8.7, but there could have been other updates as well. This issue is more of a reminder to rebuild once that issue is fixed. Alternatively, we could add a test skip for the M4 until then.

SPI clock speed for HX8357 can not be changed or increased by Adafruit_HX8357::begin(uint32_t freq),.

hello,
this is a bug report.

SPI clock speed for HX8357 can not be changed or increased by Adafruit_HX8357::begin(uint32_t freq),.
(I have the 3.5" HX8357 Featherwing for Feather M4, Arduino IDE 1.8.8)

As to Adafruit_HX8357::begin(uint32_t freq),
for which freq do HX8357D or HX8357B stand for, passed as "freq" ?
if I write to Serial it says:
Serial.println(HX8357B); // --> 11
Serial.println(HX8357D); //--> 13
But thats no SPI frequency, is it?
So is it a SPI_clock_devider or what else?

anyway,
I can pass any arbitrary value to tft.begin(n), e.g. HX8357B, HX8357D, 40000000, 20000000, or 1 or 2, or anything else;
for a graphic bench mark the output speed stays always the same, either way which value I am passing - so how to make SPI faster?

[code]

// Adafruit Brickbench
// benchmark test for SoCs and MCUs
// PL: GCC,Arduino
// Autor: (C) dsyleixa 2013-2019
//
// change log:
// 2.2.G  excerpt: testing just TFT
// 2.2.   testing both 32fp and 64fp 
// 2.1.1. 32bit fp tests vs. 64bit double (ARM/32bit cores, optional)
//        low-level bitRead/Write vs. digitalRead/Write (AVR cores, optional) 
// 2.1 GPIO r/w
// 2.0 loop counts


#include <SPI.h>
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_HX8357.h>
#include <Adafruit_STMPE610.h>


#ifdef ESP8266
   #define STMPE_CS 16
   #define TFT_CS   0
   #define TFT_DC   15
   #define SD_CS    2
 
#elif defined ESP32
   #define STMPE_CS 32
   #define TFT_CS   15
   #define TFT_DC   33
   #define SD_CS    14
 
#elif defined TEENSYDUINO
   #define TFT_DC   10
   #define TFT_CS   4
   #define STMPE_CS 3
   #define SD_CS    8
  
#elif defined ARDUINO_STM32_FEATHER
   #define TFT_DC   PB4
   #define TFT_CS   PA15
   #define STMPE_CS PC7
   #define SD_CS    PC5
  
#elif defined ARDUINO_FEATHER52
   #define STMPE_CS 30
   #define TFT_CS   13
   #define TFT_DC   11
   #define SD_CS    27

#elif  defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)
   #define TFT_DC   P5_4
   #define TFT_CS   P5_3
   #define STMPE_CS P3_3
   #define SD_CS    P3_2

// Something else!
#elif  defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__)   
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5

 // default 
#else
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5
#endif

#define TFT_RST -1

Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);



#define  TimerMS() millis()

unsigned long runtime[10];

#define tpin1  11  // GPIO test pins digitalWrite
#define tpin2  12  // GPIO test pins digitalWrite
#define tpin3  13  // GPIO test pins digitalRead


void TFTprint(char sbuf[], int16_t x, int16_t y) {
  tft.setCursor(x, y);
  tft.print(sbuf);
}

int a[500], b[500], c[500], t[500];


    
//--------------------------------------------
inline void displayValues() {

  char buf[120];
  tft.fillScreen(0x0000); // clrscr()

    sprintf (buf, "%3d %9ld  int_Add",    0, runtime[0]); TFTprint(buf, 0, 9);
    sprintf (buf, "%3d %9ld  int_Mult",   1, runtime[1]); TFTprint(buf, 0,18);
    sprintf (buf, "%3d %9ld  fp32_op",    2, runtime[2]); TFTprint(buf, 0,27);
    sprintf (buf, "%3d %9ld  fp64_op",    3, runtime[3]); TFTprint(buf, 0,36);
    sprintf (buf, "%3d %9ld  randomize",  4, runtime[4]); TFTprint(buf, 0,45);
    sprintf (buf, "%3d %9ld  matrx_algb", 5, runtime[5]); TFTprint(buf, 0,54);
    sprintf (buf, "%3d %9ld  arr_sort",   6, runtime[6]); TFTprint(buf, 0,63);
    sprintf (buf, "%3d %9ld  GPIO_togg",  7, runtime[7]); TFTprint(buf, 0,72);
    sprintf (buf, "%3d %9ld  Graphics",   8, runtime[8]); TFTprint(buf, 0,80);
}

//--------------------------------------------
int32_t test_TextOut(){
  int  y;
  char buf[120];
 
  for(y=0;y<10;++y) {   
    tft.fillScreen(0x0000); // clrscr()
    sprintf (buf, "%3d %9d  int_Add",    y, 1000);  TFTprint(buf, 0, 9);
    sprintf (buf, "%3d %9d  int_Mult",   0, 1010);  TFTprint(buf, 0,18);
    sprintf (buf, "%3d %9d  fp32_op",    0, 1032);  TFTprint(buf, 0,27);
    sprintf (buf, "%3d %9d  fp64_op",    0, 1064);  TFTprint(buf, 0,36);
    sprintf (buf, "%3d %9d  randomize",  0, 1040);  TFTprint(buf, 0,45);
    sprintf (buf, "%3d %9d  matrx_algb", 0, 1050);  TFTprint(buf, 0,54);
    sprintf (buf, "%3d %9d  GPIO_togg",  0, 1060);  TFTprint(buf, 0,63);
    sprintf (buf, "%3d %9d  Graphics",   0, 1070);  TFTprint(buf, 0,72);
    sprintf (buf, "%3d %9d  testing...", 0, 1080);  TFTprint(buf, 0,80);
  }
  return y;
}


//--------------------------------------------
int32_t test_graphics(){
  int y;
  char buf[120];
 
 
  for(y=0;y<10;++y) {
    tft.fillScreen(0x0000);
    sprintf (buf, "%3d", y);  TFTprint(buf, 0,80); // outcomment for downwards compatibility

    tft.drawCircle(50, 40, 10, 0xFFFF);
    tft.fillCircle(30, 24, 10, 0xFFFF);
    tft.drawLine(10, 10, 60, 60, 0xFFFF);
    tft.drawLine(50, 20, 90, 70, 0xFFFF);
    tft.drawRect(20, 20, 40, 40, 0xFFFF);
    tft.fillRect(65, 25, 20, 30, 0xFFFF);
    tft.drawCircle(70, 30, 15, 0xFFFF); 

  }
  return y;
}


//--------------------------------------------
long test(){
 unsigned long time0, x, y;
  double s;
  char  buf[120];
  int   i;
  float f;

  

  Serial.println("start test");
  tft.println("start test");
  delay(10);

  // computational benchmark tests 0...7 skipped

  // lcd display text / graphs
  time0=TimerMS();
  s=test_TextOut();  
  s=test_graphics();
  runtime[8]=TimerMS()-time0;
  sprintf (buf, "%3d %9ld  Graphics   ", 8, runtime[8]); 
  Serial.println( buf); 
  tft.println( buf);

  Serial.println();
 
  y = 0;
  for (x = 0; x < 9; ++x) {
      y += runtime[x];
  }
 
  displayValues();
  sprintf (buf, "runtime ges.:  %-9ld ", y);
  Serial.println( buf);   TFTprint(buf, 0,90);
 
  x=50000000.0/y;
  sprintf (buf, "benchmark:     %-9ld ", x);
  Serial.println( buf);   TFTprint(buf, 0,100);


  return 1;
}

//--------------------------------------------
void setup() {
 
  Serial.begin(115200);
  Serial.println("starting Serial()");
  while(!Serial);

  // Setup the LCD
  //tft.begin(HX8357D);
  //tft.begin(20000000);
  tft.begin(2);
  tft.setRotation(3);
  tft.fillScreen(0x0000);
  tft.setTextColor(0xFFFF); tft.setTextSize(1);
  Serial.println("tft started");

  pinMode(tpin1, OUTPUT);
  pinMode(tpin2, OUTPUT);
  pinMode(tpin3, INPUT_PULLUP);


  char  buf[120];
  test(); 
  sprintf (buf, "Ende Arduino brickbench");   
  Serial.println( buf);
  TFTprint(buf, 0, 110);
}

void loop() {

}

[/code]

Font color background no longer acceptable work around

  • Arduino board: NRF52840 Feather Sense
  • Arduino IDE version: 1.8.13

Font color work around using solid font background for refreshing dynamic character data only works on solid color background.
tft.setTextColor(HX8357_RED, HX8357_BLACK); tft.setCursor(0, 40); tft.setTextSize(3); tft.println("Temp: ");

As you likely know without the background color present the character data will just overwrite itself until you're left with a solid filled in block. However when specifying a background color the character clears the background and redraws itself fine.

Now that TFT's are getting larger for Arduinos, processors are getting faster, we can finally add wallpaper backgrounds. The way fonts were displayed worked well in the past because people used solid color backgrounds on the entire TFT. Now that wallpapers can be used we really need a font update that doesn't require a background color to display correctly.

DJDevon3_BLE_Weatherstation_Character_BGColor

Flipping the 3.5 FeatherWing Enable Switch off and on causes reversing

I'm not exactly sure why this is happening, but with the 3.5" TFT FeatherWing and (I'm not sure it makes a difference) a Feather Huzzah, flipping the enable switch off and on causes colors to be drawn in BGR mode rather than RGB mode. Flipping it subsequent times has no effect and it is still drawn as BGR. Resetting on either the feather or wing causes it to go back to RGB. I noticed in the bitmapdraw_featherwing example, the touch on the longer axis is mirrored as well.

Add Feather Sense to HX8357 example sketches

  • Arduino board: Adafruit NRF52840 Feather Sense
  • Arduino IDE version: 1.8.13

All of the HX8357 example sketches do not have the feather sense board explicitly listed and will fail to compile. Compile error states this line is faulty: Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC);
'TFT_CS' was not declared in this scope

To fix simply add the board (ARDUINO_NRF52840_FEATHER_SENSE) to the anything else list and the sketches work. Very simple fix. Every HX8357 example sketch needs to be updated.

// Anything else! #if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || \ defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__) || defined(__SAM3X8E__) || defined(ARDUINO_NRF52840_FEATHER) || defined(ARDUINO_NRF52840_FEATHER_SENSE) #define STMPE_CS 6 #define TFT_CS 9 #define TFT_DC 10 #define SD_CS 5 #endif

Issue displaying bmp images with ESP32 Feather with WiFi.begin() function

Hi,
The bmp image using the example from the library gets blurred as soon as the function WiFi.begin() is called.
I am using the Feather ESP32 with the 3.5" tft Feather wing touch screen.
If I don't call this WiFi.begin function, the picture is displayed correctly.

Is it something coming from the library?

Thank you!

Compiler errors with the latest HX8357 library (1.0.7)

I wrote a small sketch to test a display (Adafruit Product ID 2050) with an ESP32 Feather:

#include <Wire.h>
#include <SPI.h>

#include <Adafruit_GFX.h>
#include <Adafruit_HX8357.h>

#define SERIAL_BAUDRATE                     115200

#define PIN_SPI_MISO                        GPIO_NUM_12
#define PIN_SPI_MOSI                        GPIO_NUM_13
#define PIN_SPI_SCK                         GPIO_NUM_14

#define PIN_LCD_CS                          GPIO_NUM_15
#define PIN_LCD_DC                          GPIO_NUM_21
#define PIN_LCD_RESET                       GPIO_NUM_17
#define PIN_LCD_BACKLIGHT                   GPIO_NUM_16

#define LCD_BRIGHTNESS_MIN                  0
#define LCD_BRIGHTNESS_MAX                  255
#define LCD_BRIGHTNESS_START                200

#define LCD_COLOR_BACKGROUND                0x28E2    
#define LCD_COLOR_FOREGROUND                0xFD29

Adafruit_HX8357 tft = Adafruit_HX8357(PIN_LCD_CS, PIN_LCD_DC, PIN_SPI_MOSI, PIN_SPI_SCK, PIN_LCD_RESET, PIN_SPI_MISO);

void loop(void)
{
}

void setup(void)
{
	Serial.begin(SERIAL_BAUDRATE);
    Wire.begin();
    SPI.begin(PIN_SPI_SCK, PIN_SPI_MISO, PIN_SPI_MOSI, PIN_LCD_CS);
    delay(1000);
    pinMode(PIN_LCD_CS, OUTPUT);
    pinMode(PIN_LCD_DC, OUTPUT);
    pinMode(PIN_LCD_RESET, OUTPUT);
    pinMode(PIN_LCD_BACKLIGHT, OUTPUT);
    analogWrite(PIN_LCD_BACKLIGHT, LCD_BRIGHTNESS_START);
    tft.begin(HX8357D);
	tft.setRotation(0);
    tft.fillScreen(LCD_COLOR_BACKGROUND);
    tft.fillRect(20, 10, 200, 100, LCD_COLOR_FOREGROUND);
}

Compiling this sketch outputs following errors:

Arduino: 1.8.5 (Linux), TD: 1.41, Board: "Adafruit ESP32 Feather, 80MHz, 921600, None"

/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In member function 'void Adafruit_HX8357::begin(uint8_t)':
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:192:47: note: in expansion of macro 'SPI_OBJECT'
 #define SPI_BEGIN()             if(_sclk < 0){SPI_OBJECT.begin();}          ///< SPI initialize
                                               ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:312:3: note: in expansion of macro 'SPI_BEGIN'
   SPI_BEGIN();
   ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In member function 'void Adafruit_HX8357::setAddrWindow(uint16_t, uint16_t, uint16_t, uint16_t)':
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:145:38: note: in expansion of macro 'SPI_OBJECT'
     #define HSPI_WRITE32(l)          SPI_OBJECT.write32(l)     ///< Hardware SPI write 32 bits
                                      ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:196:47: note: in expansion of macro 'HSPI_WRITE32'
 #define SPI_WRITE32(l)          if(_sclk < 0){HSPI_WRITE32(l);}else{SSPI_WRITE32(l);}  ///< SPI write 32 bits
                                               ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:594:3: note: in expansion of macro 'SPI_WRITE32'
   SPI_WRITE32(xa);
   ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:145:38: note: in expansion of macro 'SPI_OBJECT'
     #define HSPI_WRITE32(l)          SPI_OBJECT.write32(l)     ///< Hardware SPI write 32 bits
                                      ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:196:47: note: in expansion of macro 'HSPI_WRITE32'
 #define SPI_WRITE32(l)          if(_sclk < 0){HSPI_WRITE32(l);}else{SSPI_WRITE32(l);}  ///< SPI write 32 bits
                                               ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:597:3: note: in expansion of macro 'SPI_WRITE32'
   SPI_WRITE32(ya);
   ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In member function 'void Adafruit_HX8357::pushColor(uint16_t)':
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:144:38: note: in expansion of macro 'SPI_OBJECT'
     #define HSPI_WRITE16(s)          SPI_OBJECT.write16(s)     ///< Hardware SPI write 16 bits
                                      ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:195:47: note: in expansion of macro 'HSPI_WRITE16'
 #define SPI_WRITE16(s)          if(_sclk < 0){HSPI_WRITE16(s);}else{SSPI_WRITE16(s);}  ///< SPI write 16 bits
                                               ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:610:3: note: in expansion of macro 'SPI_WRITE16'
   SPI_WRITE16(color);
   ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In member function 'void Adafruit_HX8357::writePixel(uint16_t)':
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:144:38: note: in expansion of macro 'SPI_OBJECT'
     #define HSPI_WRITE16(s)          SPI_OBJECT.write16(s)     ///< Hardware SPI write 16 bits
                                      ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:195:47: note: in expansion of macro 'HSPI_WRITE16'
 #define SPI_WRITE16(s)          if(_sclk < 0){HSPI_WRITE16(s);}else{SSPI_WRITE16(s);}  ///< SPI write 16 bits
                                               ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:620:5: note: in expansion of macro 'SPI_WRITE16'
     SPI_WRITE16(color);
     ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In member function 'void Adafruit_HX8357::writePixels(uint16_t*, uint32_t)':
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:148:42: note: in expansion of macro 'SPI_OBJECT'
         #define HSPI_WRITE_PIXELS(c,l)   SPI_OBJECT.writePixels(c,l)
                                          ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:197:47: note: in expansion of macro 'HSPI_WRITE_PIXELS'
 #define SPI_WRITE_PIXELS(c,l)   if(_sclk < 0){HSPI_WRITE_PIXELS(c,l);}else{SSPI_WRITE_PIXELS(c,l);}  ///< SPI write 'l' pixels of 16-bits each
                                               ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:632:5: note: in expansion of macro 'SPI_WRITE_PIXELS'
     SPI_WRITE_PIXELS((uint8_t*)colors , len * 2);
     ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In member function 'uint8_t Adafruit_HX8357::spiRead()':
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:142:38: note: in expansion of macro 'SPI_OBJECT'
     #define HSPI_READ()              SPI_OBJECT.transfer(0)    ///< Hardware SPI read 8 bits
                                      ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:891:16: note: in expansion of macro 'HSPI_READ'
         return HSPI_READ();
                ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In member function 'void Adafruit_HX8357::spiWrite(uint8_t)':
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:143:38: note: in expansion of macro 'SPI_OBJECT'
     #define HSPI_WRITE(b)            SPI_OBJECT.write(b)       ///< Hardware SPI write 8 bits
                                      ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:916:9: note: in expansion of macro 'HSPI_WRITE'
         HSPI_WRITE(b);
         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In member function 'virtual void Adafruit_HX8357::startWrite()':
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:130:38: note: in expansion of macro 'SPI_OBJECT'
     #define HSPI_BEGIN_TRANSACTION() SPI_OBJECT.beginTransaction(SPISettings(_freq, MSBFIRST, SPI_MODE0))
                                      ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:193:47: note: in expansion of macro 'HSPI_BEGIN_TRANSACTION'
 #define SPI_BEGIN_TRANSACTION() if(_sclk < 0){HSPI_BEGIN_TRANSACTION();}    ///< SPI begin transaction
                                               ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:936:5: note: in expansion of macro 'SPI_BEGIN_TRANSACTION'
     SPI_BEGIN_TRANSACTION();
     ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp: In member function 'virtual void Adafruit_HX8357::endWrite()':
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:112:25: error: '_spi' was not declared in this scope
     #define SPI_OBJECT  _spi        ///< Default SPI hardware peripheral
                         ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:131:38: note: in expansion of macro 'SPI_OBJECT'
     #define HSPI_END_TRANSACTION()   SPI_OBJECT.endTransaction()
                                      ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:194:47: note: in expansion of macro 'HSPI_END_TRANSACTION'
 #define SPI_END_TRANSACTION()   if(_sclk < 0){HSPI_END_TRANSACTION();}      ///< SPI end transaction
                                               ^
/home/mick/Arduino/libraries/Adafruit_HX8357_Library/Adafruit_HX8357.cpp:947:5: note: in expansion of macro 'SPI_END_TRANSACTION'
     SPI_END_TRANSACTION();
     ^
exit status 1
Error compiling for board Adafruit ESP32 Feather.

for Featherwing + HUZZAH: p.x and p.y ts touch positions not detected any more if loops lasts about 200-1000ms

this issue is about Feather Huzzah and TFT Featherwing 3.5"

p.x and p.y ts touch positions not detected correctly any more if loops lasts about 100...1000ms (get stuck, hang up) :

#include <SPI.h>
#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_HX8357.h>
#include <Adafruit_STMPE610.h>



#ifdef ESP8266
   #define STMPE_CS 16
   #define TFT_CS   0
   #define TFT_DC   15
   #define SD_CS    2
#endif
#ifdef ESP32
   #define STMPE_CS 32
   #define TFT_CS   15
   #define TFT_DC   33
   #define SD_CS    14
#endif
#ifdef TEENSYDUINO
   #define TFT_DC   10
   #define TFT_CS   4
   #define STMPE_CS 3
   #define SD_CS    8
#endif
#ifdef ARDUINO_STM32_FEATHER
   #define TFT_DC   PB4
   #define TFT_CS   PA15
   #define STMPE_CS PC7
   #define SD_CS    PC5
#endif
#ifdef ARDUINO_FEATHER52
   #define STMPE_CS 30
   #define TFT_CS   13
   #define TFT_DC   11
   #define SD_CS    27
#endif
#if defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)
   #define TFT_DC   P5_4
   #define TFT_CS   P5_3
   #define STMPE_CS P3_3
   #define SD_CS    P3_2
#endif

// Anything else!
#if defined (__AVR_ATmega32U4__) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (__AVR_ATmega328P__) || defined(ARDUINO_SAMD_ZERO) || defined(__SAMD51__) || defined(__SAM3X8E__)
   #define STMPE_CS 6
   #define TFT_CS   9
   #define TFT_DC   10
   #define SD_CS    5
#endif


#define TFT_RST -1

Adafruit_HX8357   tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);
Adafruit_STMPE610  ts = Adafruit_STMPE610(STMPE_CS);

#define TS_MINX 3800
#define TS_MAXX 100
#define TS_MINY 100
#define TS_MAXY 3750

Adafruit_GFX_Button button1, button2;

// calib values determined by calibration program
int  vi1=  2000;
int  vj1=  248;
int  vi2=  224;
int  vj2=  2000;


void setup() {
  int i;
  
  delay(1000);
  Wire.begin();
  
  Serial.begin(115200);
  while (!Serial) delay(10);

  if (!ts.begin()) {
    Serial.println("Couldn't start touchscreen controller");
    while (1);
  }
  Serial.println("Touchscreen started");
  
  tft.begin(HX8357D);   
  tft.fillScreen(COLOR_BKGR);
  tft.setTextSize(2);
  
  // create buttons
  button1.initButton(&tft, 40, 20, 70, 40, CYAN, BLUE, YELLOW, "Reset", 2);
  button1.drawButton();  
  // create button
  button2.initButton(&tft, 200, 20, 70, 40, CYAN, BLUE, YELLOW, "Calib", 2);
  button2.drawButton();  

}



void loop() {
  int i;
  char buf[20]="", buf1[20]="";
  TS_Point p;
  p.x=-1; p.y=-1;

  
  // Retrieve a point   
  p = ts.getPoint();
  // Scale from ~0->4000 to tft.width using the calibration #'s
  p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
  p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());
  delay(1); // debounce   
 
    Serial.print("X = "); Serial.print(p.x); Serial.print("\tY = "); Serial.print(p.y);  Serial.print("\tPressure = "); Serial.println(p.z);           
    Serial.println();    
    sprintf(buf, "x=%3d", p.x); sprintf(buf1, "y=%3d", p.y);
    tft.setTextColor(RED); 
    tft.fillRect(80,0, 80,60, COLOR_BKGR);  // x1,y1, dx,dy 
    tft.setCursor(85,0);     tft.println(buf);
    tft.setCursor(85,20);    tft.println(buf1);
  
  delay(500);  // real code: long lasting calculations of <= 500ms  // <<~~~~~~~~~
}

OTOH, if there is no delay at line
delay(500); // real code: long lasting calculations of <= 500ms // <<~~~~~~~~~
the code works fine, all p.x,p.y positions are detected correctly.

edit:
even for delay (100)...delay(200) it does not react properly within at least 1 sec, but extremely retarded over a period of multiple seconds (up to 10sec), if any: often even then it's completely stuck.

How can this be fixed?

issue https://github.com/adafruit/Adafruit_HX8357_Library/issues/25 is resolved

issue #25 is resolved,
the example code has the wrong pin definitions.

instead of
#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 8 // RST can be set to -1 if you tie it to Arduino's reset

would be needed:

#ifdef ESP8266
#define STMPE_CS 16
#define TFT_CS 0
#define TFT_DC 15
#define SD_CS 2

#elif defined ESP32
#define STMPE_CS 32
#define TFT_CS 15
#define TFT_DC 33
#define SD_CS 14

#elif defined TEENSYDUINO
#define TFT_DC 10
#define TFT_CS 4
#define STMPE_CS 3
#define SD_CS 8

#elif defined ARDUINO_STM32_FEATHER
#define TFT_DC PB4
#define TFT_CS PA15
#define STMPE_CS PC7
#define SD_CS PC5

#elif defined ARDUINO_FEATHER52
#define STMPE_CS 30
#define TFT_CS 13
#define TFT_DC 11
#define SD_CS 27

#elif defined(ARDUINO_MAX32620FTHR) || defined(ARDUINO_MAX32630FTHR)
#define TFT_DC P5_4
#define TFT_CS P5_3
#define STMPE_CS P3_3
#define SD_CS P3_2

// Something else!
#elif defined (AVR_ATmega32U4) || defined(ARDUINO_SAMD_FEATHER_M0) || defined (AVR_ATmega328P) || defined(ARDUINO_SAMD_ZERO) || defined(SAMD51)
#define STMPE_CS 6
#define TFT_CS 9
#define TFT_DC 10
#define SD_CS 5

// default
#else
#define STMPE_CS 6
#define TFT_CS 9
#define TFT_DC 10
#define SD_CS 5
#endif

#define TFT_RST -1

Bug in hardware SPI mode writecommand, writedata.

  • Arduino board: Teensy 3.2
  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.6.11
  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too):
    Run graphicstest in hardware SPI mode. It will just display a white screen. Running in software mode (bitbanging mode) works fine.

The cause is a bug in lines 80 and 96. You are still bit-banging the clock even in hardware SPI mode, which effectively tries to write to address 0 (since clkport in hardware mode is 0). This is no fun for anyone, let alone the processor.

To fix, gate those lines with if (!hwSPI) { ... }. For example:

if (!hwSPI) {
*clkport &= ~clkpinmask;
}

I have done this, and the Teensy is so much happier. The display also now works in hardware SPI mode, which is a good thing I suppose.

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.