stand-alone TFT_eSPI library on Core2
-
I'd like to use a recent version of TFT_eSPI on the Core2 rather than the M5StackCore2 internal version. Has anyone had success with that?
Using recent versions of TFT_eSPI on the Core Basic was quite easy, but I'm not having luck yet on the Core2.
-
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); }
-
I tried to have the Core2 setup added to TFT_eSPI, but the maintainer mistakenly believes that the Core2 drives the backlight at too high of a voltage by default at boot, so users may damage the device.
From my observation, the display and backlight are unpowered at boot, and explicit commands must be sent to the AXP to power them. If M5Stack's AXP init code is used, there is no problem about over-driving the backlight.
-
I was looking for info about updated the Sprite.h and Sprite.cpp in the M5stack library to include more commands in the TFT_eSPI library. did you ever play with this rather than defining the TFT_eSPI library?