Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Buildscripts/DevicetreeCompiler/source/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def property_to_string(property: DeviceProperty, devices: list[Device]) -> str:
type = property.type
if type == "value":
return property.value
elif type == "boolean":
return "true"
elif type == "text":
return f"\"{property.value}\""
elif type == "values":
Expand Down
6 changes: 2 additions & 4 deletions Devices/btt-panda-touch/bigtreetech,panda-touch.dts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
gpio-count = <49>;
};

i2c_internal {
i2c_internal: i2c0 {
compatible = "espressif,esp32-i2c";
port = <I2C_NUM_0>;
clock-frequency = <400000>;
pin-sda = <2>;
pin-scl = <1>;
pin-sda-pullup;
pin-scl-pullup;
};

i2c_external {
i2c_external: i2c1 {
compatible = "espressif,esp32-i2c";
port = <I2C_NUM_1>;
clock-frequency = <400000>;
Expand Down
50 changes: 1 addition & 49 deletions Devices/cyd-2432s024c/Source/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,5 @@ static tt::hal::DeviceVector createDevices() {

extern const tt::hal::Configuration hardwareConfiguration = {
.initBoot = initBoot,
.createDevices = createDevices,
.spi {
tt::hal::spi::Configuration {
.device = SPI2_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_13,
.miso_io_num = GPIO_NUM_NC,
.sclk_io_num = GPIO_NUM_14,
.quadwp_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
.quadhd_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false,
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
},
tt::hal::spi::Configuration {
.device = SPI3_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_23,
.miso_io_num = GPIO_NUM_19,
.sclk_io_num = GPIO_NUM_18,
.quadwp_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
.quadhd_io_num = GPIO_NUM_NC, // Quad SPI LCD driver is not yet supported
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false,
.max_transfer_sz = 8192,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = tt::hal::spi::InitMode::ByTactility,
.isMutable = false,
.lock = nullptr
},
}
.createDevices = createDevices
};
1 change: 0 additions & 1 deletion Devices/cyd-2432s024c/Source/devices/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
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<tt::hal::display::DisplayDevice> createDisplay();
9 changes: 7 additions & 2 deletions Devices/cyd-2432s024c/Source/devices/SdCard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#define TAG "twodotfour_sdcard"

#include <tactility/device.h>
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/RecursiveMutex.h>

Expand All @@ -17,13 +18,17 @@ std::shared_ptr<SdCardDevice> createSdCard() {
GPIO_NUM_NC,
GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::RecursiveMutex>(),
nullptr,
std::vector<gpio_num_t>(),
SDCARD_SPI_HOST
);

auto* spi_controller = device_find_by_name("spi1");
check(spi_controller, "spi1 not found");

return std::make_shared<SpiSdCardDevice>(
std::move(configuration)
std::move(configuration),
spi_controller
);
}

23 changes: 23 additions & 0 deletions Devices/cyd-2432s024c/cyd,2432s024c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <tactility/bindings/root.h>
#include <tactility/bindings/esp32_gpio.h>
#include <tactility/bindings/esp32_i2c.h>
#include <tactility/bindings/esp32_spi.h>

/ {
compatible = "root";
Expand All @@ -20,4 +21,26 @@
pin-sda = <33>;
pin-scl = <32>;
};

display_spi: spi0 {
compatible = "espressif,esp32-spi";
host = <SPI2_HOST>;
pin-mosi = <13>;
pin-miso = <GPIO_PIN_NONE>;
pin-sclk = <14>;
pin-wp = <GPIO_PIN_NONE>;
pin-hd = <GPIO_PIN_NONE>;
max-transfer-size = <0>;
};

sdcard_spi: spi1 {
compatible = "espressif,esp32-spi";
host = <SPI3_HOST>;
pin-mosi = <23>;
pin-miso = <19>;
pin-sclk = <18>;
pin-wp = <GPIO_PIN_NONE>;
pin-hd = <GPIO_PIN_NONE>;
max-transfer-size = <0>;
};
};
52 changes: 1 addition & 51 deletions Devices/cyd-2432s028r/Source/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,55 +31,5 @@ static DeviceVector createDevices() {

extern const Configuration hardwareConfiguration = {
.initBoot = initBoot,
.createDevices = createDevices,
.spi {
// Display
spi::Configuration {
.device = SPI2_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_13,
.miso_io_num = GPIO_NUM_12,
.sclk_io_num = GPIO_NUM_14,
.quadwp_io_num = GPIO_NUM_NC,
.quadhd_io_num = GPIO_NUM_NC,
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false,
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock()
},
// SDCard
spi::Configuration {
.device = SPI3_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_23,
.miso_io_num = GPIO_NUM_19,
.sclk_io_num = GPIO_NUM_18,
.quadwp_io_num = GPIO_NUM_NC,
.quadhd_io_num = GPIO_NUM_NC,
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false,
.max_transfer_sz = 0,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
},
}
.createDevices = createDevices
};
1 change: 0 additions & 1 deletion Devices/cyd-2432s028r/Source/devices/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
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;

// Display backlight (PWM)
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_21;
Expand Down
11 changes: 7 additions & 4 deletions Devices/cyd-2432s028r/Source/devices/SdCard.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "SdCard.h"

#include <tactility/device.h>
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/RecursiveMutex.h>

using tt::hal::sdcard::SpiSdCardDevice;

Expand All @@ -12,11 +12,14 @@ std::shared_ptr<SdCardDevice> createSdCard() {
GPIO_NUM_NC,
GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::RecursiveMutex>(),
nullptr,
std::vector<gpio_num_t>(),
SPI3_HOST
);

return std::make_shared<SpiSdCardDevice>(std::move(config));
auto* spi_controller = device_find_by_name("spi1");
check(spi_controller, "spi1 not found");

return std::make_shared<SpiSdCardDevice>(std::move(config), spi_controller);
}

23 changes: 23 additions & 0 deletions Devices/cyd-2432s028r/cyd,2432s028r.dts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <tactility/bindings/root.h>
#include <tactility/bindings/esp32_gpio.h>
#include <tactility/bindings/esp32_i2c.h>
#include <tactility/bindings/esp32_spi.h>
#include <tactility/bindings/esp32_uart.h>

/ {
Expand All @@ -22,6 +23,28 @@
pin-scl = <22>;
};

display_spi: spi0 {
compatible = "espressif,esp32-spi";
host = <SPI2_HOST>;
pin-mosi = <13>;
pin-miso = <12>;
pin-sclk = <14>;
pin-wp = <GPIO_PIN_NONE>;
pin-hd = <GPIO_PIN_NONE>;
max-transfer-size = <0>;
};

sdcard_spi: spi1 {
compatible = "espressif,esp32-spi";
host = <SPI3_HOST>;
pin-mosi = <23>;
pin-miso = <19>;
pin-sclk = <18>;
pin-wp = <GPIO_PIN_NONE>;
pin-hd = <GPIO_PIN_NONE>;
max-transfer-size = <0>;
};

uart1 {
compatible = "espressif,esp32-uart";
port = <UART_NUM_1>;
Expand Down
52 changes: 1 addition & 51 deletions Devices/cyd-2432s028rv3/Source/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,55 +31,5 @@ static DeviceVector createDevices() {

extern const Configuration hardwareConfiguration = {
.initBoot = initBoot,
.createDevices = createDevices,
.spi {
// Display
spi::Configuration {
.device = SPI2_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_13,
.miso_io_num = GPIO_NUM_12,
.sclk_io_num = GPIO_NUM_14,
.quadwp_io_num = GPIO_NUM_NC,
.quadhd_io_num = GPIO_NUM_NC,
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false,
.max_transfer_sz = LCD_SPI_TRANSFER_SIZE_LIMIT,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock()
},
// SDCard
spi::Configuration {
.device = SPI3_HOST,
.dma = SPI_DMA_CH_AUTO,
.config = {
.mosi_io_num = GPIO_NUM_23,
.miso_io_num = GPIO_NUM_19,
.sclk_io_num = GPIO_NUM_18,
.quadwp_io_num = GPIO_NUM_NC,
.quadhd_io_num = GPIO_NUM_NC,
.data4_io_num = GPIO_NUM_NC,
.data5_io_num = GPIO_NUM_NC,
.data6_io_num = GPIO_NUM_NC,
.data7_io_num = GPIO_NUM_NC,
.data_io_default_level = false,
.max_transfer_sz = 0,
.flags = 0,
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
.intr_flags = 0
},
.initMode = spi::InitMode::ByTactility,
.isMutable = false,
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
},
}
.createDevices = createDevices
};
1 change: 0 additions & 1 deletion Devices/cyd-2432s028rv3/Source/devices/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
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;

// Touch (Software SPI)
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
Expand Down
11 changes: 7 additions & 4 deletions Devices/cyd-2432s028rv3/Source/devices/SdCard.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "SdCard.h"

#include <tactility/device.h>
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
#include <Tactility/lvgl/LvglSync.h>
#include <Tactility/RecursiveMutex.h>

using tt::hal::sdcard::SpiSdCardDevice;

Expand All @@ -12,11 +12,14 @@ std::shared_ptr<SdCardDevice> createSdCard() {
GPIO_NUM_NC,
GPIO_NUM_NC,
SdCardDevice::MountBehaviour::AtBoot,
std::make_shared<tt::RecursiveMutex>(),
nullptr,
std::vector<gpio_num_t>(),
SPI3_HOST
);

return std::make_shared<SpiSdCardDevice>(std::move(config));
auto* spi_controller = device_find_by_name("spi1");
check(spi_controller, "spi1 not found");

return std::make_shared<SpiSdCardDevice>(std::move(config), spi_controller);
}

Loading