I was able to use the latest TFT_eSPI as follows:
- don't use M5Core2 or M5Unified libraries
- copy AXP192.h and AXP192.cpp from M5Core2 into local project - (I'd like to see M5Stack publish Core2 AXP192 as a separate library.)
- make a proper TFT_eSPI setup for Core2 - (I'd like to submit it to TFT_eSPI)
TFT_eSPI setup
#define ILI9341_DRIVER
#define TFT_SDA_READ
#define M5STACK
#define TFT_INVERSION_ON
#define TFT_MISO 38
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS 5
#define TFT_DC 15
#define TFT_RST -1
//#define TFT_BL -1
#define TOUCH_CS -1 // (suppress warning)
#define SPI_FREQUENCY 40000000
#define SPI_READ_FREQUENCY 16000000
example
#include "AXP192.h"
#include <TFT_eSPI.h>
AXP192 Axp;
TFT_eSPI tft;
void setup() {
Axp.begin();
tft.begin();
tft.setRotation(1);
tft.fillScreen(0);
tft.setCursor(10, 10);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(1);
tft.printf("Display Test!");
tft.fillRect(100, 100, 50, 50, TFT_BLUE);
tft.drawCircle(100, 100, 50, TFT_RED);
tft.fillTriangle(30, 30, 180, 100, 80, 150, random(0xfffe));
}
void loop() {
delay(1000);
}