I have an Adafruit TFT display which I have working successfully via Platform IO using separate .ccp and header files as a basic proof of concept.
When I have ported this exact config into my real project it simply displays a white screen as opposed to the black with my yellow test text.
Can't think for the life of me why this would break
This is a stand alone file which can be uploaded via Arduino IDE and provide basic functionality also:
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <SPI.h>
#define TFT_CS 10
#define TFT_RST 9 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC 8
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
void setup(void) {
tft.initR(INITR_BLACKTAB);
tft.setRotation(3);
tft.setTextWrap(false);
tft.fillScreen(ST77XX_BLACK);
tft.setCursor(0, 0);
tft.setTextColor(ST77XX_YELLOW);
tft.setTextSize(2);
tftPrintTest();
}
void loop() {
}
void tftPrintTest() {
tft.println("TEST");
}
A link to my commit of these test files is as per the below in my real project, I don't have the files for the test with broken out header and .cpp file for display content but it worked just fine.
So the summary at this stage is:
- WORKED: Taking the above very basic code to drive the display and splitting it out into the same structure as my main code worked just fine as a stand alonetest.
- NOT WORK: Once simply lifting and shifting the working stand alone code into my main project / code it no longer works.
The below commit shows the code split out into the main code base which then does NOT work.