Driver improvements (#535)
- New drivers: - SD SPI - spi_peripheral - touch_placeholder - display_placeholder - Devicetree compiler: - Implement phandle-arrays - Implement device addresses - Add placeholder drivers to all devices with a SPI display - SPI driver: add `cs-pins` and set them to high on driver start - FileSystem: add `file_system_set_owner()` and `file_system_get_owner()` - File locking is now checking if the related `FileSystem` is part of a shared SPI bus - Add `device_get_child_count()` - SDMMC driver: Remove default of `slot` value - Fix for Crowpanel Basic 3.5" display (add delay to booting) - Fix for LilyGO T-HMI SD card mounting (delayed mounting by disabling it initially in the dts)
This commit is contained in:
committed by
GitHub
parent
e50659a3fb
commit
599fa46766
@@ -1,9 +1,7 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <PwmBacklight.h>
|
||||
|
||||
static bool initBoot() {
|
||||
@@ -23,7 +21,6 @@ static bool initBoot() {
|
||||
static tt::hal::DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#define TAG "twodotfour_sdcard"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
|
||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SDCARD_SPI_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -22,18 +24,29 @@
|
||||
pin-scl = <&gpio0 32 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <PwmBacklight.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
@@ -14,8 +11,7 @@ static bool initBoot() {
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
createDisplay()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_5,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(std::move(config), spi_controller);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/touch_placeholder.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
|
||||
/ {
|
||||
@@ -14,20 +17,36 @@
|
||||
gpio-count = <40>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
touch@1 {
|
||||
compatible = "touch-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart1 {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <PwmBacklight.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
@@ -25,7 +23,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_5,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(std::move(config), spi_controller);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/touch_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -23,20 +26,36 @@
|
||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
touch@1 {
|
||||
compatible = "touch-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart1 {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <PwmBacklight.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
@@ -25,7 +23,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_5,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(std::move(config), spi_controller);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/touch_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -23,20 +26,36 @@
|
||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
touch@1 {
|
||||
compatible = "touch-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart1 {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
@@ -39,7 +38,6 @@ static bool initBoot() {
|
||||
static tt::hal::DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.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_PIN_CS = GPIO_NUM_5;
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
std::make_shared<tt::RecursiveMutex>(),
|
||||
std::vector<gpio_num_t>(),
|
||||
SDCARD_SPI_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
model = "CYD 2432S032C";
|
||||
|
||||
gpio1 {
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <40>;
|
||||
};
|
||||
@@ -18,22 +20,33 @@
|
||||
compatible = "espressif,esp32-i2c";
|
||||
port = <I2C_NUM_0>;
|
||||
clock-frequency = <400000>;
|
||||
pin-sda = <&gpio1 33 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio1 32 GPIO_FLAG_NONE>;
|
||||
pin-sda = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 32 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
pin-mosi = <&gpio1 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio1 14 GPIO_FLAG_NONE>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
pin-mosi = <&gpio1 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio1 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio1 18 GPIO_FLAG_NONE>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,34 +1,32 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <PwmBacklight.h>
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static bool initBoot() {
|
||||
//Set the RGB Led Pins to output and turn them off
|
||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red
|
||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green
|
||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); //Blue
|
||||
|
||||
//0 on, 1 off... yep it's backwards.
|
||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); //Red
|
||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); //Green
|
||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue
|
||||
|
||||
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
||||
}
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
extern const Configuration hardwareConfiguration = {
|
||||
.initBoot = initBoot,
|
||||
.createDevices = createDevices
|
||||
};
|
||||
#include "devices/Display.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <PwmBacklight.h>
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static bool initBoot() {
|
||||
//Set the RGB Led Pins to output and turn them off
|
||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_4, GPIO_MODE_OUTPUT)); //Red
|
||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_16, GPIO_MODE_OUTPUT)); //Green
|
||||
ESP_ERROR_CHECK(gpio_set_direction(GPIO_NUM_17, GPIO_MODE_OUTPUT)); //Blue
|
||||
|
||||
//0 on, 1 off... yep it's backwards.
|
||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_4, 1)); //Red
|
||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_16, 1)); //Green
|
||||
ESP_ERROR_CHECK(gpio_set_level(GPIO_NUM_17, 1)); //Blue
|
||||
|
||||
return driver::pwmbacklight::init(LCD_PIN_BACKLIGHT);
|
||||
}
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
};
|
||||
}
|
||||
|
||||
extern const Configuration hardwareConfiguration = {
|
||||
.initBoot = initBoot,
|
||||
.createDevices = createDevices
|
||||
};
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SDCARD_SPI_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
|
||||
@@ -1,58 +1,71 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
model = "CYD 3248S035C";
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <40>;
|
||||
};
|
||||
|
||||
i2c_internal: i2c0 {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
port = <I2C_NUM_0>;
|
||||
clock-frequency = <400000>;
|
||||
pin-sda = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 32 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
// CN1 header
|
||||
i2c_external: i2c1 {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
port = <I2C_NUM_1>;
|
||||
clock-frequency = <400000>;
|
||||
pin-sda = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||
uart1 {
|
||||
compatible = "espressif,esp32-uart";
|
||||
status = "disabled";
|
||||
port = <UART_NUM_1>;
|
||||
pin-tx = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||
pin-rx = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
};
|
||||
};
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
model = "CYD 3248S035C";
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <40>;
|
||||
};
|
||||
|
||||
i2c_internal: i2c0 {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
port = <I2C_NUM_0>;
|
||||
clock-frequency = <400000>;
|
||||
pin-sda = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 32 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
// CN1 header
|
||||
i2c_external: i2c1 {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
port = <I2C_NUM_1>;
|
||||
clock-frequency = <400000>;
|
||||
pin-sda = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||
uart1 {
|
||||
compatible = "espressif,esp32-uart";
|
||||
status = "disabled";
|
||||
port = <UART_NUM_1>;
|
||||
pin-tx = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||
pin-rx = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#include "devices/St7701Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/kernel/SystemEvents.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <PwmBacklight.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
@@ -16,7 +12,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
std::make_shared<St7701Display>(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_42,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
tt::lvgl::getSyncLock(),
|
||||
std::vector { GPIO_NUM_39 }
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi0");
|
||||
check(spi_controller, "spi0 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(config),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -30,9 +31,14 @@
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 47 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 48 GPIO_FLAG_NONE>;
|
||||
pin-hd = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "PwmBacklight.h"
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
@@ -15,7 +13,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_10,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi0");
|
||||
check(spi_controller, "spi0 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(config),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -39,9 +40,15 @@
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart1 {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include "devices/SdCard.h"
|
||||
#include "devices/Display.h"
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <PwmBacklight.h>
|
||||
|
||||
static bool initBoot() {
|
||||
@@ -12,7 +10,6 @@ static bool initBoot() {
|
||||
static tt::hal::DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_5,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -3,6 +3,9 @@
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/touch_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -13,19 +16,35 @@
|
||||
gpio-count = <40>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
touch@1 {
|
||||
compatible = "touch-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "devices/SdCard.h"
|
||||
#include "devices/Display.h"
|
||||
#include "devices/Power.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <PwmBacklight.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
@@ -17,7 +14,6 @@ static tt::hal::DeviceVector createDevices() {
|
||||
return {
|
||||
createPower(),
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
using SdCardDevice = tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
SD_CS_PIN, // CS pin (IO5 on the module)
|
||||
GPIO_NUM_NC, // MOSI override: leave NC to use SPI host pins
|
||||
GPIO_NUM_NC, // MISO override: leave NC
|
||||
GPIO_NUM_NC, // SCLK override: leave NC
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
std::make_shared<tt::RecursiveMutex>(),
|
||||
std::vector<gpio_num_t>(),
|
||||
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>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/spi_common.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
// SD card (microSD)
|
||||
constexpr auto SD_CS_PIN = GPIO_NUM_5;
|
||||
constexpr auto SD_SPI_HOST = SPI3_HOST;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -4,6 +4,9 @@
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/touch_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -22,19 +25,35 @@
|
||||
pin-scl = <&gpio0 25 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
touch@1 {
|
||||
compatible = "touch-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "PwmBacklight.h"
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
@@ -14,7 +12,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
constexpr auto CROWPANEL_SDCARD_PIN_CS = GPIO_NUM_7;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
CROWPANEL_SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -28,19 +30,30 @@
|
||||
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 7 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart0 {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <PwmBacklight.h>
|
||||
@@ -14,7 +12,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
constexpr auto CROWPANEL_SDCARD_PIN_CS = GPIO_NUM_7;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
CROWPANEL_SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -28,19 +30,30 @@
|
||||
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 7 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart0 {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <TCA9534.h>
|
||||
@@ -25,7 +23,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
// See https://github.com/Elecrow-RD/CrowPanel-Advance-HMI-ESP32-AI-Display/blob/master/5.0/factory_code/factory_code.ino
|
||||
GPIO_NUM_0, // It's actually not connected, but in the demo pin 0 is used
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi0");
|
||||
check(spi_controller, "spi0 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -28,12 +29,18 @@
|
||||
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
sdcard_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 0 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart0 {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "PwmBacklight.h"
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
@@ -14,7 +12,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_5,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
tt::lvgl::getSyncLock(),
|
||||
std::vector<gpio_num_t>(),
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -5,6 +5,9 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/touch_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -23,21 +26,37 @@
|
||||
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 33 GPIO_FLAG_NONE>; // Touch
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
max-transfer-size = <65536>;
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
touch@1 {
|
||||
compatible = "touch-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart1 {
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
#include "PwmBacklight.h"
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static bool initBoot() {
|
||||
return driver::pwmbacklight::init(GPIO_NUM_27);
|
||||
driver::pwmbacklight::init(GPIO_NUM_27);
|
||||
// Delay is required, or GUI will lock up.
|
||||
// It's possibly related to the increased power draw when turning on the backlight.
|
||||
vTaskDelay(100);
|
||||
return true;
|
||||
}
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_5,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
tt::lvgl::getSyncLock(),
|
||||
std::vector<gpio_num_t>(),
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -5,6 +5,9 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/touch_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -23,21 +26,37 @@
|
||||
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 12 GPIO_FLAG_NONE>; // Touch
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
max-transfer-size = <65536>;
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
touch@1 {
|
||||
compatible = "touch-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart1 {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <PwmBacklight.h>
|
||||
@@ -15,7 +13,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_10,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi0");
|
||||
check(spi_controller, "spi0 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -28,12 +29,18 @@
|
||||
pin-scl = <&gpio0 20 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
sdcard_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart0 {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/Power.h"
|
||||
#include "devices/SdCard.h"
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
@@ -9,7 +8,6 @@ using namespace tt::hal;
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard(),
|
||||
createPower()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/Mutex.h>
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
#include <driver/sdmmc_defs.h>
|
||||
#include <driver/sdmmc_host.h>
|
||||
#include <esp_check.h>
|
||||
#include <esp_ldo_regulator.h>
|
||||
#include <esp_vfs_fat.h>
|
||||
#include <sdmmc_cmd.h>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
static const auto LOGGER = tt::Logger("JcSdCard");
|
||||
|
||||
// ESP32-P4 Slot 0 uses IO MUX (fixed pins, not manually configurable)
|
||||
// CLK=43, CMD=44, D0=39, D1=40, D2=41, D3=42 (defined automatically by hardware)
|
||||
|
||||
// TODO: Migrate to "espressif,esp32-sdmmc" driver (needs LDO code porting)
|
||||
class SdCardDeviceImpl final : public SdCardDevice {
|
||||
|
||||
class NoLock final : public tt::Lock {
|
||||
bool lock(TickType_t timeout) const override { return true; }
|
||||
void unlock() const override { /* NO-OP */ }
|
||||
};
|
||||
|
||||
std::shared_ptr<tt::Lock> lock = std::make_shared<NoLock>();
|
||||
sdmmc_card_t* card = nullptr;
|
||||
bool mounted = false;
|
||||
std::string mountPath;
|
||||
|
||||
public:
|
||||
SdCardDeviceImpl() : SdCardDevice(MountBehaviour::AtBoot) {}
|
||||
~SdCardDeviceImpl() override {
|
||||
if (mounted) {
|
||||
unmount();
|
||||
}
|
||||
}
|
||||
|
||||
std::string getName() const override { return "SD Card"; }
|
||||
std::string getDescription() const override { return "SD card via SDMMC host"; }
|
||||
|
||||
bool mount(const std::string& newMountPath) override {
|
||||
if (mounted) {
|
||||
return true;
|
||||
}
|
||||
|
||||
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
|
||||
.format_if_mount_failed = false,
|
||||
.max_files = 5,
|
||||
.allocation_unit_size = 64 * 1024,
|
||||
.disk_status_check_enable = false,
|
||||
.use_one_fat = false,
|
||||
};
|
||||
|
||||
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
|
||||
host.slot = SDMMC_HOST_SLOT_0;
|
||||
host.max_freq_khz = SDMMC_FREQ_DEFAULT; // 20MHz - more stable for initialization
|
||||
host.flags = SDMMC_HOST_FLAG_4BIT; // Force 4-bit mode
|
||||
// Configure LDO power supply for SD card (critical on ESP32-P4)
|
||||
esp_ldo_channel_handle_t ldo_handle = nullptr;
|
||||
esp_ldo_channel_config_t ldo_config = {
|
||||
.chan_id = 4, // LDO channel 4 for SD power
|
||||
.voltage_mv = 3300, // 3.3V
|
||||
.flags {
|
||||
.adjustable = 0,
|
||||
.owned_by_hw = 0,
|
||||
.bypass = 0
|
||||
}
|
||||
};
|
||||
|
||||
esp_err_t ldo_ret = esp_ldo_acquire_channel(&ldo_config, &ldo_handle);
|
||||
if (ldo_ret != ESP_OK) {
|
||||
LOGGER.warn("Failed to acquire LDO for SD power: {} (continuing anyway)", esp_err_to_name(ldo_ret));
|
||||
}
|
||||
|
||||
// Slot 0 uses IO MUX - pins are fixed and not specified
|
||||
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
|
||||
slot_config.width = 4;
|
||||
slot_config.cd = SDMMC_SLOT_NO_CD; // No card detect
|
||||
slot_config.wp = SDMMC_SLOT_NO_WP; // No write protect
|
||||
slot_config.flags = 0;
|
||||
|
||||
esp_err_t ret = esp_vfs_fat_sdmmc_mount(newMountPath.c_str(), &host, &slot_config, &mount_config, &card);
|
||||
if (ret != ESP_OK) {
|
||||
LOGGER.error("Failed to mount SD card: {}", esp_err_to_name(ret));
|
||||
card = nullptr;
|
||||
return false;
|
||||
}
|
||||
|
||||
mountPath = newMountPath;
|
||||
mounted = true;
|
||||
LOGGER.info("SD card mounted at {}", mountPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool unmount() override {
|
||||
if (!mounted) {
|
||||
return true;
|
||||
}
|
||||
|
||||
esp_err_t ret = esp_vfs_fat_sdcard_unmount(mountPath.c_str(), card);
|
||||
if (ret != ESP_OK) {
|
||||
LOGGER.error("Failed to unmount SD card: {}", esp_err_to_name(ret));
|
||||
return false;
|
||||
}
|
||||
card = nullptr;
|
||||
mounted = false;
|
||||
LOGGER.info("SD card unmounted");
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string getMountPath() const override {
|
||||
return mountPath;
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::Lock> getLock() const override { return lock; }
|
||||
|
||||
State getState(TickType_t /*timeout*/) const override {
|
||||
return mounted ? State::Mounted : State::Unmounted;
|
||||
}
|
||||
};
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
return std::make_shared<SdCardDeviceImpl>();
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
// Create SD card device for jc1060p470ciwy using SDMMC slot 0 (4-bit)
|
||||
std::shared_ptr<tt::hal::sdcard::SdCardDevice> createSdCard();
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
#include <tactility/bindings/esp32_sdmmc.h>
|
||||
|
||||
/**
|
||||
* For future reference:
|
||||
@@ -44,4 +45,17 @@
|
||||
pin-data-in = <&gpio0 48 GPIO_FLAG_NONE>;
|
||||
pin-mclk = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
sdcard {
|
||||
compatible = "espressif,esp32-sdmmc";
|
||||
pin-clk = <&gpio0 43 GPIO_FLAG_NONE>;
|
||||
pin-cmd = <&gpio0 44 GPIO_FLAG_NONE>;
|
||||
pin-d0 = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||
pin-d1 = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||
pin-d2 = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||
pin-d3 = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||
slot = <SDMMC_HOST_SLOT_0>;
|
||||
bus-width = <4>;
|
||||
on-chip-ldo-chan = <4>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <PwmBacklight.h>
|
||||
@@ -24,7 +23,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_5;
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SDCARD_SPI_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -32,19 +34,30 @@
|
||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 15 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/hal/touch/TouchDevice.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Axs15231b/Axs15231bTouch.h>
|
||||
#include <EspLcdDisplayDriver.h>
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <PwmBacklight.h>
|
||||
@@ -10,7 +8,6 @@ using namespace tt::hal;
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
constexpr auto SDCARD_SPI_HOST = SPI3_HOST;
|
||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_10;
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SDCARD_SPI_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -45,22 +47,33 @@
|
||||
pin-data-out = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 45 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 48 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 47 GPIO_FLAG_NONE>;
|
||||
pin-wp = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||
pin-hd = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
// P1 header
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#include "PwmBacklight.h"
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
|
||||
@@ -14,7 +12,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto config = std::make_unique<SpiSdCardDevice::Config>(
|
||||
GPIO_NUM_10,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi0");
|
||||
check(spi_controller, "spi0 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(config),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -49,9 +50,15 @@
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart1 {
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/KeyboardBacklight.h"
|
||||
#include "devices/Power.h"
|
||||
#include "devices/Sdcard.h"
|
||||
#include "devices/TdeckKeyboard.h"
|
||||
#include "devices/TrackballDevice.h"
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <tactility/check.h>
|
||||
#include <tactility/device.h>
|
||||
|
||||
@@ -23,7 +21,6 @@ static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
|
||||
std::make_shared<TdeckKeyboard>(i2c_internal),
|
||||
std::make_shared<KeyboardBacklightDevice>(),
|
||||
std::make_shared<TrackballDevice>(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
static const auto LOGGER = tt::Logger("T-Deck");
|
||||
|
||||
// Power on
|
||||
constexpr auto TDECK_POWERON_GPIO = GPIO_NUM_10;
|
||||
|
||||
static bool powerOn() {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
#include "Sdcard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
constexpr auto TDECK_SDCARD_PIN_CS = GPIO_NUM_39;
|
||||
constexpr auto TDECK_LCD_PIN_CS = GPIO_NUM_12;
|
||||
constexpr auto TDECK_RADIO_PIN_CS = GPIO_NUM_9;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
TDECK_SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
tt::lvgl::getSyncLock(),
|
||||
std::vector {
|
||||
TDECK_RADIO_PIN_CS,
|
||||
TDECK_LCD_PIN_CS
|
||||
}
|
||||
);
|
||||
|
||||
::Device* spiController = device_find_by_name("spi0");
|
||||
check(spiController != nullptr, "spi0 not found");
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spiController
|
||||
);
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -8,6 +8,8 @@
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
// Reference: https://wiki.lilygo.cc/get_started/en/Wearable/T-Deck-Plus/T-Deck-Plus.html#Pin-Overview
|
||||
/ {
|
||||
@@ -42,9 +44,22 @@
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 12 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 39 GPIO_FLAG_NONE>, // SD card
|
||||
<&gpio0 9 GPIO_FLAG_NONE>; // Radio
|
||||
pin-mosi = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 38 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
sdcard@1 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
status = "disabled"; // Must be started after display
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
uart0 {
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -18,11 +16,4 @@
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
};
|
||||
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
pin-mosi = <&gpio0 7 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -17,7 +18,12 @@
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <tactility/bindings/esp32_sdmmc.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -32,8 +33,13 @@
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 3 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdmmc0 {
|
||||
@@ -44,6 +50,7 @@
|
||||
pin-d1 = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
pin-d2 = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||
pin-d3 = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
slot = <SDMMC_HOST_SLOT_1>;
|
||||
bus-width = <4>;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_sdmmc.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
#include <tactility/bindings/touch_placeholder.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
@@ -23,16 +25,28 @@
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 6 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 2 GPIO_FLAG_NONE>; // Touch
|
||||
pin-mosi = <&gpio0 3 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 1 GPIO_FLAG_NONE>;
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
touch@1 {
|
||||
compatible = "touch-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdmmc0 {
|
||||
compatible = "espressif,esp32-sdmmc";
|
||||
status = "disabled"; // Late-init is required, otherwise mounting fails
|
||||
pin-clk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
pin-cmd = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||
pin-d0 = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
slot = <SDMMC_HOST_SLOT_1>;
|
||||
bus-width = <1>;
|
||||
pullups;
|
||||
};
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include "devices/TpagerEncoder.h"
|
||||
#include "devices/TpagerKeyboard.h"
|
||||
#include "devices/TpagerPower.h"
|
||||
#include <driver/gpio.h>
|
||||
#include <tactility/device.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
@@ -28,7 +26,6 @@ static DeviceVector createDevices() {
|
||||
bq27220,
|
||||
std::make_shared<Drv2605>(i2c),
|
||||
power,
|
||||
createTpagerSdCard(),
|
||||
createDisplay(),
|
||||
keyboard,
|
||||
std::make_shared<TpagerEncoder>()
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
constexpr auto TPAGER_SDCARD_PIN_CS = GPIO_NUM_21;
|
||||
constexpr auto TPAGER_LCD_PIN_CS = GPIO_NUM_38;
|
||||
constexpr auto TPAGER_RADIO_PIN_CS = GPIO_NUM_36;
|
||||
constexpr auto TPAGER_NFC_PIN_CS = GPIO_NUM_39;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createTpagerSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
TPAGER_SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
tt::lvgl::getSyncLock(),
|
||||
std::vector {
|
||||
TPAGER_RADIO_PIN_CS,
|
||||
TPAGER_LCD_PIN_CS,
|
||||
TPAGER_NFC_PIN_CS
|
||||
}
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi0");
|
||||
check(spi_controller, "spi0 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include <memory>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createTpagerSdCard();
|
||||
@@ -7,6 +7,8 @@
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
// Reference: https://wiki.lilygo.cc/get_started/en/LoRa_GPS/T-LoraPager/T-LoraPager.html#Pin-Overview
|
||||
/ {
|
||||
@@ -33,9 +35,21 @@
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 36 GPIO_FLAG_NONE>, // Display
|
||||
<&gpio0 21 GPIO_FLAG_NONE>; // SD card
|
||||
pin-mosi = <&gpio0 34 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 35 GPIO_FLAG_NONE>;
|
||||
|
||||
display@0 {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
|
||||
sdcard@1 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
status = "disabled"; // Must be started after display
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
// ES8311
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include "devices/CardputerKeyboard.h"
|
||||
#include "devices/CardputerPower.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
@@ -19,7 +17,6 @@ static bool initBoot() {
|
||||
static DeviceVector createDevices() {
|
||||
auto tca8418 = std::make_shared<Tca8418>(device_find_by_name("i2c_internal"));
|
||||
return {
|
||||
createSdCard(),
|
||||
createDisplay(),
|
||||
tca8418,
|
||||
std::make_shared<CardputerKeyboard>(tca8418),
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_12;
|
||||
constexpr auto EXPANSION_HEADER_PIN_CS = GPIO_NUM_5;
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector { EXPANSION_HEADER_PIN_CS },
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include <memory>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <bindings/bmi270.h>
|
||||
#include <tactility/bindings/esp32_sdspi.h>
|
||||
#include <tactility/bindings/display_placeholder.h>
|
||||
|
||||
// Reference: https://docs.m5stack.com/en/core/Cardputer-Adv
|
||||
/ {
|
||||
@@ -47,19 +49,32 @@
|
||||
i2cClockFrequency = <400000>;
|
||||
};
|
||||
|
||||
display_spi: spi0 {
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
cs-gpios = <&gpio0 37 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 35 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 36 GPIO_FLAG_NONE>;
|
||||
|
||||
display {
|
||||
compatible = "display-placeholder";
|
||||
};
|
||||
};
|
||||
|
||||
sdcard_spi: spi1 {
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
cs-gpios = <&gpio0 12 GPIO_FLAG_NONE>,
|
||||
<&gpio0 5 GPIO_FLAG_NONE>;
|
||||
pin-mosi = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||
|
||||
sdcard@0 {
|
||||
compatible = "espressif,esp32-sdspi";
|
||||
status = "disabled";
|
||||
frequency-khz = <20000>;
|
||||
};
|
||||
};
|
||||
|
||||
// Speaker and microphone (ES8311)
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include "devices/CardputerEncoder.h"
|
||||
#include "devices/CardputerKeyboard.h"
|
||||
#include "devices/CardputerPower.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <PwmBacklight.h>
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
@@ -16,7 +14,6 @@ static bool initBoot() {
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createSdCard(),
|
||||
createDisplay(),
|
||||
std::make_shared<CardputerKeyboard>(),
|
||||
std::make_shared<CardputerEncoder>(),
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
constexpr auto SDCARD_PIN_CS = GPIO_NUM_12;
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
nullptr,
|
||||
std::vector<gpio_num_t>(),
|
||||
SPI3_HOST
|
||||
);
|
||||
|
||||
auto* spi_controller = device_find_by_name("spi1");
|
||||
check(spi_controller, "spi1 not found");
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration),
|
||||
spi_controller
|
||||
);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user