mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-04-23 11:55:05 +00:00
SPI device migration (#490)
- Implement SPI devices in dts files for all devices - Removed `tt::hal::spi` HAL and its configurations - Fix for devicetree generator "boolean" support - Remove unused custom locks in all `DisplayDevice` implementations - Fixed some bugs with devices - Updated XPT2046 driver - Fix for `WifiEsp` deadlock - Export a lot of new `math.h` symbols with `tt_init.cpp` - Created `SpiDeviceLock` in `TactilityCore` as a wrapper for kernel SPI locking - Improved `TactilityKernel` SPI driver.
This commit is contained in:
parent
74127a5f6c
commit
d27404964a
@ -63,6 +63,8 @@ def property_to_string(property: DeviceProperty, devices: list[Device]) -> str:
|
|||||||
type = property.type
|
type = property.type
|
||||||
if type == "value":
|
if type == "value":
|
||||||
return property.value
|
return property.value
|
||||||
|
elif type == "boolean":
|
||||||
|
return "true"
|
||||||
elif type == "text":
|
elif type == "text":
|
||||||
return f"\"{property.value}\""
|
return f"\"{property.value}\""
|
||||||
elif type == "values":
|
elif type == "values":
|
||||||
|
|||||||
@ -14,17 +14,15 @@
|
|||||||
gpio-count = <49>;
|
gpio-count = <49>;
|
||||||
};
|
};
|
||||||
|
|
||||||
i2c_internal {
|
i2c_internal: i2c0 {
|
||||||
compatible = "espressif,esp32-i2c";
|
compatible = "espressif,esp32-i2c";
|
||||||
port = <I2C_NUM_0>;
|
port = <I2C_NUM_0>;
|
||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <2>;
|
pin-sda = <2>;
|
||||||
pin-scl = <1>;
|
pin-scl = <1>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i2c_external {
|
i2c_external: i2c1 {
|
||||||
compatible = "espressif,esp32-i2c";
|
compatible = "espressif,esp32-i2c";
|
||||||
port = <I2C_NUM_1>;
|
port = <I2C_NUM_1>;
|
||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
|
|||||||
@ -29,53 +29,5 @@ static tt::hal::DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const tt::hal::Configuration hardwareConfiguration = {
|
extern const tt::hal::Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.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
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -14,6 +14,5 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
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();
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#define TAG "twodotfour_sdcard"
|
#define TAG "twodotfour_sdcard"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/RecursiveMutex.h>
|
#include <Tactility/RecursiveMutex.h>
|
||||||
|
|
||||||
@ -17,13 +18,17 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
std::make_shared<tt::RecursiveMutex>(),
|
nullptr,
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SDCARD_SPI_HOST
|
SDCARD_SPI_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -20,4 +21,26 @@
|
|||||||
pin-sda = <33>;
|
pin-sda = <33>;
|
||||||
pin-scl = <32>;
|
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>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -31,55 +31,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.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
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -13,7 +13,6 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
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)
|
// Display backlight (PWM)
|
||||||
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_21;
|
constexpr auto LCD_PIN_BACKLIGHT = GPIO_NUM_21;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
@ -12,11 +12,14 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
std::make_shared<tt::RecursiveMutex>(),
|
nullptr,
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SPI3_HOST
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -22,6 +23,28 @@
|
|||||||
pin-scl = <22>;
|
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 {
|
uart1 {
|
||||||
compatible = "espressif,esp32-uart";
|
compatible = "espressif,esp32-uart";
|
||||||
port = <UART_NUM_1>;
|
port = <UART_NUM_1>;
|
||||||
|
|||||||
@ -31,55 +31,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.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
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -16,7 +16,6 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
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)
|
// Touch (Software SPI)
|
||||||
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
@ -12,11 +12,14 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
std::make_shared<tt::RecursiveMutex>(),
|
nullptr,
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SPI3_HOST
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -22,6 +23,28 @@
|
|||||||
pin-scl = <22>;
|
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 {
|
uart1 {
|
||||||
compatible = "espressif,esp32-uart";
|
compatible = "espressif,esp32-uart";
|
||||||
port = <UART_NUM_1>;
|
port = <UART_NUM_1>;
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
bool initBoot() {
|
static bool initBoot() {
|
||||||
if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT)) {
|
if (!driver::pwmbacklight::init(LCD_PIN_BACKLIGHT)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -45,55 +45,5 @@ static tt::hal::DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const tt::hal::Configuration hardwareConfiguration = {
|
extern const tt::hal::Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// Display
|
|
||||||
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,
|
|
||||||
.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 = tt::hal::spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
|
||||||
},
|
|
||||||
// SD card
|
|
||||||
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,
|
|
||||||
.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 = tt::hal::spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -14,6 +14,5 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
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();
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
#include <Tactility/RecursiveMutex.h>
|
#include <Tactility/RecursiveMutex.h>
|
||||||
@ -21,8 +22,12 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
SDCARD_SPI_HOST
|
SDCARD_SPI_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -20,4 +21,26 @@
|
|||||||
pin-sda = <33>;
|
pin-sda = <33>;
|
||||||
pin-scl = <32>;
|
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>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -22,31 +22,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// SD Card & display init
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_47,
|
|
||||||
.miso_io_num = GPIO_NUM_41,
|
|
||||||
.sclk_io_num = GPIO_NUM_48,
|
|
||||||
.quadwp_io_num = -1,
|
|
||||||
.quadhd_io_num = GPIO_NUM_42,
|
|
||||||
.data4_io_num = -1,
|
|
||||||
.data5_io_num = -1,
|
|
||||||
.data6_io_num = -1,
|
|
||||||
.data7_io_num = -1,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = 1024 * 128,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
@ -16,10 +17,12 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
std::vector { GPIO_NUM_39 }
|
std::vector { GPIO_NUM_39 }
|
||||||
);
|
);
|
||||||
|
|
||||||
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
auto* spi_controller = device_find_by_name("spi0");
|
||||||
std::move(config)
|
check(spi_controller, "spi0 not found");
|
||||||
);
|
|
||||||
|
|
||||||
return std::static_pointer_cast<SdCardDevice>(sdcard);
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
|
std::move(config),
|
||||||
|
spi_controller
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
#include <EspLcdDisplay.h>
|
#include <EspLcdDisplay.h>
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
|
|
||||||
@ -21,7 +19,7 @@ class St7701Display final : public EspLcdDisplay {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
St7701Display() : EspLcdDisplay(std::make_shared<tt::RecursiveMutex>()) {}
|
St7701Display() : EspLcdDisplay() {}
|
||||||
|
|
||||||
std::string getName() const override { return "ST7701S"; }
|
std::string getName() const override { return "ST7701S"; }
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -19,7 +20,16 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <19>;
|
pin-sda = <19>;
|
||||||
pin-scl = <45>;
|
pin-scl = <45>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <47>;
|
||||||
|
pin-miso = <41>;
|
||||||
|
pin-sclk = <48>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <42>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -21,31 +21,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// SD Card
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_11,
|
|
||||||
.miso_io_num = GPIO_NUM_13,
|
|
||||||
.sclk_io_num = GPIO_NUM_12,
|
|
||||||
.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 = 8192,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
@ -14,9 +15,11 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
SdCardDevice::MountBehaviour::AtBoot
|
SdCardDevice::MountBehaviour::AtBoot
|
||||||
);
|
);
|
||||||
|
|
||||||
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
auto* spi_controller = device_find_by_name("spi0");
|
||||||
std::move(config)
|
check(spi_controller, "spi0 not found");
|
||||||
);
|
|
||||||
|
|
||||||
return std::static_pointer_cast<SdCardDevice>(sdcard);
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
|
std::move(config),
|
||||||
|
spi_controller
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -20,8 +21,6 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <19>;
|
pin-sda = <19>;
|
||||||
pin-scl = <20>;
|
pin-scl = <20>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i2c_external {
|
i2c_external {
|
||||||
@ -32,6 +31,17 @@
|
|||||||
pin-scl = <18>;
|
pin-scl = <18>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <11>;
|
||||||
|
pin-miso = <13>;
|
||||||
|
pin-sclk = <12>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
compatible = "espressif,esp32-uart";
|
compatible = "espressif,esp32-uart";
|
||||||
port = <UART_NUM_1>;
|
port = <UART_NUM_1>;
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
@ -19,54 +18,5 @@ static tt::hal::DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const tt::hal::Configuration hardwareConfiguration = {
|
extern const tt::hal::Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.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_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 = tt::hal::spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
},
|
|
||||||
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,
|
|
||||||
.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 = tt::hal::spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -13,7 +13,6 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = (LCD_VERTICAL_RESOLUTION / 10);
|
constexpr auto LCD_BUFFER_HEIGHT = (LCD_VERTICAL_RESOLUTION / 10);
|
||||||
constexpr auto LCD_BUFFER_SIZE = (LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT);
|
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)
|
// Touch (Software SPI)
|
||||||
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_39;
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/RecursiveMutex.h>
|
#include <Tactility/RecursiveMutex.h>
|
||||||
|
|
||||||
@ -11,12 +13,16 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
std::make_shared<tt::RecursiveMutex>(),
|
nullptr,
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SPI3_HOST
|
SPI3_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -11,4 +12,26 @@
|
|||||||
compatible = "espressif,esp32-gpio";
|
compatible = "espressif,esp32-gpio";
|
||||||
gpio-count = <40>;
|
gpio-count = <40>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -23,56 +23,5 @@ static tt::hal::DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
// Display
|
|
||||||
.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_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 = DISPLAY_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()
|
|
||||||
},
|
|
||||||
// SD Card
|
|
||||||
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,
|
|
||||||
.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 = 8192,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = tt::hal::spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
@ -14,7 +14,6 @@ constexpr auto DISPLAY_VERTICAL_RESOLUTION = 320;
|
|||||||
constexpr auto DISPLAY_DRAW_BUFFER_HEIGHT = (DISPLAY_VERTICAL_RESOLUTION / 10);
|
constexpr auto DISPLAY_DRAW_BUFFER_HEIGHT = (DISPLAY_VERTICAL_RESOLUTION / 10);
|
||||||
constexpr auto DISPLAY_DRAW_BUFFER_SIZE = (DISPLAY_HORIZONTAL_RESOLUTION * DISPLAY_DRAW_BUFFER_HEIGHT);
|
constexpr auto DISPLAY_DRAW_BUFFER_SIZE = (DISPLAY_HORIZONTAL_RESOLUTION * DISPLAY_DRAW_BUFFER_HEIGHT);
|
||||||
constexpr auto DISPLAY_BACKLIGHT_PIN = GPIO_NUM_27;
|
constexpr auto DISPLAY_BACKLIGHT_PIN = GPIO_NUM_27;
|
||||||
constexpr auto DISPLAY_SPI_TRANSFER_SIZE_LIMIT = DISPLAY_DRAW_BUFFER_SIZE * sizeof(lv_color_t);
|
|
||||||
|
|
||||||
// Touch (XPT2046, resistive, shared SPI with display)
|
// Touch (XPT2046, resistive, shared SPI with display)
|
||||||
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_12;
|
constexpr auto TOUCH_MISO_PIN = GPIO_NUM_12;
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/RecursiveMutex.h>
|
#include <Tactility/RecursiveMutex.h>
|
||||||
|
|
||||||
@ -17,7 +19,11 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
SD_SPI_HOST // SPI host for SD card (SPI3_HOST)
|
SD_SPI_HOST // SPI host for SD card (SPI3_HOST)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -20,4 +21,26 @@
|
|||||||
pin-sda = <32>;
|
pin-sda = <32>;
|
||||||
pin-scl = <25>;
|
pin-scl = <25>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
@ -21,55 +20,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// Display
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_DISABLED,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_39,
|
|
||||||
.miso_io_num = GPIO_NUM_NC,
|
|
||||||
.sclk_io_num = GPIO_NUM_42,
|
|
||||||
.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() // esp_lvgl_port owns the lock for the display
|
|
||||||
},
|
|
||||||
// SD card
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_6,
|
|
||||||
.miso_io_num = GPIO_NUM_4,
|
|
||||||
.sclk_io_num = GPIO_NUM_5,
|
|
||||||
.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 = 32768,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr // No custom lock needed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,6 +12,5 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
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();
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
@ -14,12 +14,16 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
tt::lvgl::getSyncLock(),
|
nullptr,
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SPI3_HOST
|
SPI3_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -20,8 +21,28 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <15>;
|
pin-sda = <15>;
|
||||||
pin-scl = <16>;
|
pin-scl = <16>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
display_spi: spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <39>;
|
||||||
|
pin-miso = <GPIO_PIN_NONE>;
|
||||||
|
pin-sclk = <42>;
|
||||||
|
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 = <6>;
|
||||||
|
pin-miso = <4>;
|
||||||
|
pin-sclk = <5>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@ -3,11 +3,8 @@
|
|||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
#define CROWPANEL_SPI_TRANSFER_SIZE_LIMIT (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8))
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
static bool initBoot() {
|
static bool initBoot() {
|
||||||
@ -23,55 +20,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// Display
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_DISABLED,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_39,
|
|
||||||
.miso_io_num = GPIO_NUM_NC,
|
|
||||||
.sclk_io_num = GPIO_NUM_42,
|
|
||||||
.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 = CROWPANEL_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() // esp_lvgl_port owns the lock for the display
|
|
||||||
},
|
|
||||||
// SD card
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_6,
|
|
||||||
.miso_io_num = GPIO_NUM_4,
|
|
||||||
.sclk_io_num = GPIO_NUM_5,
|
|
||||||
.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 = 32768,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr // No custom lock needed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
@ -14,12 +14,16 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
tt::lvgl::getSyncLock(),
|
nullptr,
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SPI3_HOST
|
SPI3_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -20,8 +21,28 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <15>;
|
pin-sda = <15>;
|
||||||
pin-scl = <16>;
|
pin-scl = <16>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
display_spi: spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <39>;
|
||||||
|
pin-miso = <GPIO_PIN_NONE>;
|
||||||
|
pin-sclk = <42>;
|
||||||
|
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 = <6>;
|
||||||
|
pin-miso = <4>;
|
||||||
|
pin-sclk = <5>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@ -31,31 +31,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// SD card
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_6,
|
|
||||||
.miso_io_num = GPIO_NUM_4,
|
|
||||||
.sclk_io_num = GPIO_NUM_5,
|
|
||||||
.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 = 8192,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr // No custom lock needed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
@ -15,7 +15,11 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
SdCardDevice::MountBehaviour::AtBoot
|
SdCardDevice::MountBehaviour::AtBoot
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi0");
|
||||||
|
check(spi_controller, "spi0 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -20,8 +21,17 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <15>;
|
pin-sda = <15>;
|
||||||
pin-scl = <16>;
|
pin-scl = <16>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
sdcard_spi: spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <6>;
|
||||||
|
pin-miso = <4>;
|
||||||
|
pin-sclk = <5>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Xpt2046Power.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
@ -15,63 +13,12 @@ static bool initBoot() {
|
|||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
std::make_shared<Xpt2046Power>(),
|
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard(),
|
createSdCard()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// Display
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_DISABLED,
|
|
||||||
.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() // esp_lvgl_port owns the lock for the display
|
|
||||||
},
|
|
||||||
// SD card
|
|
||||||
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 = 32768,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr // No custom lock needed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
@ -17,7 +18,11 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
SPI3_HOST
|
SPI3_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -20,8 +21,28 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <22>;
|
pin-sda = <22>;
|
||||||
pin-scl = <21>;
|
pin-scl = <21>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
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 = <65536>;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 {
|
uart1 {
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "Tactility/lvgl/LvglSync.h"
|
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Xpt2046Power.h>
|
|
||||||
|
|
||||||
constexpr auto CROWPANEL_SPI_TRANSFER_SIZE_LIMIT = (CROWPANEL_LCD_HORIZONTAL_RESOLUTION * CROWPANEL_LCD_SPI_TRANSFER_HEIGHT * (LV_COLOR_DEPTH / 8));
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
@ -17,63 +13,12 @@ static bool initBoot() {
|
|||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
std::make_shared<Xpt2046Power>(),
|
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard(),
|
createSdCard()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// Display
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_DISABLED,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_13,
|
|
||||||
.miso_io_num = GPIO_NUM_33,
|
|
||||||
.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 = CROWPANEL_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() // esp_lvgl_port owns the lock for the display
|
|
||||||
},
|
|
||||||
// SD card
|
|
||||||
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 = 32768,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr // No custom lock needed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
@ -17,7 +18,11 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
SPI3_HOST
|
SPI3_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -20,8 +21,28 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <22>;
|
pin-sda = <22>;
|
||||||
pin-scl = <21>;
|
pin-scl = <21>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
display_spi: spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <13>;
|
||||||
|
pin-miso = <33>;
|
||||||
|
pin-sclk = <14>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <65536>;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 {
|
uart1 {
|
||||||
|
|||||||
@ -21,31 +21,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// SD card
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_11,
|
|
||||||
.miso_io_num = GPIO_NUM_13,
|
|
||||||
.sclk_io_num = GPIO_NUM_12,
|
|
||||||
.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 = 8192,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
@ -13,7 +14,11 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
SdCardDevice::MountBehaviour::AtBoot
|
SdCardDevice::MountBehaviour::AtBoot
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi0");
|
||||||
|
check(spi_controller, "spi0 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -20,8 +21,17 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <19>;
|
pin-sda = <19>;
|
||||||
pin-scl = <20>;
|
pin-scl = <20>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
sdcard_spi: spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <11>;
|
||||||
|
pin-miso = <13>;
|
||||||
|
pin-sclk = <12>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@ -8,11 +8,6 @@
|
|||||||
|
|
||||||
class Jd9165Display final : public EspLcdDisplayV2 {
|
class Jd9165Display final : public EspLcdDisplayV2 {
|
||||||
|
|
||||||
class NoLock final : public tt::Lock {
|
|
||||||
bool lock(TickType_t timeout) const override { return true; }
|
|
||||||
void unlock() const override { /* NO-OP */ }
|
|
||||||
};
|
|
||||||
|
|
||||||
esp_lcd_dsi_bus_handle_t mipiDsiBus = nullptr;
|
esp_lcd_dsi_bus_handle_t mipiDsiBus = nullptr;
|
||||||
esp_ldo_channel_handle_t ldoChannel = nullptr;
|
esp_ldo_channel_handle_t ldoChannel = nullptr;
|
||||||
|
|
||||||
@ -34,7 +29,7 @@ public:
|
|||||||
|
|
||||||
Jd9165Display(
|
Jd9165Display(
|
||||||
const std::shared_ptr<EspLcdConfiguration>& configuration
|
const std::shared_ptr<EspLcdConfiguration>& configuration
|
||||||
) : EspLcdDisplayV2(configuration, std::make_shared<NoLock>()) {}
|
) : EspLcdDisplayV2(configuration) {}
|
||||||
|
|
||||||
~Jd9165Display() override;
|
~Jd9165Display() override;
|
||||||
|
|
||||||
|
|||||||
@ -28,8 +28,6 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <7>;
|
pin-sda = <7>;
|
||||||
pin-scl = <8>;
|
pin-scl = <8>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i2s0 {
|
i2s0 {
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
@ -31,55 +30,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.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_NC,
|
|
||||||
.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()
|
|
||||||
},
|
|
||||||
//SD Card
|
|
||||||
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 = 8192,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -18,6 +18,5 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 240;
|
|||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
constexpr auto LCD_VERTICAL_RESOLUTION = 320;
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
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();
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
||||||
@ -16,13 +15,17 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
std::make_shared<tt::RecursiveMutex>(),
|
nullptr,
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SDCARD_SPI_HOST
|
SDCARD_SPI_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -31,6 +32,28 @@
|
|||||||
pin-scl = <22>;
|
pin-scl = <22>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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>;
|
||||||
|
};
|
||||||
|
|
||||||
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||||
uart1 {
|
uart1 {
|
||||||
compatible = "espressif,esp32-uart";
|
compatible = "espressif,esp32-uart";
|
||||||
|
|||||||
@ -485,7 +485,6 @@ std::shared_ptr<tt::hal::display::DisplayDriver> Axs15231bDisplay::getDisplayDri
|
|||||||
if (displayDriver == nullptr) {
|
if (displayDriver == nullptr) {
|
||||||
displayDriver = std::make_shared<EspLcdDisplayDriver>(
|
displayDriver = std::make_shared<EspLcdDisplayDriver>(
|
||||||
panelHandle,
|
panelHandle,
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
configuration->horizontalResolution,
|
configuration->horizontalResolution,
|
||||||
configuration->verticalResolution,
|
configuration->verticalResolution,
|
||||||
tt::hal::display::ColorFormat::RGB565Swapped
|
tt::hal::display::ColorFormat::RGB565Swapped
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Tactility/hal/spi/Spi.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/display/DisplayDevice.h>
|
#include <Tactility/hal/display/DisplayDevice.h>
|
||||||
#include <Tactility/hal/display/DisplayDriver.h>
|
#include <Tactility/hal/display/DisplayDriver.h>
|
||||||
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
#include <driver/spi_common.h>
|
||||||
#include <esp_lcd_panel_io.h>
|
#include <esp_lcd_panel_io.h>
|
||||||
#include <esp_lcd_types.h>
|
#include <esp_lcd_types.h>
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
|
|||||||
@ -3,13 +3,10 @@
|
|||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
static constexpr int SPI_TRANSFER_SIZE_LIMIT = 320 * 10;
|
|
||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
@ -23,57 +20,5 @@ static bool initBoot() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
//I2C Internal - Touch
|
|
||||||
//I2C External - P3 (JST SH 1.0)/ P4 (JST SH 1.25) headers - GND 3.3V IO17 IO18
|
|
||||||
.spi {
|
|
||||||
//Display
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.data0_io_num = GPIO_NUM_21,
|
|
||||||
.data1_io_num = GPIO_NUM_48,
|
|
||||||
.sclk_io_num = GPIO_NUM_47,
|
|
||||||
.data2_io_num = GPIO_NUM_40,
|
|
||||||
.data3_io_num = GPIO_NUM_39,
|
|
||||||
.data4_io_num = -1,
|
|
||||||
.data5_io_num = -1,
|
|
||||||
.data6_io_num = -1,
|
|
||||||
.data7_io_num = -1,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = 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()
|
|
||||||
},
|
|
||||||
//SD Card
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_11,
|
|
||||||
.miso_io_num = GPIO_NUM_13,
|
|
||||||
.sclk_io_num = GPIO_NUM_12,
|
|
||||||
.quadwp_io_num = -1,
|
|
||||||
.quadhd_io_num = -1,
|
|
||||||
.data4_io_num = -1,
|
|
||||||
.data5_io_num = -1,
|
|
||||||
.data6_io_num = -1,
|
|
||||||
.data7_io_num = -1,
|
|
||||||
.data_io_default_level = false,
|
|
||||||
.max_transfer_sz = 8192,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_10;
|
constexpr auto SDCARD_PIN_CS = GPIO_NUM_10;
|
||||||
@ -15,12 +15,16 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
std::make_shared<tt::RecursiveMutex>(),
|
nullptr,
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SDCARD_SPI_HOST
|
SDCARD_SPI_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -20,8 +21,6 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <4>;
|
pin-sda = <4>;
|
||||||
pin-scl = <8>;
|
pin-scl = <8>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i2c_external: i2c1 {
|
i2c_external: i2c1 {
|
||||||
@ -30,8 +29,28 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <17>;
|
pin-sda = <17>;
|
||||||
pin-scl = <18>;
|
pin-scl = <18>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
display_spi: spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <21>;
|
||||||
|
pin-miso = <48>;
|
||||||
|
pin-sclk = <47>;
|
||||||
|
pin-wp = <40>;
|
||||||
|
pin-hd = <39>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
sdcard_spi: spi1 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI3_HOST>;
|
||||||
|
pin-mosi = <11>;
|
||||||
|
pin-miso = <13>;
|
||||||
|
pin-sclk = <12>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// P1 header
|
// P1 header
|
||||||
|
|||||||
@ -20,31 +20,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
//SD Card
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_11,
|
|
||||||
.miso_io_num = GPIO_NUM_13,
|
|
||||||
.sclk_io_num = GPIO_NUM_12,
|
|
||||||
.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 = 8192,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = nullptr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/RecursiveMutex.h>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
using tt::hal::sdcard::SpiSdCardDevice;
|
||||||
|
|
||||||
@ -12,15 +11,14 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot
|
||||||
std::make_shared<tt::RecursiveMutex>(),
|
|
||||||
std::vector<gpio_num_t>(),
|
|
||||||
SPI2_HOST
|
|
||||||
);
|
);
|
||||||
|
|
||||||
auto sdcard = std::make_shared<SpiSdCardDevice>(
|
auto* spi_controller = device_find_by_name("spi0");
|
||||||
std::move(config)
|
check(spi_controller, "spi0 not found");
|
||||||
);
|
|
||||||
|
|
||||||
return std::static_pointer_cast<SdCardDevice>(sdcard);
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
|
std::move(config),
|
||||||
|
spi_controller
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -20,8 +21,6 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <19>;
|
pin-sda = <19>;
|
||||||
pin-scl = <20>;
|
pin-scl = <20>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i2c_external: i2c1 {
|
i2c_external: i2c1 {
|
||||||
@ -30,8 +29,17 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <17>;
|
pin-sda = <17>;
|
||||||
pin-scl = <18>;
|
pin-scl = <18>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <11>;
|
||||||
|
pin-miso = <13>;
|
||||||
|
pin-sclk = <12>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@ -2,15 +2,13 @@
|
|||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
#include "devices/Constants.h"
|
#include "devices/Constants.h"
|
||||||
|
|
||||||
|
#include <tactility/log.h>
|
||||||
|
#include <tactility/freertos/task.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Tactility/Logger.h>
|
|
||||||
#include <ButtonControl.h>
|
#include <ButtonControl.h>
|
||||||
|
|
||||||
#include "driver/gpio.h"
|
#include <driver/gpio.h>
|
||||||
#include "driver/i2c.h"
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
|
|
||||||
static void enableOledPower() {
|
static void enableOledPower() {
|
||||||
gpio_config_t io_conf = {
|
gpio_config_t io_conf = {
|
||||||
@ -24,7 +22,7 @@ static void enableOledPower() {
|
|||||||
gpio_set_level(DISPLAY_PIN_POWER, 0); // Active low
|
gpio_set_level(DISPLAY_PIN_POWER, 0); // Active low
|
||||||
|
|
||||||
vTaskDelay(pdMS_TO_TICKS(500)); // Add a small delay for power to stabilize
|
vTaskDelay(pdMS_TO_TICKS(500)); // Add a small delay for power to stabilize
|
||||||
tt::Logger("HeltecV3").info("OLED power enabled");
|
LOG_I("HeltecV3", "OLED power enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool initBoot() {
|
static bool initBoot() {
|
||||||
@ -47,6 +45,5 @@ static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
|
|||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.uiScale = UiScale::Smallest,
|
.uiScale = UiScale::Smallest,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {},
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -19,7 +19,5 @@
|
|||||||
clock-frequency = <200000>;
|
clock-frequency = <200000>;
|
||||||
pin-sda = <17>;
|
pin-sda = <17>;
|
||||||
pin-scl = <18>;
|
pin-scl = <18>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
#include "devices/Sdcard.h"
|
#include "devices/Sdcard.h"
|
||||||
#include "devices/TdeckKeyboard.h"
|
#include "devices/TdeckKeyboard.h"
|
||||||
#include "devices/TrackballDevice.h"
|
#include "devices/TrackballDevice.h"
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
@ -26,30 +25,5 @@ static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_41,
|
|
||||||
.miso_io_num = GPIO_NUM_38,
|
|
||||||
.sclk_io_num = GPIO_NUM_40,
|
|
||||||
.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 = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock() // esp_lvgl_port owns the lock for the display
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#include "Sdcard.h"
|
#include "Sdcard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
@ -23,7 +25,10 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
::Device* spiController = device_find_by_name("spi0");
|
||||||
|
check(spiController != nullptr, "spi0 not found");
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spiController
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
// Reference: https://wiki.lilygo.cc/get_started/en/Wearable/T-Deck-Plus/T-Deck-Plus.html#Pin-Overview
|
// Reference: https://wiki.lilygo.cc/get_started/en/Wearable/T-Deck-Plus/T-Deck-Plus.html#Pin-Overview
|
||||||
@ -42,6 +43,17 @@
|
|||||||
pin-mclk = <GPIO_PIN_NONE>;
|
pin-mclk = <GPIO_PIN_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <41>;
|
||||||
|
pin-miso = <38>;
|
||||||
|
pin-sclk = <40>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
compatible = "espressif,esp32-uart";
|
compatible = "espressif,esp32-uart";
|
||||||
port = <UART_NUM_1>;
|
port = <UART_NUM_1>;
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <ButtonControl.h>
|
#include <ButtonControl.h>
|
||||||
|
|
||||||
bool initBoot();
|
bool initBoot();
|
||||||
@ -20,21 +18,5 @@ static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_7,
|
|
||||||
.miso_io_num = GPIO_NUM_NC,
|
|
||||||
.sclk_io_num = GPIO_NUM_6,
|
|
||||||
.max_transfer_sz = DISPLAY_HORIZONTAL_RESOLUTION * DISPLAY_VERTICAL_RESOLUTION * 2,
|
|
||||||
.flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,13 +4,9 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "Tactility/kernel/SystemEvents.h"
|
#include "Tactility/kernel/SystemEvents.h"
|
||||||
#include <Tactility/TactilityCore.h>
|
#include <Tactility/TactilityCore.h>
|
||||||
#include <Tactility/hal/spi/Spi.h>
|
|
||||||
|
|
||||||
#define TAG "tdisplay-s3"
|
#define TAG "tdisplay-s3"
|
||||||
|
|
||||||
// Power on
|
|
||||||
|
|
||||||
|
|
||||||
static bool powerOn() {
|
static bool powerOn() {
|
||||||
gpio_config_t power_signal_config = {
|
gpio_config_t power_signal_config = {
|
||||||
.pin_bit_mask = BIT64(TDISPLAY_S3_POWERON_GPIO),
|
.pin_bit_mask = BIT64(TDISPLAY_S3_POWERON_GPIO),
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -12,4 +13,15 @@
|
|||||||
compatible = "espressif,esp32-gpio";
|
compatible = "espressif,esp32-gpio";
|
||||||
gpio-count = <49>;
|
gpio-count = <49>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <7>;
|
||||||
|
pin-miso = <GPIO_PIN_NONE>;
|
||||||
|
pin-sclk = <6>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <ButtonControl.h>
|
#include <ButtonControl.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
@ -22,29 +20,5 @@ static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
|
|||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.uiScale = UiScale::Smallest,
|
.uiScale = UiScale::Smallest,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_19,
|
|
||||||
.miso_io_num = GPIO_NUM_NC,
|
|
||||||
.sclk_io_num = GPIO_NUM_18,
|
|
||||||
.quadwp_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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -14,6 +14,5 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 135;
|
|||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 240;
|
constexpr auto LCD_VERTICAL_RESOLUTION = 240;
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 3;
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 3;
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
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();
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -12,4 +13,15 @@
|
|||||||
compatible = "espressif,esp32-gpio";
|
compatible = "espressif,esp32-gpio";
|
||||||
gpio-count = <49>;
|
gpio-count = <49>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <19>;
|
||||||
|
pin-miso = <GPIO_PIN_NONE>;
|
||||||
|
pin-sclk = <18>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,11 +1,7 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/Sdcard.h"
|
#include "devices/Sdcard.h"
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
#define TDECK_SPI_TRANSFER_SIZE_LIMIT (80 * 160 * (LV_COLOR_DEPTH / 8))
|
|
||||||
|
|
||||||
bool initBoot();
|
bool initBoot();
|
||||||
|
|
||||||
@ -21,29 +17,5 @@ static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
|
|||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.uiScale = UiScale::Smallest,
|
.uiScale = UiScale::Smallest,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_3,
|
|
||||||
.miso_io_num = GPIO_NUM_NC,
|
|
||||||
.sclk_io_num = GPIO_NUM_5,
|
|
||||||
.quadwp_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 = TDECK_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() // esp_lvgl_port owns the lock for the display
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
#include <St7735Display.h>
|
#include <St7735Display.h>
|
||||||
|
|
||||||
#define LCD_SPI_HOST SPI3_HOST
|
#define LCD_SPI_HOST SPI2_HOST
|
||||||
#define LCD_PIN_CS GPIO_NUM_4
|
#define LCD_PIN_CS GPIO_NUM_4
|
||||||
#define LCD_PIN_DC GPIO_NUM_2
|
#define LCD_PIN_DC GPIO_NUM_2
|
||||||
#define LCD_PIN_RESET GPIO_NUM_1
|
#define LCD_PIN_RESET GPIO_NUM_1
|
||||||
#define LCD_HORIZONTAL_RESOLUTION 80
|
#define LCD_HORIZONTAL_RESOLUTION 80
|
||||||
#define LCD_VERTICAL_RESOLUTION 160
|
#define LCD_VERTICAL_RESOLUTION 160
|
||||||
#define LCD_SPI_TRANSFER_HEIGHT LCD_VERTICAL_RESOLUTION / 4
|
#define LCD_SPI_TRANSFER_HEIGHT (LCD_VERTICAL_RESOLUTION / 4)
|
||||||
|
|
||||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||||
auto configuration = std::make_unique<St7735Display::Configuration>(
|
auto configuration = std::make_unique<St7735Display::Configuration>(
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -20,8 +21,17 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <44>;
|
pin-sda = <44>;
|
||||||
pin-scl = <43>;
|
pin-scl = <43>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <3>;
|
||||||
|
pin-miso = <GPIO_PIN_NONE>;
|
||||||
|
pin-sclk = <5>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
stemma_qt: uart1 {
|
stemma_qt: uart1 {
|
||||||
|
|||||||
@ -6,12 +6,9 @@
|
|||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Bq25896.h>
|
#include <Bq25896.h>
|
||||||
#include <Drv2605.h>
|
#include <Drv2605.h>
|
||||||
|
|
||||||
#define TPAGER_SPI_TRANSFER_SIZE_LIMIT (480 * 222 * (LV_COLOR_DEPTH / 8))
|
|
||||||
|
|
||||||
bool tpagerInit();
|
bool tpagerInit();
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
@ -38,28 +35,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = tpagerInit,
|
.initBoot = tpagerInit,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_34,
|
|
||||||
.miso_io_num = GPIO_NUM_33,
|
|
||||||
.sclk_io_num = GPIO_NUM_35,
|
|
||||||
.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 = TPAGER_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() // esp_lvgl_port owns the lock for the display
|
|
||||||
}}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
@ -23,7 +24,11 @@ std::shared_ptr<SdCardDevice> createTpagerSdCard() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi0");
|
||||||
|
check(spi_controller, "spi0 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
// Reference: https://wiki.lilygo.cc/get_started/en/LoRa_GPS/T-LoraPager/T-LoraPager.html#Pin-Overview
|
// Reference: https://wiki.lilygo.cc/get_started/en/LoRa_GPS/T-LoraPager/T-LoraPager.html#Pin-Overview
|
||||||
@ -24,6 +25,17 @@
|
|||||||
pin-scl = <2>;
|
pin-scl = <2>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <34>;
|
||||||
|
pin-miso = <33>;
|
||||||
|
pin-sclk = <35>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
// ES8311
|
// ES8311
|
||||||
// TODO: init via I2C to enable audio playback
|
// TODO: init via I2C to enable audio playback
|
||||||
i2s0 {
|
i2s0 {
|
||||||
|
|||||||
@ -5,14 +5,13 @@
|
|||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
#include <Tca8418.h>
|
#include <Tca8418.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
bool initBoot() {
|
static bool initBoot() {
|
||||||
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT, 512);
|
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT, 512);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,55 +29,5 @@ static DeviceVector createDevices() {
|
|||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.uiScale = UiScale::Smallest,
|
.uiScale = UiScale::Smallest,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// Display
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_35,
|
|
||||||
.miso_io_num = GPIO_NUM_NC,
|
|
||||||
.sclk_io_num = GPIO_NUM_36,
|
|
||||||
.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_14,
|
|
||||||
.miso_io_num = GPIO_NUM_39,
|
|
||||||
.sclk_io_num = GPIO_NUM_40,
|
|
||||||
.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 = nullptr
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_12;
|
constexpr auto SDCARD_PIN_CS = GPIO_NUM_12;
|
||||||
@ -14,12 +15,16 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
tt::hal::spi::getLock(SPI3_HOST),
|
nullptr,
|
||||||
std::vector { EXPANSION_HEADER_PIN_CS },
|
std::vector { EXPANSION_HEADER_PIN_CS },
|
||||||
SPI3_HOST
|
SPI3_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
// Reference: https://docs.m5stack.com/en/core/Cardputer-Adv
|
// Reference: https://docs.m5stack.com/en/core/Cardputer-Adv
|
||||||
@ -22,8 +23,6 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <8>;
|
pin-sda = <8>;
|
||||||
pin-scl = <9>;
|
pin-scl = <9>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i2c_port_a {
|
i2c_port_a {
|
||||||
@ -32,8 +31,28 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <2>;
|
pin-sda = <2>;
|
||||||
pin-scl = <1>;
|
pin-scl = <1>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
display_spi: spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <35>;
|
||||||
|
pin-miso = <GPIO_PIN_NONE>;
|
||||||
|
pin-sclk = <36>;
|
||||||
|
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 = <14>;
|
||||||
|
pin-miso = <39>;
|
||||||
|
pin-sclk = <40>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Speaker and microphone (ES8311)
|
// Speaker and microphone (ES8311)
|
||||||
|
|||||||
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
@ -28,56 +27,5 @@ static DeviceVector createDevices() {
|
|||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.uiScale = UiScale::Smallest,
|
.uiScale = UiScale::Smallest,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
// Display
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_35,
|
|
||||||
.miso_io_num = GPIO_NUM_NC,
|
|
||||||
.sclk_io_num = GPIO_NUM_36,
|
|
||||||
.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_14,
|
|
||||||
.miso_io_num = GPIO_NUM_39,
|
|
||||||
.sclk_io_num = GPIO_NUM_40,
|
|
||||||
.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 = nullptr
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_12;
|
constexpr auto SDCARD_PIN_CS = GPIO_NUM_12;
|
||||||
@ -13,12 +14,16 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
tt::hal::spi::getLock(SPI3_HOST),
|
nullptr,
|
||||||
std::vector<gpio_num_t>(),
|
std::vector<gpio_num_t>(),
|
||||||
SPI3_HOST
|
SPI3_HOST
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi1");
|
||||||
|
check(spi_controller, "spi1 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
// Reference: https://docs.m5stack.com/en/core/Cardputer
|
// Reference: https://docs.m5stack.com/en/core/Cardputer
|
||||||
@ -22,8 +23,28 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <2>;
|
pin-sda = <2>;
|
||||||
pin-scl = <1>;
|
pin-scl = <1>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
display_spi: spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <35>;
|
||||||
|
pin-miso = <GPIO_PIN_NONE>;
|
||||||
|
pin-sclk = <36>;
|
||||||
|
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 = <14>;
|
||||||
|
pin-miso = <39>;
|
||||||
|
pin-sclk = <40>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Speaker and microphone
|
// Speaker and microphone
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
bool initBoot() {
|
static bool initBoot() {
|
||||||
return initAxp();
|
return initAxp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,30 +20,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_23,
|
|
||||||
.miso_io_num = GPIO_NUM_38,
|
|
||||||
.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 = 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() // esp_lvgl_port owns the lock for the display
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -12,6 +12,5 @@ constexpr auto LCD_HORIZONTAL_RESOLUTION = 320;
|
|||||||
constexpr auto LCD_VERTICAL_RESOLUTION = 240;
|
constexpr auto LCD_VERTICAL_RESOLUTION = 240;
|
||||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
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();
|
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
|
|
||||||
@ -21,7 +22,11 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi0");
|
||||||
|
check(spi_controller, "spi0 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
// Reference: https://docs.m5stack.com/en/core/Core2
|
// Reference: https://docs.m5stack.com/en/core/Core2
|
||||||
@ -22,8 +23,6 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <21>;
|
pin-sda = <21>;
|
||||||
pin-scl = <22>;
|
pin-scl = <22>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i2c_port_a {
|
i2c_port_a {
|
||||||
@ -32,8 +31,17 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <32>;
|
pin-sda = <32>;
|
||||||
pin-scl = <33>;
|
pin-scl = <33>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <23>;
|
||||||
|
pin-miso = <38>;
|
||||||
|
pin-sclk = <18>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// NS4168: Speaker and microphone
|
// NS4168: Speaker and microphone
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
#include <Axp2101Power.h>
|
#include <Axp2101Power.h>
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
@ -21,30 +20,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = initBoot,
|
.initBoot = initBoot,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI3_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_37,
|
|
||||||
.miso_io_num = GPIO_NUM_35,
|
|
||||||
.sclk_io_num = GPIO_NUM_36,
|
|
||||||
.data2_io_num = GPIO_NUM_NC,
|
|
||||||
.data3_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() // esp_lvgl_port owns the lock for the display
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include <driver/spi_common.h>
|
#include <driver/spi_common.h>
|
||||||
|
|
||||||
// Display
|
// Display
|
||||||
constexpr auto LCD_SPI_HOST = SPI3_HOST;
|
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
||||||
constexpr auto LCD_PIN_CS = GPIO_NUM_3;
|
constexpr auto LCD_PIN_CS = GPIO_NUM_3;
|
||||||
constexpr auto LCD_PIN_DC = GPIO_NUM_35;
|
constexpr auto LCD_PIN_DC = GPIO_NUM_35;
|
||||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 320;
|
constexpr auto LCD_HORIZONTAL_RESOLUTION = 320;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
@ -16,13 +17,14 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot,
|
||||||
tt::lvgl::getSyncLock(),
|
tt::lvgl::getSyncLock(),
|
||||||
std::vector {
|
std::vector { CORES3_LCD_PIN_CS }
|
||||||
CORES3_LCD_PIN_CS
|
|
||||||
},
|
|
||||||
SPI3_HOST
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi0");
|
||||||
|
check(spi_controller, "spi0 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
// Reference: https://docs.m5stack.com/en/core/CoreS3
|
// Reference: https://docs.m5stack.com/en/core/CoreS3
|
||||||
@ -22,8 +23,6 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <12>;
|
pin-sda = <12>;
|
||||||
pin-scl = <11>;
|
pin-scl = <11>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i2c_port_a {
|
i2c_port_a {
|
||||||
@ -32,18 +31,14 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <2>;
|
pin-sda = <2>;
|
||||||
pin-scl = <1>;
|
pin-scl = <1>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
/*
|
||||||
i2c_port_b {
|
i2c_port_b {
|
||||||
compatible = "espressif,esp32-i2c";
|
compatible = "espressif,esp32-i2c";
|
||||||
port = <I2C_NUM_1>;
|
port = <I2C_NUM_1>;
|
||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <9>;
|
pin-sda = <9>;
|
||||||
pin-scl = <8>;
|
pin-scl = <8>;
|
||||||
pin-sda-pullup;
|
|
||||||
pin-scl-pullup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
i2c_port_c {
|
i2c_port_c {
|
||||||
@ -52,8 +47,17 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <18>;
|
pin-sda = <18>;
|
||||||
pin-scl = <17>;
|
pin-scl = <17>;
|
||||||
sda-pullup;
|
};
|
||||||
scl-pullup;
|
*/
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <37>;
|
||||||
|
pin-miso = <35>;
|
||||||
|
pin-sclk = <36>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <0>;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: Enable speaker via ES7210 I2C: https://github.com/m5stack/M5Unified/blob/a6256725481f1bc366655fa48cf03b6095e30ad1/src/M5Unified.cpp#L417
|
// TODO: Enable speaker via ES7210 I2C: https://github.com/m5stack/M5Unified/blob/a6256725481f1bc366655fa48cf03b6095e30ad1/src/M5Unified.cpp#L417
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
#include "devices/SdCard.h"
|
||||||
#include <driver/gpio.h>
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
using namespace tt::hal;
|
using namespace tt::hal;
|
||||||
|
|
||||||
@ -17,30 +15,5 @@ static DeviceVector createDevices() {
|
|||||||
|
|
||||||
extern const Configuration hardwareConfiguration = {
|
extern const Configuration hardwareConfiguration = {
|
||||||
.initBoot = nullptr,
|
.initBoot = nullptr,
|
||||||
.createDevices = createDevices,
|
.createDevices = createDevices
|
||||||
.spi {
|
|
||||||
spi::Configuration {
|
|
||||||
.device = SPI2_HOST,
|
|
||||||
.dma = SPI_DMA_CH_AUTO,
|
|
||||||
.config = {
|
|
||||||
.mosi_io_num = GPIO_NUM_38,
|
|
||||||
.miso_io_num = GPIO_NUM_40,
|
|
||||||
.sclk_io_num = GPIO_NUM_39,
|
|
||||||
.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 = 4096,
|
|
||||||
.flags = 0,
|
|
||||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
|
||||||
.intr_flags = 0
|
|
||||||
},
|
|
||||||
.initMode = spi::InitMode::ByTactility,
|
|
||||||
.isMutable = false,
|
|
||||||
.lock = tt::lvgl::getSyncLock()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#include "SdCard.h"
|
#include "SdCard.h"
|
||||||
|
|
||||||
|
#include <tactility/device.h>
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
#include <Tactility/lvgl/LvglSync.h>
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||||
|
|
||||||
@ -13,13 +14,14 @@ std::shared_ptr<SdCardDevice> createSdCard() {
|
|||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
GPIO_NUM_NC,
|
GPIO_NUM_NC,
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
SdCardDevice::MountBehaviour::AtBoot
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
std::vector<gpio_num_t>{},
|
|
||||||
SPI2_HOST
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto* spi_controller = device_find_by_name("spi0");
|
||||||
|
check(spi_controller, "spi0 not found");
|
||||||
|
|
||||||
return std::make_shared<SpiSdCardDevice>(
|
return std::make_shared<SpiSdCardDevice>(
|
||||||
std::move(configuration)
|
std::move(configuration),
|
||||||
|
spi_controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
#include <tactility/bindings/root.h>
|
#include <tactility/bindings/root.h>
|
||||||
#include <tactility/bindings/esp32_gpio.h>
|
#include <tactility/bindings/esp32_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -19,7 +20,16 @@
|
|||||||
clock-frequency = <400000>;
|
clock-frequency = <400000>;
|
||||||
pin-sda = <41>;
|
pin-sda = <41>;
|
||||||
pin-scl = <42>;
|
pin-scl = <42>;
|
||||||
pin-sda-pullup;
|
};
|
||||||
pin-scl-pullup;
|
|
||||||
|
spi0 {
|
||||||
|
compatible = "espressif,esp32-spi";
|
||||||
|
host = <SPI2_HOST>;
|
||||||
|
pin-mosi = <38>;
|
||||||
|
pin-miso = <40>;
|
||||||
|
pin-sclk = <39>;
|
||||||
|
pin-wp = <GPIO_PIN_NONE>;
|
||||||
|
pin-hd = <GPIO_PIN_NONE>;
|
||||||
|
max-transfer-size = <4096>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user