From 5a51b3fa1479a180b53c9fc2276c7cca232e8e2d Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Fri, 3 Jul 2026 01:10:44 +0200 Subject: [PATCH] Remove M5Stack StickC Plus support Due to 4MB flash and no SD card --- .github/workflows/build.yml | 1 - Devices/m5stack-stickc-plus/CMakeLists.txt | 7 -- .../Source/Configuration.cpp | 29 -------- .../Source/devices/Display.cpp | 67 ------------------- .../Source/devices/Display.h | 18 ----- .../Source/devices/Power.cpp | 39 ----------- .../Source/devices/Power.h | 9 --- Devices/m5stack-stickc-plus/Source/module.cpp | 23 ------- Devices/m5stack-stickc-plus/device.properties | 20 ------ Devices/m5stack-stickc-plus/devicetree.yaml | 5 -- .../m5stack,stickc-plus.dts | 66 ------------------ 11 files changed, 284 deletions(-) delete mode 100644 Devices/m5stack-stickc-plus/CMakeLists.txt delete mode 100644 Devices/m5stack-stickc-plus/Source/Configuration.cpp delete mode 100644 Devices/m5stack-stickc-plus/Source/devices/Display.cpp delete mode 100644 Devices/m5stack-stickc-plus/Source/devices/Display.h delete mode 100644 Devices/m5stack-stickc-plus/Source/devices/Power.cpp delete mode 100644 Devices/m5stack-stickc-plus/Source/devices/Power.h delete mode 100644 Devices/m5stack-stickc-plus/Source/module.cpp delete mode 100644 Devices/m5stack-stickc-plus/device.properties delete mode 100644 Devices/m5stack-stickc-plus/devicetree.yaml delete mode 100644 Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b832709a0..b0c54a812 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,7 +66,6 @@ jobs: { id: m5stack-cores3, arch: esp32s3 }, { id: m5stack-papers3, arch: esp32s3 }, { id: m5stack-stackchan, arch: esp32s3 }, - { id: m5stack-stickc-plus, arch: esp32 }, { id: m5stack-stickc-plus2, arch: esp32 }, { id: m5stack-sticks3, arch: esp32s3 }, { id: m5stack-tab5, arch: esp32p4 }, diff --git a/Devices/m5stack-stickc-plus/CMakeLists.txt b/Devices/m5stack-stickc-plus/CMakeLists.txt deleted file mode 100644 index b103142fb..000000000 --- a/Devices/m5stack-stickc-plus/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -file(GLOB_RECURSE SOURCE_FILES Source/*.c*) - -idf_component_register( - SRCS ${SOURCE_FILES} - INCLUDE_DIRS "Source" - REQUIRES Tactility esp_lvgl_port esp_lcd AXP192 ST7789 ButtonControl -) diff --git a/Devices/m5stack-stickc-plus/Source/Configuration.cpp b/Devices/m5stack-stickc-plus/Source/Configuration.cpp deleted file mode 100644 index 15e09bfdc..000000000 --- a/Devices/m5stack-stickc-plus/Source/Configuration.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "devices/Display.h" -#include "devices/Power.h" - -#include -#include - -using namespace tt::hal; - -static bool initBoot() { - // CH552 applies 4 V to GPIO 0, which reduces Wi-Fi sensitivity - // Setting output to high adds a bias of 3.3 V and suppresses over-voltage: - gpio::configure(0, gpio::Mode::Output, false, false); - gpio::setLevel(0, true); - - return initAxp(); -} - -static DeviceVector createDevices() { - return { - getAxp192(), - ButtonControl::createTwoButtonControl(37, 39), - createDisplay() - }; -} - -extern const Configuration hardwareConfiguration = { - .initBoot = initBoot, - .createDevices = createDevices -}; diff --git a/Devices/m5stack-stickc-plus/Source/devices/Display.cpp b/Devices/m5stack-stickc-plus/Source/devices/Display.cpp deleted file mode 100644 index f6fba81a0..000000000 --- a/Devices/m5stack-stickc-plus/Source/devices/Display.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "Display.h" -#include "Power.h" - -#include - -#include -#include - -static const auto LOGGER = tt::Logger("StickCPlus"); - -static void setBacklightOn(bool on) { - const auto axp = getAxp192(); - const auto* driver = axp->getAxp192(); - uint8_t state; - if (axp192_read(driver, AXP192_DCDC13_LDO23_CONTROL, &state) != AXP192_OK) { - LOGGER.info("Failed to read LCD brightness state"); - return; - } - std::bitset<8> new_state = state; - if (new_state[2] != on) { - new_state[2] = on; - const auto new_state_long = new_state.to_ulong(); - axp192_write(driver, AXP192_DCDC13_LDO23_CONTROL, static_cast(new_state_long)); // Display on/off - } -} - -static void setBrightness(uint8_t brightness) { - const auto axp = getAxp192(); - if (brightness) - { - brightness = (((brightness >> 1) + 8) / 13) + 5; - setBacklightOn(true); - axp192_write(axp->getAxp192(), AXP192_LDO23_VOLTAGE, brightness << 4); // Display brightness - } - else - { - setBacklightOn(false); - } -} - -std::shared_ptr createDisplay() { - St7789Display::Configuration panel_configuration = { - .horizontalResolution = LCD_HORIZONTAL_RESOLUTION, - .verticalResolution = LCD_VERTICAL_RESOLUTION, - .gapX = 52, - .gapY = 40, - .swapXY = false, - .mirrorX = false, - .mirrorY = false, - .invertColor = true, - .bufferSize = LCD_BUFFER_SIZE, - .touch = nullptr, - .backlightDutyFunction = setBrightness, - .resetPin = LCD_PIN_RESET, - .lvglSwapBytes = false - }; - - auto spi_configuration = std::make_shared(St7789Display::SpiConfiguration { - .spiHostDevice = LCD_SPI_HOST, - .csPin = LCD_PIN_CS, - .dcPin = LCD_PIN_DC, - .pixelClockFrequency = 40'000'000, - .transactionQueueDepth = 10 - }); - - return std::make_shared(panel_configuration, spi_configuration); -} diff --git a/Devices/m5stack-stickc-plus/Source/devices/Display.h b/Devices/m5stack-stickc-plus/Source/devices/Display.h deleted file mode 100644 index bcab89c09..000000000 --- a/Devices/m5stack-stickc-plus/Source/devices/Display.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -constexpr auto LCD_SPI_HOST = SPI2_HOST; -constexpr auto LCD_PIN_CS = GPIO_NUM_5; -constexpr auto LCD_PIN_DC = GPIO_NUM_23; -constexpr auto LCD_PIN_RESET = GPIO_NUM_18; -constexpr auto LCD_HORIZONTAL_RESOLUTION = 135; -constexpr auto LCD_VERTICAL_RESOLUTION = 240; -constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 3; -constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT; -constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8; - -std::shared_ptr createDisplay(); diff --git a/Devices/m5stack-stickc-plus/Source/devices/Power.cpp b/Devices/m5stack-stickc-plus/Source/devices/Power.cpp deleted file mode 100644 index 3efd322c2..000000000 --- a/Devices/m5stack-stickc-plus/Source/devices/Power.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include - -static std::shared_ptr axp192 = nullptr; - -std::shared_ptr createAxp192() { - assert(axp192 == nullptr); - auto configuration = std::make_unique(device_find_by_name("i2c_internal")); - axp192 = std::make_shared(std::move(configuration)); - return axp192; -} - -std::shared_ptr getAxp192() { - assert(axp192 != nullptr); - return axp192; -} - -bool initAxp() { - const auto axp = createAxp192(); - return axp->init([](auto* driver) { - // Reference: https://github.com/pr3y/Bruce/blob/main/lib/utility/AXP192.cpp - axp192_ioctl(driver, AXP192_LDO23_VOLTAGE, 3300); // LCD backlight - axp192_ioctl(driver, AXP192_ADC_ENABLE_1, 0xff); // Set all ADC enabled - axp192_ioctl(driver, AXP192_CHARGE_CONTROL_1, 0xc0); // Battery charging at 4.2 V and 100 mA - axp192_ioctl(driver, AXP192_ADC_ENABLE_1, 0xff); // Enable battery, AC in, Vbus, APS ADC - uint8_t buffer; - axp192_read(driver, AXP192_DCDC13_LDO23_CONTROL, &buffer); - axp192_ioctl(driver, AXP192_DCDC13_LDO23_CONTROL, buffer | 0x4D); // Enable Ext, LDO2, LDO3, DCDC1 - axp192_ioctl(driver, AXP192_PEK, 0x0C); // 128 ms power on, 4 s power off - axp192_ioctl(driver, AXP192_GPIO0_LDOIO0_VOLTAGE, 0xF0); // 3.3 V RTC voltage - axp192_ioctl(driver, AXP192_GPIO0_CONTROL, 0x02); // Set GPIO0 to LDO - axp192_ioctl(driver, AXP192_VBUS_IPSOUT_CHANNEL, 0x80); // Disable Vbus hold limit - axp192_ioctl(driver, AXP192_BATTERY_CHARGE_HIGH_TEMP, 0xFC); // Set temperature protection - axp192_ioctl(driver, AXP192_BATTERY_CHARGE_CONTROL, 0xA2); // Enable RTC BAT charge - axp192_ioctl(driver, AXP192_SHUTDOWN_BATTERY_CHGLED_CONTROL, 0x46); // Enable bat detection - return true; - }); - -} diff --git a/Devices/m5stack-stickc-plus/Source/devices/Power.h b/Devices/m5stack-stickc-plus/Source/devices/Power.h deleted file mode 100644 index 14a008893..000000000 --- a/Devices/m5stack-stickc-plus/Source/devices/Power.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include - -bool initAxp(); - -// Must call initAxp() first before this returns a non-nullptr response -std::shared_ptr getAxp192(); - diff --git a/Devices/m5stack-stickc-plus/Source/module.cpp b/Devices/m5stack-stickc-plus/Source/module.cpp deleted file mode 100644 index caaf12df7..000000000 --- a/Devices/m5stack-stickc-plus/Source/module.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include - -extern "C" { - -static error_t start() { - // Empty for now - return ERROR_NONE; -} - -static error_t stop() { - // Empty for now - return ERROR_NONE; -} - -struct Module m5stack_stickc_plus_module = { - .name = "m5stack-stickc-plus", - .start = start, - .stop = stop, - .symbols = nullptr, - .internal = nullptr -}; - -} diff --git a/Devices/m5stack-stickc-plus/device.properties b/Devices/m5stack-stickc-plus/device.properties deleted file mode 100644 index 92b88d185..000000000 --- a/Devices/m5stack-stickc-plus/device.properties +++ /dev/null @@ -1,20 +0,0 @@ -general.vendor=M5Stack -general.name=StickC Plus -general.incubating=true - -apps.launcherAppId=Launcher -apps.autoStartAppId=ApWebServer - -hardware.target=ESP32 -hardware.flashSize=4MB -hardware.spiRam=false -hardware.esptoolFlashFreq=80M - -storage.userDataLocation=Internal - -display.size=1.14" -display.shape=rectangle -display.dpi=242 - -lvgl.colorDepth=16 -lvgl.uiDensity=compact diff --git a/Devices/m5stack-stickc-plus/devicetree.yaml b/Devices/m5stack-stickc-plus/devicetree.yaml deleted file mode 100644 index 287869e9c..000000000 --- a/Devices/m5stack-stickc-plus/devicetree.yaml +++ /dev/null @@ -1,5 +0,0 @@ -dependencies: -- Platforms/platform-esp32 -- Drivers/mpu6886-module -- Drivers/bm8563-module -dts: m5stack,stickc-plus.dts diff --git a/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts b/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts deleted file mode 100644 index 4946efdcb..000000000 --- a/Devices/m5stack-stickc-plus/m5stack,stickc-plus.dts +++ /dev/null @@ -1,66 +0,0 @@ -/dts-v1/; - -#include -#include -#include -#include -#include -#include -#include -#include - -/ { - compatible = "root"; - model = "M5Stack StickC Plus"; - - gpio0 { - compatible = "espressif,esp32-gpio"; - gpio-count = <40>; - }; - - i2c_internal { - compatible = "espressif,esp32-i2c"; - port = ; - clock-frequency = <400000>; - pin-sda = <&gpio0 21 GPIO_FLAG_NONE>; - pin-scl = <&gpio0 22 GPIO_FLAG_NONE>; - - mpu6886 { - compatible = "invensense,mpu6886"; - reg = <0x68>; - }; - - bm8563 { - compatible = "belling,bm8563"; - reg = <0x51>; - }; - }; - - i2c_grove { - compatible = "espressif,esp32-i2c"; - port = ; - clock-frequency = <400000>; - pin-sda = <&gpio0 32 GPIO_FLAG_NONE>; - pin-scl = <&gpio0 33 GPIO_FLAG_NONE>; - }; - - spi0 { - compatible = "espressif,esp32-spi"; - host = ; - cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>; - pin-mosi = <&gpio0 15 GPIO_FLAG_NONE>; - pin-sclk = <&gpio0 13 GPIO_FLAG_NONE>; - - display { - compatible = "display-placeholder"; - }; - }; - - uart_grove: uart1 { - compatible = "espressif,esp32-uart"; - status = "disabled"; - port = ; - pin-tx = <&gpio0 33 GPIO_FLAG_NONE>; - pin-rx = <&gpio0 32 GPIO_FLAG_NONE>; - }; -};