Skip to content

Instantly share code, notes, and snippets.

@maditnerd
Last active August 23, 2022 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maditnerd/0b99cad6b4b89ffa832998a719fc22a3 to your computer and use it in GitHub Desktop.
Save maditnerd/0b99cad6b4b89ffa832998a719fc22a3 to your computer and use it in GitHub Desktop.
Use M5Stick-C Plus with platformio (without M5 library)
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
void setup() {
I2C_AXP192_InitDef initDef = {
.EXTEN = true,
.BACKUP = true,
.DCDC1 = 3300,
.DCDC2 = 0,
.DCDC3 = 0,
.LDO2 = 3000,
.LDO3 = 3000,
.GPIO0 = -1,
.GPIO1 = -1,
.GPIO2 = -1,
.GPIO3 = -1,
.GPIO4 = -1,
axp192.begin(initDef);
axp192.setLDO2(3300);
axp192.setLDO3(3300);
tft.begin();
tft.setRotation(3);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setTextSize(2);
tft.println("Hello World");
}
void loop() {
}
[env:m5stick-c]
platform = espressif32
board = m5stick-c
framework = arduino
lib_deps =
bodmer/TFT_eSPI@^2.4.75
tanakamasayuki/I2C AXP192 Power management@^1.0.4
monitor_speed = 115200
upload_speed = 1500000
monitor_filters =
esp32_exception_decoder
send_on_enter
monitor_eol = CRLF
monitor_echo = yes
build_flags =
-DUSER_SETUP_LOADED=1
-DST7789_DRIVER=1
-DENABLE_TFT=1
-DTFT_WIDTH=135
-DTFT_HEIGHT=240
-DCGRAM_OFFSET=1
-DTFT_MOSI=15
-DTFT_SCLK=13
-DTFT_CS=5
-DTFT_DC=23
-DTFT_RST=18
-DLOAD_GLCD=1
-DLOAD_FONT2=1
-DLOAD_FONT4=1
-DLOAD_FONT6=1
-DLOAD_FONT7=1
-DLOAD_FONT8=1
-DLOAD_GFXFF=1
-DSMOOTH_FONT=1
-DSPI_FREQUENCY=40000000
-DSPI_READ_FREQUENCY=6000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment