From cd0e3fc5698683a34df8d4c4c134422f968dc7db Mon Sep 17 00:00:00 2001 From: Ken Van Hoeylandt Date: Sat, 7 Mar 2026 01:24:10 +0100 Subject: [PATCH] Converted SDMMC drivers --- .../lilygo-thmi-s3/Source/Configuration.cpp | 2 -- .../lilygo-thmi-s3/Source/devices/SdCard.cpp | 23 ------------------- .../lilygo-thmi-s3/Source/devices/SdCard.h | 15 ------------ Devices/lilygo-thmi-s3/lilygo,thmi-s3.dts | 9 ++++++++ .../Source/Configuration.cpp | 2 -- .../Source/devices/SdCard.cpp | 22 ------------------ .../Source/devices/SdCard.h | 7 ------ .../waveshare,esp32-s3-geek.dts | 12 ++++++++++ 8 files changed, 21 insertions(+), 71 deletions(-) delete mode 100644 Devices/lilygo-thmi-s3/Source/devices/SdCard.cpp delete mode 100644 Devices/lilygo-thmi-s3/Source/devices/SdCard.h delete mode 100644 Devices/waveshare-esp32-s3-geek/Source/devices/SdCard.cpp delete mode 100644 Devices/waveshare-esp32-s3-geek/Source/devices/SdCard.h diff --git a/Devices/lilygo-thmi-s3/Source/Configuration.cpp b/Devices/lilygo-thmi-s3/Source/Configuration.cpp index 8d04e56f..68aa2d31 100644 --- a/Devices/lilygo-thmi-s3/Source/Configuration.cpp +++ b/Devices/lilygo-thmi-s3/Source/Configuration.cpp @@ -1,5 +1,4 @@ #include "devices/Power.h" -#include "devices/SdCard.h" #include "devices/Display.h" #include @@ -11,7 +10,6 @@ using namespace tt::hal; static std::vector> createDevices() { return { - createSdCard(), createDisplay(), std::make_shared(), ButtonControl::createOneButtonControl(0) diff --git a/Devices/lilygo-thmi-s3/Source/devices/SdCard.cpp b/Devices/lilygo-thmi-s3/Source/devices/SdCard.cpp deleted file mode 100644 index 03137e90..00000000 --- a/Devices/lilygo-thmi-s3/Source/devices/SdCard.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "SdCard.h" - -#include -#include - -using tt::hal::sdcard::SdmmcDevice; - -std::shared_ptr createSdCard() { - auto configuration = std::make_unique( - SD_DIO_SCLK, //CLK - SD_DIO_CMD, //CMD - SD_DIO_DATA0, //D0 - SD_DIO_NC, //D1 - SD_DIO_NC, //D2 - SD_DIO_NC, //D3 - SdCardDevice::MountBehaviour::AtBoot, - SD_DIO_BUS_WIDTH - ); - - return std::make_shared( - std::move(configuration) - ); -} diff --git a/Devices/lilygo-thmi-s3/Source/devices/SdCard.h b/Devices/lilygo-thmi-s3/Source/devices/SdCard.h deleted file mode 100644 index ab4ec439..00000000 --- a/Devices/lilygo-thmi-s3/Source/devices/SdCard.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include - -#include "Tactility/hal/sdcard/SdCardDevice.h" - -using tt::hal::sdcard::SdCardDevice; - -constexpr auto SD_DIO_CMD = GPIO_NUM_11; -constexpr auto SD_DIO_SCLK = GPIO_NUM_12; -constexpr auto SD_DIO_DATA0 = GPIO_NUM_13; -constexpr auto SD_DIO_NC = GPIO_NUM_NC; -constexpr auto SD_DIO_BUS_WIDTH = 1; - -std::shared_ptr createSdCard(); \ No newline at end of file diff --git a/Devices/lilygo-thmi-s3/lilygo,thmi-s3.dts b/Devices/lilygo-thmi-s3/lilygo,thmi-s3.dts index 7392e967..d6d8fc71 100644 --- a/Devices/lilygo-thmi-s3/lilygo,thmi-s3.dts +++ b/Devices/lilygo-thmi-s3/lilygo,thmi-s3.dts @@ -3,6 +3,7 @@ #include #include #include +#include #include / { @@ -21,4 +22,12 @@ pin-miso = <&gpio0 4 GPIO_FLAG_NONE>; pin-sclk = <&gpio0 1 GPIO_FLAG_NONE>; }; + + sdmmc0 { + compatible = "espressif,esp32-sdmmc"; + pin-clk = <&gpio0 12 GPIO_FLAG_NONE>; + pin-cmd = <&gpio0 11 GPIO_FLAG_NONE>; + pin-d0 = <&gpio0 13 GPIO_FLAG_NONE>; + bus-width = <1>; + }; }; diff --git a/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp b/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp index 422ab5a8..5f28b1f3 100644 --- a/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp +++ b/Devices/waveshare-esp32-s3-geek/Source/Configuration.cpp @@ -1,5 +1,4 @@ #include "devices/Display.h" -#include "devices/SdCard.h" #include #include @@ -10,7 +9,6 @@ using namespace tt::hal; static DeviceVector createDevices() { return { createDisplay(), - createSdCard(), ButtonControl::createOneButtonControl(0) }; } diff --git a/Devices/waveshare-esp32-s3-geek/Source/devices/SdCard.cpp b/Devices/waveshare-esp32-s3-geek/Source/devices/SdCard.cpp deleted file mode 100644 index 542eec0b..00000000 --- a/Devices/waveshare-esp32-s3-geek/Source/devices/SdCard.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "SdCard.h" - -#include -#include - -using tt::hal::sdcard::SdmmcDevice; - -std::shared_ptr createSdCard() { - auto configuration = std::make_unique( - GPIO_NUM_36, //CLK - GPIO_NUM_35, //CMD - GPIO_NUM_37, //D0 - GPIO_NUM_33, //D1 - GPIO_NUM_38, //D2 - GPIO_NUM_34, //D3 - SdCardDevice::MountBehaviour::AtBoot - ); - - return std::make_shared( - std::move(configuration) - ); -} diff --git a/Devices/waveshare-esp32-s3-geek/Source/devices/SdCard.h b/Devices/waveshare-esp32-s3-geek/Source/devices/SdCard.h deleted file mode 100644 index 07d55649..00000000 --- a/Devices/waveshare-esp32-s3-geek/Source/devices/SdCard.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#include "Tactility/hal/sdcard/SdCardDevice.h" - -using tt::hal::sdcard::SdCardDevice; - -std::shared_ptr createSdCard(); \ No newline at end of file diff --git a/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts b/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts index 9b98719e..28b3c932 100644 --- a/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts +++ b/Devices/waveshare-esp32-s3-geek/waveshare,esp32-s3-geek.dts @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,17 @@ pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>; }; + sdmmc0 { + compatible = "espressif,esp32-sdmmc"; + pin-clk = <&gpio0 36 GPIO_FLAG_NONE>; + pin-cmd = <&gpio0 35 GPIO_FLAG_NONE>; + pin-d0 = <&gpio0 37 GPIO_FLAG_NONE>; + pin-d1 = <&gpio0 33 GPIO_FLAG_NONE>; + pin-d2 = <&gpio0 38 GPIO_FLAG_NONE>; + pin-d3 = <&gpio0 34 GPIO_FLAG_NONE>; + bus-width = <4>; + }; + uart0 { compatible = "espressif,esp32-uart"; port = ;