mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-08-20 17:05:06 +00:00
WIP
This commit is contained in:
parent
e8b9a1f2a9
commit
497568f85e
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -23,7 +22,6 @@ static bool initBoot() {
|
|||||||
static tt::hal::DeviceVector createDevices() {
|
static tt::hal::DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -22,18 +24,28 @@
|
|||||||
pin-scl = <&gpio0 32 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 32 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -14,8 +13,7 @@ static bool initBoot() {
|
|||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay()
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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,8 @@
|
|||||||
#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>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
@ -14,20 +16,30 @@
|
|||||||
gpio-count = <40>;
|
gpio-count = <40>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -25,7 +24,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -23,20 +25,30 @@
|
|||||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -25,7 +24,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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,8 @@
|
|||||||
#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>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -23,20 +25,30 @@
|
|||||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -39,7 +38,6 @@ static bool initBoot() {
|
|||||||
static tt::hal::DeviceVector createDevices() {
|
static tt::hal::DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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,6 +4,8 @@
|
|||||||
#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_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -22,18 +24,28 @@
|
|||||||
pin-scl = <&gpio1 32 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio1 32 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio1 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio1 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio1 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio1 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio1 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio1 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio1 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio1 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio1 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio1 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
@ -24,7 +23,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -32,19 +34,29 @@
|
|||||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/St7701Display.h"
|
#include "devices/St7701Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -16,7 +15,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
std::make_shared<St7701Display>(),
|
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_gpio.h>
|
||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -34,5 +35,11 @@
|
|||||||
pin-miso = <&gpio0 41 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 48 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 48 GPIO_FLAG_NONE>;
|
||||||
pin-hd = <&gpio0 42 GPIO_FLAG_NONE>;
|
pin-hd = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -15,7 +14,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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_i2c.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -42,6 +43,12 @@
|
|||||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -12,7 +11,6 @@ static bool initBoot() {
|
|||||||
static tt::hal::DeviceVector createDevices() {
|
static tt::hal::DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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,8 @@
|
|||||||
#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>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -13,19 +15,29 @@
|
|||||||
gpio-count = <40>;
|
gpio-count = <40>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
@ -17,7 +16,6 @@ static tt::hal::DeviceVector createDevices() {
|
|||||||
return {
|
return {
|
||||||
createPower(),
|
createPower(),
|
||||||
createDisplay(),
|
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,8 @@
|
|||||||
#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_spi.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -22,19 +24,29 @@
|
|||||||
pin-scl = <&gpio0 25 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 25 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -14,7 +13,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -28,19 +30,29 @@
|
|||||||
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 7 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -14,7 +13,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -28,19 +30,29 @@
|
|||||||
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 42 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 7 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -25,7 +24,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -28,12 +29,18 @@
|
|||||||
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 16 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 0 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -14,7 +13,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -23,21 +25,31 @@
|
|||||||
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
max-transfer-size = <65536>;
|
max-transfer-size = <65536>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -14,7 +13,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2c.h>
|
#include <tactility/bindings/esp32_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -23,21 +25,31 @@
|
|||||||
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
max-transfer-size = <65536>;
|
max-transfer-size = <65536>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -15,7 +14,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -28,12 +29,18 @@
|
|||||||
pin-scl = <&gpio0 20 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 20 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
|
|
||||||
@ -9,7 +8,6 @@ using namespace tt::hal;
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
createSdCard(),
|
|
||||||
createPower()
|
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_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_sdmmc.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For future reference:
|
* For future reference:
|
||||||
@ -44,4 +45,16 @@
|
|||||||
pin-data-in = <&gpio0 48 GPIO_FLAG_NONE>;
|
pin-data-in = <&gpio0 48 GPIO_FLAG_NONE>;
|
||||||
pin-mclk = <&gpio0 13 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>;
|
||||||
|
bus-width = <4>;
|
||||||
|
on-chip-ldo-chan = <4>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <PwmBacklight.h>
|
#include <PwmBacklight.h>
|
||||||
@ -24,7 +23,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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_i2c.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -32,19 +34,29 @@
|
|||||||
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
pin-scl = <&gpio0 22 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 23 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
// CN1 header, JST SH 1.25, GND / IO22 / IO21 / 3.3V
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -10,7 +9,6 @@ using namespace tt::hal;
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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,7 @@
|
|||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -45,7 +46,7 @@
|
|||||||
pin-data-out = <&gpio0 41 GPIO_FLAG_NONE>;
|
pin-data-out = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 21 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||||
@ -55,12 +56,18 @@
|
|||||||
pin-hd = <&gpio0 39 GPIO_FLAG_NONE>;
|
pin-hd = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// P1 header
|
// P1 header
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
#include "PwmBacklight.h"
|
#include "PwmBacklight.h"
|
||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -14,7 +13,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createDisplay(),
|
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_i2s.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -52,6 +53,12 @@
|
|||||||
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 10 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart1 {
|
uart1 {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/KeyboardBacklight.h"
|
#include "devices/KeyboardBacklight.h"
|
||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
#include "devices/Sdcard.h"
|
|
||||||
#include "devices/TdeckKeyboard.h"
|
#include "devices/TdeckKeyboard.h"
|
||||||
#include "devices/TrackballDevice.h"
|
#include "devices/TrackballDevice.h"
|
||||||
|
|
||||||
@ -23,7 +22,6 @@ static std::vector<std::shared_ptr<tt::hal::Device>> createDevices() {
|
|||||||
std::make_shared<TdeckKeyboard>(i2c_internal),
|
std::make_shared<TdeckKeyboard>(i2c_internal),
|
||||||
std::make_shared<KeyboardBacklightDevice>(),
|
std::make_shared<KeyboardBacklightDevice>(),
|
||||||
std::make_shared<TrackballDevice>(),
|
std::make_shared<TrackballDevice>(),
|
||||||
createSdCard()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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_i2s.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.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
|
// Reference: https://wiki.lilygo.cc/get_started/en/Wearable/T-Deck-Plus/T-Deck-Plus.html#Pin-Overview
|
||||||
/ {
|
/ {
|
||||||
@ -45,6 +47,16 @@
|
|||||||
pin-mosi = <&gpio0 41 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 41 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 38 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 38 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uart0 {
|
uart0 {
|
||||||
|
|||||||
@ -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_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -19,5 +20,9 @@
|
|||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 19 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 19 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 18 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_sdmmc.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
/ {
|
/ {
|
||||||
compatible = "root";
|
compatible = "root";
|
||||||
@ -34,6 +35,10 @@
|
|||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 3 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 3 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdmmc0 {
|
sdmmc0 {
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/TpagerEncoder.h"
|
#include "devices/TpagerEncoder.h"
|
||||||
#include "devices/TpagerKeyboard.h"
|
#include "devices/TpagerKeyboard.h"
|
||||||
#include "devices/TpagerPower.h"
|
#include "devices/TpagerPower.h"
|
||||||
|
|||||||
@ -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_i2s.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.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
|
// Reference: https://wiki.lilygo.cc/get_started/en/LoRa_GPS/T-LoraPager/T-LoraPager.html#Pin-Overview
|
||||||
/ {
|
/ {
|
||||||
@ -36,6 +38,16 @@
|
|||||||
pin-mosi = <&gpio0 34 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 34 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 35 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 35 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 21 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// ES8311
|
// ES8311
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/CardputerKeyboard.h"
|
#include "devices/CardputerKeyboard.h"
|
||||||
#include "devices/CardputerPower.h"
|
#include "devices/CardputerPower.h"
|
||||||
#include <driver/gpio.h>
|
#include <driver/gpio.h>
|
||||||
@ -19,7 +18,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
auto tca8418 = std::make_shared<Tca8418>(device_find_by_name("i2c_internal"));
|
auto tca8418 = std::make_shared<Tca8418>(device_find_by_name("i2c_internal"));
|
||||||
return {
|
return {
|
||||||
createSdCard(),
|
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
tca8418,
|
tca8418,
|
||||||
std::make_shared<CardputerKeyboard>(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_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
#include <bindings/bmi270.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
|
// Reference: https://docs.m5stack.com/en/core/Cardputer-Adv
|
||||||
/ {
|
/ {
|
||||||
@ -47,19 +49,29 @@
|
|||||||
i2cClockFrequency = <400000>;
|
i2cClockFrequency = <400000>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 35 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 35 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 36 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 36 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 39 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Speaker and microphone (ES8311)
|
// Speaker and microphone (ES8311)
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/CardputerEncoder.h"
|
#include "devices/CardputerEncoder.h"
|
||||||
#include "devices/CardputerKeyboard.h"
|
#include "devices/CardputerKeyboard.h"
|
||||||
#include "devices/CardputerPower.h"
|
#include "devices/CardputerPower.h"
|
||||||
@ -16,7 +15,6 @@ static bool initBoot() {
|
|||||||
|
|
||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
createSdCard(),
|
|
||||||
createDisplay(),
|
createDisplay(),
|
||||||
std::make_shared<CardputerKeyboard>(),
|
std::make_shared<CardputerKeyboard>(),
|
||||||
std::make_shared<CardputerEncoder>(),
|
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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard();
|
|
||||||
@ -8,6 +8,8 @@
|
|||||||
#include <tactility/bindings/esp32_i2s.h>
|
#include <tactility/bindings/esp32_i2s.h>
|
||||||
#include <tactility/bindings/esp32_spi.h>
|
#include <tactility/bindings/esp32_spi.h>
|
||||||
#include <tactility/bindings/esp32_uart.h>
|
#include <tactility/bindings/esp32_uart.h>
|
||||||
|
#include <tactility/bindings/esp32_sdspi.h>
|
||||||
|
#include <tactility/bindings/display_placeholder.h>
|
||||||
|
|
||||||
// Reference: https://docs.m5stack.com/en/core/Cardputer
|
// Reference: https://docs.m5stack.com/en/core/Cardputer
|
||||||
/ {
|
/ {
|
||||||
@ -33,19 +35,29 @@
|
|||||||
i2cClockFrequency = <400000>;
|
i2cClockFrequency = <400000>;
|
||||||
};
|
};
|
||||||
|
|
||||||
display_spi: spi0 {
|
spi0 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI2_HOST>;
|
host = <SPI2_HOST>;
|
||||||
pin-mosi = <&gpio0 35 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 35 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 36 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 36 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
display {
|
||||||
|
compatible = "display-placeholder";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sdcard_spi: spi1 {
|
spi1 {
|
||||||
compatible = "espressif,esp32-spi";
|
compatible = "espressif,esp32-spi";
|
||||||
host = <SPI3_HOST>;
|
host = <SPI3_HOST>;
|
||||||
pin-mosi = <&gpio0 14 GPIO_FLAG_NONE>;
|
pin-mosi = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||||
pin-miso = <&gpio0 39 GPIO_FLAG_NONE>;
|
pin-miso = <&gpio0 39 GPIO_FLAG_NONE>;
|
||||||
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||||
|
|
||||||
|
sdcard {
|
||||||
|
compatible = "espressif,esp32-sdspi";
|
||||||
|
pin-cs = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||||
|
frequency-khz = <20000>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Speaker and microphone
|
// Speaker and microphone
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
#include "devices/Display.h"
|
#include "devices/Display.h"
|
||||||
#include "devices/SdCard.h"
|
|
||||||
#include "devices/Power.h"
|
#include "devices/Power.h"
|
||||||
|
|
||||||
#include <Tactility/hal/Configuration.h>
|
#include <Tactility/hal/Configuration.h>
|
||||||
@ -13,7 +12,6 @@ static bool initBoot() {
|
|||||||
static DeviceVector createDevices() {
|
static DeviceVector createDevices() {
|
||||||
return {
|
return {
|
||||||
getAxp192(),
|
getAxp192(),
|
||||||
createSdCard(),
|
|
||||||
createDisplay()
|
createDisplay()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
#include "SdCard.h"
|
|
||||||
|
|
||||||
#include <tactility/device.h>
|
|
||||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
|
||||||
#include <Tactility/lvgl/LvglSync.h>
|
|
||||||
|
|
||||||
constexpr auto CORE2_SDCARD_PIN_CS = GPIO_NUM_4;
|
|
||||||
constexpr auto CORE2_LCD_PIN_CS = GPIO_NUM_5;
|
|
||||||
|
|
||||||
using tt::hal::sdcard::SpiSdCardDevice;
|
|
||||||
|
|
||||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
|
||||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
|
||||||
CORE2_SDCARD_PIN_CS,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
GPIO_NUM_NC,
|
|
||||||
SdCardDevice::MountBehaviour::AtBoot,
|
|
||||||
tt::lvgl::getSyncLock(),
|
|
||||||
std::vector {
|
|
||||||
CORE2_LCD_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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
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