diff --git a/Boards/CYD-2432S024C/Source/CYD2432S024C.cpp b/Boards/CYD-2432S024C/Source/CYD2432S024C.cpp index 56f6650a..69ff9831 100644 --- a/Boards/CYD-2432S024C/Source/CYD2432S024C.cpp +++ b/Boards/CYD-2432S024C/Source/CYD2432S024C.cpp @@ -1,22 +1,27 @@ #include "CYD2432S024C.h" -#include "hal/YellowDisplay.h" -#include "hal/YellowDisplayConstants.h" -#include "hal/YellowSdCard.h" +#include "devices/Display.h" +#include "devices/SdCard.h" #include #include #define CYD_SPI_TRANSFER_SIZE_LIMIT (TWODOTFOUR_LCD_DRAW_BUFFER_SIZE * LV_COLOR_DEPTH / 8) -bool initBoot() { +static bool initBoot() { return driver::pwmbacklight::init(TWODOTFOUR_LCD_PIN_BACKLIGHT); } +static tt::hal::DeviceVector createDevices() { + return { + createDisplay(), + createSdCard() + }; +} + + const tt::hal::Configuration cyd_2432s024c_config = { .initBoot = initBoot, - .createDisplay = createDisplay, - .sdcard = createYellowSdCard(), - .power = nullptr, + .createDevices = createDevices, .i2c = { tt::hal::i2c::Configuration { .name = "First", diff --git a/Boards/CYD-2432S024C/Source/hal/YellowDisplay.cpp b/Boards/CYD-2432S024C/Source/devices/Display.cpp similarity index 94% rename from Boards/CYD-2432S024C/Source/hal/YellowDisplay.cpp rename to Boards/CYD-2432S024C/Source/devices/Display.cpp index b30d7d75..2713e343 100644 --- a/Boards/CYD-2432S024C/Source/hal/YellowDisplay.cpp +++ b/Boards/CYD-2432S024C/Source/devices/Display.cpp @@ -1,6 +1,5 @@ -#include "YellowDisplay.h" +#include "Display.h" #include "Cst816Touch.h" -#include "YellowDisplayConstants.h" #include #include diff --git a/Boards/CYD-2432S024C/Source/hal/YellowDisplayConstants.h b/Boards/CYD-2432S024C/Source/devices/Display.h similarity index 78% rename from Boards/CYD-2432S024C/Source/hal/YellowDisplayConstants.h rename to Boards/CYD-2432S024C/Source/devices/Display.h index 1838914a..7be4a3d3 100644 --- a/Boards/CYD-2432S024C/Source/hal/YellowDisplayConstants.h +++ b/Boards/CYD-2432S024C/Source/devices/Display.h @@ -1,5 +1,8 @@ #pragma once +#include "Tactility/hal/display/DisplayDevice.h" +#include + #define TWODOTFOUR_LCD_PIN_BACKLIGHT GPIO_NUM_27 // Display @@ -11,3 +14,4 @@ #define TWODOTFOUR_LCD_PIN_CS GPIO_NUM_15 #define TWODOTFOUR_LCD_PIN_DC GPIO_NUM_2 +std::shared_ptr createDisplay(); diff --git a/Boards/CYD-2432S024C/Source/hal/YellowSdCard.cpp b/Boards/CYD-2432S024C/Source/devices/SdCard.cpp similarity index 88% rename from Boards/CYD-2432S024C/Source/hal/YellowSdCard.cpp rename to Boards/CYD-2432S024C/Source/devices/SdCard.cpp index ceb4c53e..da3090cc 100644 --- a/Boards/CYD-2432S024C/Source/hal/YellowSdCard.cpp +++ b/Boards/CYD-2432S024C/Source/devices/SdCard.cpp @@ -1,4 +1,4 @@ -#include "YellowSdCard.h" +#include "SdCard.h" #define TAG "twodotfour_sdcard" @@ -9,7 +9,7 @@ constexpr auto SDCARD_PIN_CS = GPIO_NUM_5; using tt::hal::sdcard::SpiSdCardDevice; -std::shared_ptr createYellowSdCard() { +std::shared_ptr createSdCard() { auto configuration = std::make_unique( SDCARD_PIN_CS, GPIO_NUM_NC, diff --git a/Boards/CYD-2432S024C/Source/hal/YellowSdCard.h b/Boards/CYD-2432S024C/Source/devices/SdCard.h similarity index 66% rename from Boards/CYD-2432S024C/Source/hal/YellowSdCard.h rename to Boards/CYD-2432S024C/Source/devices/SdCard.h index 772f7119..4da9f5b9 100644 --- a/Boards/CYD-2432S024C/Source/hal/YellowSdCard.h +++ b/Boards/CYD-2432S024C/Source/devices/SdCard.h @@ -4,5 +4,5 @@ using tt::hal::sdcard::SdCardDevice; -std::shared_ptr createYellowSdCard(); +std::shared_ptr createSdCard(); diff --git a/Boards/CYD-2432S024C/Source/hal/YellowDisplay.h b/Boards/CYD-2432S024C/Source/hal/YellowDisplay.h deleted file mode 100644 index 036603c9..00000000 --- a/Boards/CYD-2432S024C/Source/hal/YellowDisplay.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#include "Tactility/hal/display/DisplayDevice.h" -#include - -std::shared_ptr createDisplay(); diff --git a/Boards/CYD-2432S024C/Source/hal/YellowTouchConstants.h b/Boards/CYD-2432S024C/Source/hal/YellowTouchConstants.h deleted file mode 100644 index c2d9c540..00000000 --- a/Boards/CYD-2432S024C/Source/hal/YellowTouchConstants.h +++ /dev/null @@ -1,5 +0,0 @@ -#pragma once - -// Touch -#define TWODOTFOUR_TOUCH_I2C_PORT I2C_NUM_0 -