From a4fc3a84a4284cb898af5ec955029a65b6f7794e Mon Sep 17 00:00:00 2001 From: fvanroie Date: Wed, 6 Jan 2021 14:10:05 +0100 Subject: [PATCH] Add M5Stack core2 --- src/drv/hasp_drv_display.cpp | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/drv/hasp_drv_display.cpp b/src/drv/hasp_drv_display.cpp index d1efa9e6..e211fb1a 100644 --- a/src/drv/hasp_drv_display.cpp +++ b/src/drv/hasp_drv_display.cpp @@ -1,7 +1,49 @@ #include "hasp_drv_display.h" +#if defined(M5STACK) + #include "AXP192.h" // Power Mgmt + +AXP192 Axp; + +void m5stack_init() +{ + AXP192 Axp; + Wire.begin(TOUCH_SDA, TOUCH_SCL); + Axp.begin(); + + Axp.SetCHGCurrent(AXP192::kCHG_100mA); + Axp.SetLcdVoltage(3300); + + Axp.SetBusPowerMode(0); + Axp.SetCHGCurrent(AXP192::kCHG_190mA); + + // Axp.SetLDOEnable(3, true); + // CoverScrollText("Motor Test", M5.Lcd.color565(SUCCE_COLOR)); + // delay(150); + // Axp.SetLDOEnable(3, false); + + Axp.SetLed(1); + // CoverScrollText("LED Test", M5.Lcd.color565(SUCCE_COLOR)); + delay(100); + Axp.SetLed(0); + + // FastLED.addLeds(ledsBuff, LEDS_NUM); + // for(int i = 0; i < LEDS_NUM; i++) { + // ledsBuff[i].setRGB(20, 20, 20); + // } + // FastLED.show(); + + Axp.SetLDOVoltage(3, 3300); + // Axp.SetLed(1); +} +#endif + void drv_display_init(uint8_t rotation) { +#if defined(M5STACK) + m5stack_init(); // Set LCD power first +#endif + /* TFT init */ #if defined(USE_FSMC) fsmc_ili9341_init(rotation);