M5Stack PaperS3 implementation (#478)
Selectively imported code from @juicecultus [fork](https://github.com/juicecultus/Tactility) with some changes/additions from me.
This commit is contained in:
committed by
GitHub
parent
a935410f82
commit
9cc96fd32b
@@ -0,0 +1,6 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES FastEpdDisplay GT911 TactilityCore
|
||||
)
|
||||
@@ -0,0 +1,45 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
auto touch = createTouch();
|
||||
return {
|
||||
createSdCard(),
|
||||
createDisplay(touch)
|
||||
};
|
||||
}
|
||||
|
||||
extern const Configuration hardwareConfiguration = {
|
||||
.initBoot = nullptr,
|
||||
.createDevices = createDevices,
|
||||
.spi {
|
||||
spi::Configuration {
|
||||
.device = SPI2_HOST,
|
||||
.dma = SPI_DMA_CH_AUTO,
|
||||
.config = {
|
||||
.mosi_io_num = GPIO_NUM_38,
|
||||
.miso_io_num = GPIO_NUM_40,
|
||||
.sclk_io_num = GPIO_NUM_39,
|
||||
.quadwp_io_num = GPIO_NUM_NC,
|
||||
.quadhd_io_num = GPIO_NUM_NC,
|
||||
.data4_io_num = GPIO_NUM_NC,
|
||||
.data5_io_num = GPIO_NUM_NC,
|
||||
.data6_io_num = GPIO_NUM_NC,
|
||||
.data7_io_num = GPIO_NUM_NC,
|
||||
.data_io_default_level = false,
|
||||
.max_transfer_sz = 4096,
|
||||
.flags = 0,
|
||||
.isr_cpu_id = ESP_INTR_CPU_AFFINITY_AUTO,
|
||||
.intr_flags = 0
|
||||
},
|
||||
.initMode = spi::InitMode::ByTactility,
|
||||
.isMutable = false,
|
||||
.lock = tt::lvgl::getSyncLock()
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
#include "Display.h"
|
||||
#include <Gt911Touch.h>
|
||||
#include <FastEpdDisplay.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||
auto configuration = std::make_unique<Gt911Touch::Configuration>(
|
||||
I2C_NUM_0,
|
||||
540,
|
||||
960,
|
||||
false, // swapXy
|
||||
false, // mirrorX
|
||||
false, // mirrorY
|
||||
GPIO_NUM_NC, // pinReset
|
||||
GPIO_NUM_NC // pinInterrupt
|
||||
);
|
||||
|
||||
auto touch = std::make_shared<Gt911Touch>(std::move(configuration));
|
||||
return std::static_pointer_cast<tt::hal::touch::TouchDevice>(touch);
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay(std::shared_ptr<tt::hal::touch::TouchDevice> touch) {
|
||||
FastEpdDisplay::Configuration configuration = {
|
||||
.horizontalResolution = 540,
|
||||
.verticalResolution = 960,
|
||||
.touch = std::move(touch),
|
||||
.busSpeedHz = 20000000,
|
||||
.rotationDegrees = 90,
|
||||
.use4bppGrayscale = false,
|
||||
.fullRefreshEveryNFlushes = 40,
|
||||
};
|
||||
|
||||
return std::make_shared<FastEpdDisplay>(configuration, tt::lvgl::getSyncLock());
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/display/DisplayDevice.h>
|
||||
#include <Tactility/hal/touch/TouchDevice.h>
|
||||
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch();
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay(std::shared_ptr<tt::hal::touch::TouchDevice> touch);
|
||||
@@ -0,0 +1,25 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
constexpr auto PAPERS3_SDCARD_PIN_CS = GPIO_NUM_47;
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
PAPERS3_SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
tt::lvgl::getSyncLock(),
|
||||
std::vector<gpio_num_t>{},
|
||||
SPI2_HOST
|
||||
);
|
||||
|
||||
return std::make_shared<SpiSdCardDevice>(
|
||||
std::move(configuration)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "Tactility/hal/sdcard/SdCardDevice.h"
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -0,0 +1,23 @@
|
||||
#include <tactility/module.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
static error_t start() {
|
||||
// Empty for now
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
static error_t stop() {
|
||||
// Empty for now
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
/** @warning The variable name must be exactly "device_module" */
|
||||
struct Module device_module = {
|
||||
.name = "m5stack-papers3",
|
||||
.start = start,
|
||||
.stop = stop,
|
||||
.symbols = nullptr
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
[general]
|
||||
vendor=M5Stack
|
||||
name=Paper S3
|
||||
incubating=true
|
||||
|
||||
[hardware]
|
||||
target=esp32s3
|
||||
flashSize=16MB
|
||||
spiRam=true
|
||||
spiRamMode=OPI
|
||||
spiRamSpeed=80M
|
||||
esptoolFlashFreq=80M
|
||||
tinyUsb=true
|
||||
|
||||
[display]
|
||||
size=4.7"
|
||||
shape=rectangle
|
||||
dpi=235
|
||||
|
||||
[lvgl]
|
||||
colorDepth=8
|
||||
theme=Mono
|
||||
|
||||
[sdkconfig]
|
||||
CONFIG_EPD_DISPLAY_TYPE_ED047TC2=y
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
dependencies:
|
||||
- Platforms/PlatformEsp32
|
||||
dts: m5stack,papers3.dts
|
||||
@@ -0,0 +1,25 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
|
||||
/ {
|
||||
compatible = "root";
|
||||
model = "M5Stack PaperS3";
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
};
|
||||
|
||||
i2c_internal {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
port = <I2C_NUM_0>;
|
||||
clock-frequency = <400000>;
|
||||
pin-sda = <41>;
|
||||
pin-scl = <42>;
|
||||
pin-sda-pullup;
|
||||
pin-scl-pullup;
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user