Tab5 features, StackChan, fixes, drivers.... (#526)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
|
||||
@@ -9,6 +10,10 @@
|
||||
compatible = "root";
|
||||
model = "BigTreeTech Panda Touch";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -12,6 +12,7 @@ spiRam=true
|
||||
spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=5"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -9,6 +10,10 @@
|
||||
compatible = "root";
|
||||
model = "CYD 4848S040C";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -11,6 +11,7 @@ flashSize=16MB
|
||||
spiRam=true
|
||||
spiRamMode=OCT
|
||||
spiRamSpeed=80M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=4"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
@@ -10,6 +11,10 @@
|
||||
compatible = "root";
|
||||
model = "CYD 8048S043C";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRam=true
|
||||
spiRamMode=OCT
|
||||
spiRamSpeed=80M
|
||||
esptoolFlashFreq=80M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=4.3"
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=2.8"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -10,6 +11,10 @@
|
||||
compatible = "root";
|
||||
model = "Elecrow CrowPanel Advance 2.8";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=3.5"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -10,6 +11,10 @@
|
||||
compatible = "root";
|
||||
model = "Elecrow CrowPanel Advance 3.5";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=5"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -10,6 +11,10 @@
|
||||
compatible = "root";
|
||||
model = "Elecrow CrowPanel Advance 5.0";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=5.0"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -10,6 +11,10 @@
|
||||
compatible = "root";
|
||||
model = "Elecrow CrowPanel Basic 5.0";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -12,6 +12,7 @@ spiRam=true
|
||||
spiRamMode=OCT
|
||||
spiRamSpeed=200M
|
||||
esptoolFlashFreq=80M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=7"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
@@ -17,6 +18,10 @@
|
||||
compatible = "root";
|
||||
model = "Guition JC1060P470C-I-W-Y";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <57>;
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=3.5"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
@@ -11,6 +12,10 @@
|
||||
compatible = "root";
|
||||
model = "Guition JC3248W535C";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -12,6 +12,7 @@ spiRam=true
|
||||
spiRamMode=OCT
|
||||
spiRamSpeed=80M
|
||||
esptoolFlashFreq=80M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=5"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
@@ -11,6 +12,10 @@
|
||||
compatible = "root";
|
||||
model = "Guition JC8048W550C";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -13,6 +13,7 @@ flashSize=8MB
|
||||
spiRam=false
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=0.96"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
|
||||
@@ -8,6 +9,10 @@
|
||||
compatible = "root";
|
||||
model = "Heltec WiFi LoRa 32 V3";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -33,7 +33,8 @@ std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
.touch = createTouch(),
|
||||
.backlightDutyFunction = driver::pwmbacklight::setBacklightDuty,
|
||||
.resetPin = GPIO_NUM_NC,
|
||||
.lvglSwapBytes = false
|
||||
.lvglSwapBytes = false,
|
||||
.buffSpiram = true
|
||||
};
|
||||
|
||||
auto spi_configuration = std::make_shared<St7789Display::SpiConfiguration>(St7789Display::SpiConfiguration {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
i2c_internal: i2c0 {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
port = <I2C_NUM_0>;
|
||||
clock-frequency = <400000>;
|
||||
clock-frequency = <100000>;
|
||||
pin-sda = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 8 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
@@ -14,6 +14,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=1.9"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -9,6 +10,10 @@
|
||||
compatible = "root";
|
||||
model = "LilyGO T-Display S3";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -13,6 +13,7 @@ flashSize=16MB
|
||||
spiRam=false
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=0.96"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_sdmmc.h>
|
||||
@@ -11,6 +12,10 @@
|
||||
compatible = "root";
|
||||
model = "LilyGO T-Dongle S3";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -12,7 +12,7 @@ static error_t stop() {
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
struct Module lilygo_thmi_s3_module = {
|
||||
struct Module lilygo_thmi_module = {
|
||||
.name = "lilygo-thmi",
|
||||
.start = start,
|
||||
.stop = stop,
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=2.8"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_sdmmc.h>
|
||||
@@ -10,6 +11,10 @@
|
||||
compatible = "root";
|
||||
model = "LilyGO T-HMI";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern struct Module device_module;
|
||||
extern struct Module lilygo_tlora_pager_module;
|
||||
|
||||
static int start(Device* device) {
|
||||
return 0;
|
||||
@@ -23,7 +23,7 @@ Driver tlora_pager_driver = {
|
||||
.stop_device = stop,
|
||||
.api = nullptr,
|
||||
.device_type = nullptr,
|
||||
.owner = &device_module,
|
||||
.owner = &lilygo_tlora_pager_module,
|
||||
.internal = nullptr
|
||||
};
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ spiRamMode=AUTO
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=40M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=2.33"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <bindings/tlora_pager.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
@@ -12,6 +13,10 @@
|
||||
compatible = "lilygo,tlora-pager";
|
||||
model = "LilyGO T-Lora Pager";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -11,6 +11,7 @@ flashSize=8MB
|
||||
spiRam=false
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=1.14"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
@@ -13,6 +14,10 @@
|
||||
compatible = "root";
|
||||
model = "M5Stack Cardputer Adv";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -11,6 +11,7 @@ flashSize=8MB
|
||||
spiRam=false
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=1.14"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
@@ -12,6 +13,10 @@
|
||||
compatible = "root";
|
||||
model = "M5Stack Cardputer";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||
auto configuration = std::make_unique<Ft6x36Touch::Configuration>(
|
||||
I2C_NUM_0,
|
||||
GPIO_NUM_39,
|
||||
LCD_HORIZONTAL_RESOLUTION,
|
||||
LCD_VERTICAL_RESOLUTION
|
||||
LCD_VERTICAL_RESOLUTION,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_39
|
||||
);
|
||||
|
||||
auto touch = std::make_shared<Ft6x36Touch>(std::move(configuration));
|
||||
return std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(touch);
|
||||
return std::make_shared<Ft6x36Touch>(std::move(configuration));
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
|
||||
@@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility esp_lvgl_port ILI934x FT5x06 AXP2101 AW9523 driver vfs fatfs
|
||||
REQUIRES Tactility esp_lvgl_port ILI934x FT6x36 AXP2101 AW9523 driver vfs fatfs
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Display.h"
|
||||
|
||||
#include <Axp2101.h>
|
||||
#include <Ft5x06Touch.h>
|
||||
#include <Ft6x36Touch.h>
|
||||
#include <Ili934xDisplay.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/hal/i2c/I2c.h>
|
||||
@@ -17,14 +17,16 @@ static void setBacklightDuty(uint8_t backlightDuty) {
|
||||
}
|
||||
|
||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||
auto configuration = std::make_unique<Ft5x06Touch::Configuration>(
|
||||
auto configuration = std::make_unique<Ft6x36Touch::Configuration>(
|
||||
I2C_NUM_0,
|
||||
LCD_HORIZONTAL_RESOLUTION,
|
||||
LCD_VERTICAL_RESOLUTION
|
||||
319,//LCD_HORIZONTAL_RESOLUTION,
|
||||
239,//LCD_VERTICAL_RESOLUTION,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
auto touch = std::make_shared<Ft5x06Touch>(std::move(configuration));
|
||||
return std::reinterpret_pointer_cast<tt::hal::touch::TouchDevice>(touch);
|
||||
return std::make_shared<Ft6x36Touch>(std::move(configuration));
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRamMode=QUAD
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=2"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
@@ -14,6 +15,10 @@
|
||||
compatible = "root";
|
||||
model = "M5Stack CoreS3";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -14,6 +14,7 @@ spiRamMode=OPI
|
||||
spiRamSpeed=80M
|
||||
esptoolFlashFreq=80M
|
||||
tinyUsb=true
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=4.7"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -11,6 +12,10 @@
|
||||
compatible = "root";
|
||||
model = "M5Stack PaperS3";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility esp_lvgl_port ILI934x FT6x36 AXP2101 AW9523 driver vfs fatfs ina226-module py32ioexpander-module
|
||||
)
|
||||
@@ -0,0 +1,254 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/Power.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/i2c_controller.h>
|
||||
#include <tactility/log.h>
|
||||
#include <drivers/py32ioexpander.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <Axp2101Power.h>
|
||||
#include <Axp2101.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static const auto* TAG = "StackChan";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// I2C addresses
|
||||
// ---------------------------------------------------------------------------
|
||||
static constexpr uint8_t AXP2101_ADDR = 0x34;
|
||||
static constexpr uint8_t AW9523B_ADDR = 0x58;
|
||||
static constexpr uint8_t AW88298_ADDR = 0x36;
|
||||
static constexpr uint8_t ES7210_ADDR = 0x40;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// AW9523B GPIO expander — same wiring as CoreS3
|
||||
// ---------------------------------------------------------------------------
|
||||
// P0 pins: 0=touch reset, 1=bus out enable, 2=AW88298 reset, 4=SD card, 5=USB OTG
|
||||
// P1 pins: 0=cam reset, 1=LCD reset, 7=boost enable (SY7088)
|
||||
static constexpr uint8_t AW9523B_CTL_REG = 0x11; // P0 push-pull mode
|
||||
static constexpr uint8_t AW9523B_P0_REG = 0x02;
|
||||
static constexpr uint8_t AW9523B_P1_REG = 0x03;
|
||||
|
||||
static bool initGpioExpander(::Device* i2c) {
|
||||
// P0: touch, bus enable, AW88298 reset, SD card switch
|
||||
constexpr uint8_t p0 = (1U << 0U) | (1U << 1U) | (1U << 2U) | (1U << 4U);
|
||||
// P1: LCD reset, boost enable
|
||||
constexpr uint8_t p1 = (1U << 1U) | (1U << 7U);
|
||||
|
||||
// Set P0 to push-pull mode
|
||||
if (i2c_controller_register8_set(i2c, AW9523B_ADDR, AW9523B_CTL_REG, 0x10, pdMS_TO_TICKS(1000)) != ERROR_NONE) {
|
||||
LOG_E(TAG, "AW9523B: Failed to set CTL");
|
||||
return false;
|
||||
}
|
||||
if (i2c_controller_register8_set(i2c, AW9523B_ADDR, AW9523B_P0_REG, p0, pdMS_TO_TICKS(1000)) != ERROR_NONE) {
|
||||
LOG_E(TAG, "AW9523B: Failed to set P0");
|
||||
return false;
|
||||
}
|
||||
if (i2c_controller_register8_set(i2c, AW9523B_ADDR, AW9523B_P1_REG, p1, pdMS_TO_TICKS(1000)) != ERROR_NONE) {
|
||||
LOG_E(TAG, "AW9523B: Failed to set P1");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// AXP2101 power management — same voltage rails as CoreS3
|
||||
// ---------------------------------------------------------------------------
|
||||
static bool initPowerControl(::Device* i2c) {
|
||||
// Source: https://github.com/m5stack/M5Unified/blob/b8cfec7fed046242da7f7b8024a4e92004a51ff7/src/utility/Power_Class.cpp#L64
|
||||
static constexpr uint8_t reg_data[] = {
|
||||
0x90U, 0xBFU, // LDOS ON/OFF control 0 (backlight)
|
||||
0x92U, 18U - 5U, // ALDO1 = 1.8V (AW88298)
|
||||
0x93U, 33U - 5U, // ALDO2 = 3.3V (ES7210)
|
||||
0x94U, 33U - 5U, // ALDO3 = 3.3V (camera)
|
||||
0x95U, 33U - 5U, // ALDO4 = 3.3V (TF card)
|
||||
0x27U, 0x00U, // PowerKey Hold=1sec / PowerOff=4sec
|
||||
0x69U, 0x11U, // CHGLED setting
|
||||
0x10U, 0x30U, // PMU common config
|
||||
0x30U, 0x0FU, // ADC enabled
|
||||
};
|
||||
|
||||
if (i2c_controller_write_register_array(i2c, AXP2101_ADDR, reg_data, sizeof(reg_data), pdMS_TO_TICKS(1000)) != ERROR_NONE) {
|
||||
LOG_E(TAG, "AXP2101: Failed to set registers");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// AW88298 speaker amplifier
|
||||
// Called once in initBoot() at 16kHz. AW88298 default state after hardware reset
|
||||
// is sufficient for SfxEngine. Sequence mirrors M5Unified _speaker_enabled_cb_cores3().
|
||||
// NOTE: 44100Hz (AudioPlayer/MusicPlayer) needs esp_codec_dev integration — see memory notes.
|
||||
// ---------------------------------------------------------------------------
|
||||
static bool initSpeaker(::Device* i2c, uint32_t sample_rate_hz) {
|
||||
// M5Unified rate table: (sample_rate + 1102) / 2205 steps, first entry >= result
|
||||
static constexpr uint8_t rate_tbl[] = { 4, 5, 6, 8, 10, 11, 15, 20, 22, 44 };
|
||||
size_t reg06_idx = 0;
|
||||
size_t rate = (sample_rate_hz + 1102) / 2205;
|
||||
while (rate > rate_tbl[reg06_idx] && ++reg06_idx < sizeof(rate_tbl)) {}
|
||||
if (reg06_idx >= sizeof(rate_tbl)) {
|
||||
reg06_idx = sizeof(rate_tbl) - 1; // clamp to max supported rate
|
||||
}
|
||||
// 0x14C0: M5Unified's upper byte for CoreS3, I2SBCK=0 (BCK 16*2)
|
||||
const uint16_t reg06 = static_cast<uint16_t>(0x14C0U | reg06_idx);
|
||||
|
||||
// Hardware reset AW88298 via AW9523B P0 bit 2: pull LOW (reset), then HIGH (release).
|
||||
if (i2c_controller_register8_reset_bits(i2c, AW9523B_ADDR, AW9523B_P0_REG, 0b00000100, pdMS_TO_TICKS(100)) != ERROR_NONE) {
|
||||
LOG_E(TAG, "AW9523B: failed to assert AW88298 reset");
|
||||
return false;
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
if (i2c_controller_register8_set_bits(i2c, AW9523B_ADDR, AW9523B_P0_REG, 0b00000100, pdMS_TO_TICKS(100)) != ERROR_NONE) {
|
||||
LOG_E(TAG, "AW9523B: failed to release AW88298 reset");
|
||||
return false;
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(50));
|
||||
|
||||
// Exact sequence from M5Unified _speaker_enabled_cb_cores3() — no I2C software reset.
|
||||
struct { uint8_t reg; uint16_t val; } regs[] = {
|
||||
{ 0x61, 0x0673 }, // boost mode disabled
|
||||
{ 0x04, 0x4040 }, // I2SEN=1, AMPPD=0, PWDN=0
|
||||
{ 0x05, 0x0008 }, // RMSE=0, HAGCE=0, HDCCE=0, HMUTE=0
|
||||
{ 0x06, reg06 }, // I2S mode + sample rate
|
||||
{ 0x0C, 0x3064 }, // volume -24dB
|
||||
};
|
||||
for (auto& r : regs) {
|
||||
if (i2c_controller_register16be_set(i2c, AW88298_ADDR, r.reg, r.val, pdMS_TO_TICKS(100)) != ERROR_NONE) {
|
||||
LOG_E(TAG, "AW88298: failed reg 0x%02X", r.reg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_I(TAG, "AW88298 initialized (%luHz, reg06=0x%04X)", (unsigned long)sample_rate_hz, reg06);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ES7210 microphone ADC
|
||||
// Source: https://github.com/m5stack/M5Unified
|
||||
// ---------------------------------------------------------------------------
|
||||
static bool initMicrophone(::Device* i2c) {
|
||||
static constexpr uint8_t reg_data[] = {
|
||||
0x00, 0x41, // RESET_CTL
|
||||
0x01, 0x1F, // CLK_ON_OFF (initial)
|
||||
0x06, 0x00, // DIGITAL_PDN
|
||||
0x07, 0x20, // ADC_OSR
|
||||
0x08, 0x10, // MODE_CFG
|
||||
0x09, 0x30, // TCT0_CHPINI
|
||||
0x0A, 0x30, // TCT1_CHPINI
|
||||
0x20, 0x0A, // ADC34_HPF2
|
||||
0x21, 0x2A, // ADC34_HPF1
|
||||
0x22, 0x0A, // ADC12_HPF2
|
||||
0x23, 0x2A, // ADC12_HPF1
|
||||
0x02, 0xC1,
|
||||
0x04, 0x01,
|
||||
0x05, 0x00,
|
||||
0x11, 0x60,
|
||||
0x40, 0x42, // ANALOG_SYS
|
||||
0x41, 0x70, // MICBIAS12
|
||||
0x42, 0x70, // MICBIAS34
|
||||
0x43, 0x1B, // MIC1_GAIN
|
||||
0x44, 0x1B, // MIC2_GAIN
|
||||
0x45, 0x00, // MIC3_GAIN
|
||||
0x46, 0x00, // MIC4_GAIN
|
||||
0x47, 0x00, // MIC1_LP
|
||||
0x48, 0x00, // MIC2_LP
|
||||
0x49, 0x00, // MIC3_LP
|
||||
0x4A, 0x00, // MIC4_LP
|
||||
0x4B, 0x00, // MIC12_PDN
|
||||
0x4C, 0xFF, // MIC34_PDN
|
||||
0x01, 0x14, // CLK_ON_OFF (final)
|
||||
};
|
||||
|
||||
if (i2c_controller_write_register_array(i2c, ES7210_ADDR, reg_data, sizeof(reg_data), pdMS_TO_TICKS(1000)) != ERROR_NONE) {
|
||||
LOG_E(TAG, "ES7210: Failed to set registers");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// initBoot — called before device tree is started
|
||||
// ---------------------------------------------------------------------------
|
||||
static std::shared_ptr<Axp2101> axp2101;
|
||||
|
||||
bool initBoot() {
|
||||
auto* i2c = device_find_by_name("i2c_internal");
|
||||
if (i2c == nullptr) {
|
||||
LOG_E(TAG, "i2c_internal not found");
|
||||
return false;
|
||||
}
|
||||
// Boost enable via AXP2101 before GPIO expander init (same as CoreS3)
|
||||
// AW9523B P1 bit 7 = SY7088 boost enable — set after AXP2101 is configured
|
||||
if (!initPowerControl(i2c)) {
|
||||
LOG_E(TAG, "AXP2101 init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!initGpioExpander(i2c)) {
|
||||
LOG_E(TAG, "AW9523B init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
// AW88298 default state after reset is sufficient for SfxEngine (16kHz).
|
||||
// Full 44100Hz support requires esp_codec_dev integration (see memory notes).
|
||||
if (!initSpeaker(i2c, 16000)) {
|
||||
LOG_W(TAG, "AW88298 init failed (non-fatal)");
|
||||
}
|
||||
|
||||
if (!initMicrophone(i2c)) {
|
||||
LOG_W(TAG, "ES7210 init failed (non-fatal)");
|
||||
}
|
||||
|
||||
// Boot LED pattern — confirms PY32IOExpander is working.
|
||||
// PY32 pin 0 = servo VM_EN (output), pin 13 = WS2812C data line.
|
||||
auto* py32 = device_find_by_name("py32");
|
||||
if (py32 != nullptr) {
|
||||
static constexpr uint8_t LED_COUNT = 12;
|
||||
static constexpr uint8_t COLORS[][3] = {
|
||||
{ 255, 0, 0 }, // red
|
||||
{ 0, 255, 0 }, // green
|
||||
{ 0, 0, 255 }, // blue
|
||||
};
|
||||
py32_led_set_count(py32, LED_COUNT);
|
||||
for (auto& c : COLORS) {
|
||||
for (uint8_t i = 0; i < LED_COUNT; i++) {
|
||||
py32_led_set_color(py32, i, c[0], c[1], c[2]);
|
||||
}
|
||||
py32_led_refresh(py32);
|
||||
vTaskDelay(pdMS_TO_TICKS(150));
|
||||
}
|
||||
py32_led_disable(py32);
|
||||
} else {
|
||||
LOG_W(TAG, "py32 not found — LED boot pattern skipped");
|
||||
}
|
||||
|
||||
// Keep Axp2101 C++ wrapper alive for Axp2101Power (backlight + battery)
|
||||
axp2101 = std::make_shared<Axp2101>(I2C_NUM_0);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Device list
|
||||
// ---------------------------------------------------------------------------
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
axp2101,
|
||||
std::make_shared<Axp2101Power>(axp2101),
|
||||
createPower(),
|
||||
createSdCard(),
|
||||
createDisplay(),
|
||||
};
|
||||
}
|
||||
|
||||
extern const Configuration hardwareConfiguration = {
|
||||
.initBoot = initBoot,
|
||||
.createDevices = createDevices
|
||||
};
|
||||
@@ -0,0 +1,58 @@
|
||||
#include "Display.h"
|
||||
|
||||
#include <Axp2101.h>
|
||||
#include <Ft6x36Touch.h>
|
||||
#include <Ili934xDisplay.h>
|
||||
#include <Tactility/Logger.h>
|
||||
#include <Tactility/hal/i2c/I2c.h>
|
||||
|
||||
static const auto LOGGER = tt::Logger("StackChanDisplay");
|
||||
|
||||
static void setBacklightDuty(uint8_t backlightDuty) {
|
||||
const uint8_t voltage = 20 + ((8 * backlightDuty) / 255); // [0b00000, 0b11100]
|
||||
if (!tt::hal::i2c::masterWriteRegister(I2C_NUM_0, AXP2101_ADDRESS, 0x99, &voltage, 1, 1000)) {
|
||||
LOGGER.error("Failed to set display backlight voltage");
|
||||
}
|
||||
}
|
||||
|
||||
static std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||
auto configuration = std::make_unique<Ft6x36Touch::Configuration>(
|
||||
I2C_NUM_0,
|
||||
319,//LCD_HORIZONTAL_RESOLUTION,
|
||||
239,//LCD_VERTICAL_RESOLUTION,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
return std::make_shared<Ft6x36Touch>(std::move(configuration));
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
Ili934xDisplay::Configuration panel_configuration = {
|
||||
.horizontalResolution = LCD_HORIZONTAL_RESOLUTION,
|
||||
.verticalResolution = LCD_VERTICAL_RESOLUTION,
|
||||
.gapX = 0,
|
||||
.gapY = 0,
|
||||
.swapXY = false,
|
||||
.mirrorX = false,
|
||||
.mirrorY = false,
|
||||
.invertColor = true,
|
||||
.swapBytes = true,
|
||||
.bufferSize = LCD_BUFFER_SIZE,
|
||||
.touch = createTouch(),
|
||||
.backlightDutyFunction = ::setBacklightDuty,
|
||||
.resetPin = GPIO_NUM_NC,
|
||||
.rgbElementOrder = LCD_RGB_ELEMENT_ORDER_BGR
|
||||
};
|
||||
|
||||
auto spi_configuration = std::make_shared<Ili934xDisplay::SpiConfiguration>(Ili934xDisplay::SpiConfiguration {
|
||||
.spiHostDevice = LCD_SPI_HOST,
|
||||
.csPin = LCD_PIN_CS,
|
||||
.dcPin = LCD_PIN_DC,
|
||||
.pixelClockFrequency = 40'000'000,
|
||||
.transactionQueueDepth = 10
|
||||
});
|
||||
|
||||
return std::make_shared<Ili934xDisplay>(panel_configuration, spi_configuration, true);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/display/DisplayDevice.h>
|
||||
#include <driver/gpio.h>
|
||||
#include <driver/spi_common.h>
|
||||
|
||||
// Display
|
||||
constexpr auto LCD_SPI_HOST = SPI2_HOST;
|
||||
constexpr auto LCD_PIN_CS = GPIO_NUM_3;
|
||||
constexpr auto LCD_PIN_DC = GPIO_NUM_35;
|
||||
constexpr auto LCD_HORIZONTAL_RESOLUTION = 320;
|
||||
constexpr auto LCD_VERTICAL_RESOLUTION = 240;
|
||||
constexpr auto LCD_BUFFER_HEIGHT = LCD_VERTICAL_RESOLUTION / 10;
|
||||
constexpr auto LCD_BUFFER_SIZE = LCD_HORIZONTAL_RESOLUTION * LCD_BUFFER_HEIGHT;
|
||||
constexpr auto LCD_SPI_TRANSFER_SIZE_LIMIT = LCD_BUFFER_SIZE * LV_COLOR_DEPTH / 8;
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay();
|
||||
@@ -0,0 +1,86 @@
|
||||
#include "Power.h"
|
||||
|
||||
#include <Tactility/hal/power/PowerDevice.h>
|
||||
#include <drivers/ina226.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/log.h>
|
||||
|
||||
using namespace tt::hal::power;
|
||||
|
||||
static constexpr auto* TAG = "StackChanPower";
|
||||
|
||||
// 1S Li-ion cell (550 mAh): 3.2V (empty) – 4.2V (full)
|
||||
static constexpr float MIN_BATTERY_VOLTAGE_MV = 3200.0f;
|
||||
static constexpr float MAX_BATTERY_VOLTAGE_MV = 4200.0f;
|
||||
|
||||
class StackChanPower final : public PowerDevice {
|
||||
public:
|
||||
explicit StackChanPower(::Device* ina226Device) : ina226(ina226Device) {}
|
||||
|
||||
std::string getName() const override { return "M5Stack StackChan Power"; }
|
||||
std::string getDescription() const override { return "Battery monitoring via INA226 over I2C"; }
|
||||
|
||||
bool supportsMetric(MetricType type) const override {
|
||||
switch (type) {
|
||||
using enum MetricType;
|
||||
case BatteryVoltage:
|
||||
case ChargeLevel:
|
||||
case Current:
|
||||
return ina226 != nullptr;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool getMetric(MetricType type, MetricData& data) override {
|
||||
switch (type) {
|
||||
using enum MetricType;
|
||||
|
||||
case BatteryVoltage: {
|
||||
if (ina226 == nullptr) return false;
|
||||
float volts = 0.0f;
|
||||
if (ina226_read_bus_voltage(ina226, &volts) != ERROR_NONE) return false;
|
||||
data.valueAsUint32 = static_cast<uint32_t>(volts * 1000.0f);
|
||||
return true;
|
||||
}
|
||||
|
||||
case ChargeLevel: {
|
||||
if (ina226 == nullptr) return false;
|
||||
float volts = 0.0f;
|
||||
if (ina226_read_bus_voltage(ina226, &volts) != ERROR_NONE) return false;
|
||||
float voltage_mv = volts * 1000.0f;
|
||||
if (voltage_mv >= MAX_BATTERY_VOLTAGE_MV) {
|
||||
data.valueAsUint8 = 100;
|
||||
} else if (voltage_mv <= MIN_BATTERY_VOLTAGE_MV) {
|
||||
data.valueAsUint8 = 0;
|
||||
} else {
|
||||
float factor = (voltage_mv - MIN_BATTERY_VOLTAGE_MV) / (MAX_BATTERY_VOLTAGE_MV - MIN_BATTERY_VOLTAGE_MV);
|
||||
data.valueAsUint8 = static_cast<uint8_t>(factor * 100.0f);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
case Current: {
|
||||
if (ina226 == nullptr) return false;
|
||||
float amps = 0.0f;
|
||||
if (ina226_read_shunt_current(ina226, &s) != ERROR_NONE) return false;
|
||||
data.valueAsInt32 = static_cast<int32_t>(amps * 1000.0f);
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
::Device* ina226;
|
||||
};
|
||||
|
||||
std::shared_ptr<PowerDevice> createPower() {
|
||||
auto* ina226 = device_find_by_name("ina226");
|
||||
if (ina226 == nullptr) {
|
||||
LOG_E(TAG, "ina226 device not found");
|
||||
}
|
||||
return std::make_shared<StackChanPower>(ina226);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <Tactility/hal/power/PowerDevice.h>
|
||||
|
||||
std::shared_ptr<tt::hal::power::PowerDevice> createPower();
|
||||
@@ -0,0 +1,30 @@
|
||||
#include "SdCard.h"
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
#include <Tactility/hal/sdcard/SpiSdCardDevice.h>
|
||||
|
||||
constexpr auto STACKCHAN_SDCARD_PIN_CS = GPIO_NUM_4;
|
||||
constexpr auto STACKCHAN_LCD_PIN_CS = GPIO_NUM_3;
|
||||
|
||||
using tt::hal::sdcard::SpiSdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard() {
|
||||
auto configuration = std::make_unique<SpiSdCardDevice::Config>(
|
||||
STACKCHAN_SDCARD_PIN_CS,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_NC,
|
||||
SdCardDevice::MountBehaviour::AtBoot,
|
||||
tt::lvgl::getSyncLock(),
|
||||
std::vector { STACKCHAN_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
|
||||
);
|
||||
}
|
||||
@@ -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,21 @@
|
||||
#include <tactility/module.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
static error_t start() {
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
static error_t stop() {
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
struct Module m5stack_stackchan_module = {
|
||||
.name = "m5stack-stackchan",
|
||||
.start = start,
|
||||
.stop = stop,
|
||||
.symbols = nullptr,
|
||||
.internal = nullptr
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
[general]
|
||||
vendor=M5Stack
|
||||
name=StackChan
|
||||
|
||||
[apps]
|
||||
launcherAppId=Launcher
|
||||
|
||||
[hardware]
|
||||
target=ESP32S3
|
||||
flashSize=16MB
|
||||
spiRam=true
|
||||
spiRamMode=QUAD
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=2"
|
||||
shape=rectangle
|
||||
dpi=200
|
||||
|
||||
[lvgl]
|
||||
colorDepth=16
|
||||
@@ -0,0 +1,7 @@
|
||||
dependencies:
|
||||
- Platforms/platform-esp32
|
||||
- Drivers/bmi270-module
|
||||
- Drivers/bm8563-module
|
||||
- Drivers/ina226-module
|
||||
- Drivers/py32ioexpander-module
|
||||
dts: m5stack,stackchan.dts
|
||||
@@ -0,0 +1,123 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <bindings/bmi270.h>
|
||||
#include <bindings/bm8563.h>
|
||||
#include <bindings/ina226.h>
|
||||
#include <bindings/py32ioexpander.h>
|
||||
|
||||
// Reference: https://docs.m5stack.com/en/StackChan
|
||||
/ {
|
||||
compatible = "root";
|
||||
model = "M5Stack StackChan";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
};
|
||||
|
||||
i2c_internal {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
port = <I2C_NUM_0>;
|
||||
clock-frequency = <100000>;
|
||||
pin-sda = <&gpio0 12 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 11 GPIO_FLAG_NONE>;
|
||||
|
||||
// PY32L020 body IO expander — controls WS2812C LED ring (12 LEDs)
|
||||
py32 {
|
||||
compatible = "m5stack,py32ioexpander";
|
||||
reg = <0x6F>;
|
||||
};
|
||||
|
||||
bmi270 {
|
||||
compatible = "bosch,bmi270";
|
||||
reg = <0x69>;
|
||||
};
|
||||
|
||||
bm8563 {
|
||||
compatible = "belling,bm8563";
|
||||
reg = <0x51>;
|
||||
};
|
||||
|
||||
ina226 {
|
||||
compatible = "ti,ina226";
|
||||
reg = <0x41>;
|
||||
shunt-milliohms = <10>;
|
||||
};
|
||||
|
||||
// AXP2101 PMIC @ 0x34 — initialized manually in initBoot()
|
||||
// AW9523B GPIO expander @ 0x58 — initialized manually in initBoot() (same as CoreS3)
|
||||
// AW88298 speaker amp @ 0x36 — initialized manually in initBoot()
|
||||
// ES7210 microphone ADC @ 0x40 — initialized manually in initBoot()
|
||||
// FT6336U capacitive touch @ 0x38 — used by Display driver (FT6x36 library)
|
||||
|
||||
// TODO: Si12T 3-zone head touch @ 0x68 — INT active-low, 10kΩ pull-up to 3.3V; driver not yet implemented
|
||||
// TODO: GC0308 camera @ 0x21 — requires i2c_master driver, not yet available
|
||||
// TODO: LTR-553ALS-WA proximity/light @ 0x23 — no driver yet
|
||||
// TODO: BMM150 magnetometer @ 0x10 — accessible only via BMI270 aux I2C
|
||||
};
|
||||
|
||||
i2c_port_a {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
port = <I2C_NUM_1>;
|
||||
clock-frequency = <400000>;
|
||||
pin-sda = <&gpio0 2 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 1 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
i2c_port_b {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
status = "disabled";
|
||||
port = <I2C_NUM_1>;
|
||||
clock-frequency = <400000>;
|
||||
pin-sda = <&gpio0 9 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 8 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
i2c_port_c {
|
||||
compatible = "espressif,esp32-i2c";
|
||||
status = "disabled";
|
||||
port = <I2C_NUM_1>;
|
||||
clock-frequency = <400000>;
|
||||
pin-sda = <&gpio0 18 GPIO_FLAG_NONE>;
|
||||
pin-scl = <&gpio0 17 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
spi0 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI2_HOST>;
|
||||
pin-mosi = <&gpio0 37 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 35 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 36 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
// AW88298 speaker + ES7210 microphone
|
||||
i2s0 {
|
||||
compatible = "espressif,esp32-i2s";
|
||||
port = <I2S_NUM_0>;
|
||||
pin-bclk = <&gpio0 34 GPIO_FLAG_NONE>;
|
||||
pin-ws = <&gpio0 33 GPIO_FLAG_NONE>;
|
||||
pin-data-out = <&gpio0 13 GPIO_FLAG_NONE>;
|
||||
pin-data-in = <&gpio0 14 GPIO_FLAG_NONE>;
|
||||
pin-mclk = <&gpio0 0 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
// TODO: Servo UART (SCS9009, 1 Mbaud) — TX=GPIO6, RX=GPIO7
|
||||
uart_port_a: uart1 {
|
||||
compatible = "espressif,esp32-uart";
|
||||
status = "disabled";
|
||||
port = <UART_NUM_1>;
|
||||
pin-tx = <&gpio0 1 GPIO_FLAG_NONE>;
|
||||
pin-rx = <&gpio0 2 GPIO_FLAG_NONE>;
|
||||
};
|
||||
};
|
||||
@@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility esp_lvgl_port esp_lcd ST7789 PwmBacklight ButtonControl m5pm1-module
|
||||
REQUIRES Tactility esp_lvgl_port esp_lcd ST7789 PwmBacklight ButtonControl m5pm1-module vfs fatfs
|
||||
)
|
||||
|
||||
@@ -1,14 +1,101 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include "devices/Power.h"
|
||||
#include <driver/gpio.h>
|
||||
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/i2c_controller.h>
|
||||
#include <drivers/m5pm1.h>
|
||||
|
||||
#include <Tactility/hal/Configuration.h>
|
||||
#include <ButtonControl.h>
|
||||
#include <PwmBacklight.h>
|
||||
|
||||
using namespace tt::hal;
|
||||
|
||||
static constexpr auto* TAG = "StickS3";
|
||||
|
||||
static constexpr uint8_t ES8311_I2C_ADDR = 0x18;
|
||||
|
||||
static error_t initSound(::Device* i2c_controller) {
|
||||
// Init data from M5Unified:
|
||||
// https://github.com/m5stack/M5Unified/blob/master/src/M5Unified.cpp#L454
|
||||
static constexpr uint8_t ENABLED_BULK_DATA[] = {
|
||||
0x00, 0x80, // 0x00 RESET/ CSM POWER ON
|
||||
0x01, 0x3F, // 0x01 CLOCK_MANAGER/ use MCLK pin (external), all clocks on
|
||||
0x02, 0x00, // 0x02 CLOCK_MANAGER/ pre_div=1 pre_multi=1 (256x MCLK from ESP32 is correct ratio)
|
||||
0x0D, 0x01, // 0x0D SYSTEM/ Power up analog circuitry
|
||||
0x12, 0x00, // 0x12 SYSTEM/ power-up DAC - NOT default
|
||||
0x13, 0x10, // 0x13 SYSTEM/ Enable output to HP drive - NOT default
|
||||
0x32, 0xBF, // 0x32 DAC/ DAC volume (0xBF == ±0 dB )
|
||||
0x37, 0x08, // 0x37 DAC/ Bypass DAC equalizer - NOT default
|
||||
};
|
||||
|
||||
error_t error = i2c_controller_write_register_array(
|
||||
i2c_controller,
|
||||
ES8311_I2C_ADDR,
|
||||
ENABLED_BULK_DATA,
|
||||
sizeof(ENABLED_BULK_DATA),
|
||||
pdMS_TO_TICKS(1000)
|
||||
);
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to enable ES8311: %s", error_to_string(error));
|
||||
return error;
|
||||
}
|
||||
|
||||
// Enable speaker amp via M5PM1 driver
|
||||
auto* m5pm1 = device_find_by_name("m5pm1");
|
||||
if (m5pm1 != nullptr) {
|
||||
m5pm1_set_speaker_enable(m5pm1, true);
|
||||
} else {
|
||||
LOG_W(TAG, "m5pm1 not found — speaker amp not enabled");
|
||||
}
|
||||
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
static error_t initMicrophone(::Device* i2c_controller) {
|
||||
// Init data from M5Unified:
|
||||
// https://github.com/m5stack/M5Unified/blob/master/src/M5Unified.cpp#L842
|
||||
static constexpr uint8_t ENABLED_BULK_DATA[] = {
|
||||
0x00, 0x80, // 0x00 RESET/ CSM POWER ON
|
||||
0x01, 0x3F, // 0x01 CLOCK_MANAGER/ use MCLK pin (external), all clocks on
|
||||
0x02, 0x00, // 0x02 CLOCK_MANAGER/ pre_div=1 pre_multi=1 (256x MCLK from ESP32 is correct ratio)
|
||||
0x0D, 0x01, // 0x0D SYSTEM/ Power up analog circuitry
|
||||
0x0E, 0x02, // 0x0E SYSTEM/ : Enable analog PGA, enable ADC modulator
|
||||
0x14, 0x10, // ES8311_ADC_REG14 : select Mic1p-Mic1n / PGA GAIN (minimum)
|
||||
0x17, 0xFF, // ES8311_ADC_REG17 : ADC_VOLUME (MAXGAIN) // (0xBF == ± 0 dB )
|
||||
0x1C, 0x6A, // ES8311_ADC_REG1C : ADC Equalizer bypass, cancel DC offset in digital domain
|
||||
};
|
||||
|
||||
error_t error = i2c_controller_write_register_array(
|
||||
i2c_controller,
|
||||
ES8311_I2C_ADDR,
|
||||
ENABLED_BULK_DATA,
|
||||
sizeof(ENABLED_BULK_DATA),
|
||||
pdMS_TO_TICKS(1000)
|
||||
);
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to enable ES8311: %s", error_to_string(error));
|
||||
return error;
|
||||
}
|
||||
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
bool initBoot() {
|
||||
auto* i2c_internal = device_find_by_name("i2c_internal");
|
||||
check(i2c_internal, "i2c_internal not found");
|
||||
|
||||
error_t error = initSound(i2c_internal);
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to enable ES8311 speaker");
|
||||
}
|
||||
|
||||
error = initMicrophone(i2c_internal);
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to enable ES8311 microphone");
|
||||
}
|
||||
return driver::pwmbacklight::init(GPIO_NUM_38, 512);
|
||||
}
|
||||
|
||||
@@ -16,7 +103,8 @@ static DeviceVector createDevices() {
|
||||
return {
|
||||
createPower(),
|
||||
ButtonControl::createTwoButtonControl(11, 12), // top button, side button
|
||||
createDisplay()
|
||||
createDisplay(),
|
||||
createSdCard()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#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_7;
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <Tactility/hal/sdcard/SdCardDevice.h>
|
||||
#include <memory>
|
||||
|
||||
using tt::hal::sdcard::SdCardDevice;
|
||||
|
||||
std::shared_ptr<SdCardDevice> createSdCard();
|
||||
@@ -4,7 +4,6 @@ name=StickS3
|
||||
|
||||
[apps]
|
||||
launcherAppId=Launcher
|
||||
autoStartAppId=ApWebServer
|
||||
|
||||
[hardware]
|
||||
target=ESP32S3
|
||||
@@ -14,6 +13,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=80M
|
||||
esptoolFlashFreq=80M
|
||||
tinyUsb=true
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=1.14"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/dts-v1/;
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
@@ -12,6 +13,10 @@
|
||||
compatible = "root";
|
||||
model = "M5Stack StickS3";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
@@ -50,6 +55,15 @@
|
||||
pin-sclk = <&gpio0 40 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
//DIY SD Card - https://wiki.bruce.computer/wiring-diagrams/m5sticks3/sd-card/
|
||||
spi1 {
|
||||
compatible = "espressif,esp32-spi";
|
||||
host = <SPI3_HOST>;
|
||||
pin-mosi = <&gpio0 6 GPIO_FLAG_NONE>;
|
||||
pin-miso = <&gpio0 4 GPIO_FLAG_NONE>;
|
||||
pin-sclk = <&gpio0 5 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
// Speaker and microphone (ES8311)
|
||||
i2s0 {
|
||||
compatible = "espressif,esp32-i2s";
|
||||
|
||||
@@ -3,5 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c*)
|
||||
idf_component_register(
|
||||
SRCS ${SOURCE_FILES}
|
||||
INCLUDE_DIRS "Source"
|
||||
REQUIRES Tactility esp_lvgl_port esp_lcd EspLcdCompat esp_lcd_ili9881c esp_lcd_st7123 esp_lcd_touch_st7123 GT911 PwmBacklight driver vfs fatfs
|
||||
REQUIRES Tactility esp_lvgl_port esp_lcd EspLcdCompat esp_lcd_ili9881c esp_lcd_st7123 esp_lcd_touch_st7123 GT911 PwmBacklight driver vfs fatfs ina226-module
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "devices/Display.h"
|
||||
#include "devices/SdCard.h"
|
||||
#include "devices/Power.h"
|
||||
|
||||
#include <tactility/drivers/gpio_controller.h>
|
||||
#include <tactility/drivers/i2c_controller.h>
|
||||
@@ -13,6 +14,7 @@ static constexpr auto* TAG = "Tab5";
|
||||
|
||||
static DeviceVector createDevices() {
|
||||
return {
|
||||
createPower(),
|
||||
createDisplay(),
|
||||
createSdCard(),
|
||||
};
|
||||
@@ -195,6 +197,57 @@ static error_t initSound(::Device* i2c_controller, ::Device* io_expander0 = null
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
static error_t initMicrophone(::Device* i2c_controller) {
|
||||
// ES7210 quad-channel microphone ADC at 0x40.
|
||||
// Register sequence from M5Unified (M5Unified.cpp, _microphone_enabled_cb_tab5).
|
||||
// Configures 4-slot TDM output at 48kHz/16-bit with MIC1+MIC2 active and MICBIAS enabled.
|
||||
static constexpr uint8_t ES7210_I2C_ADDR = 0x40;
|
||||
static constexpr uint8_t INIT_DATA[] = {
|
||||
0x00, 0xFF, // RESET_CTL: full reset
|
||||
0x00, 0x41, // RESET_CTL: release reset, keep CSM active
|
||||
0x01, 0x1F, // CLK_ON_OFF: enable all clocks
|
||||
0x06, 0x00, // DIGITAL_PDN: power up all digital blocks
|
||||
0x07, 0x20, // ADC_OSR: OSR=256
|
||||
0x08, 0x10, // MODE_CFG: I2S slave, TDM mode
|
||||
0x09, 0x30, // TCT0_CHPINI: chopper init period
|
||||
0x0A, 0x30, // TCT1_CHPINI
|
||||
0x20, 0x0A, // ADC34_HPF2
|
||||
0x21, 0x2A, // ADC34_HPF1
|
||||
0x22, 0x0A, // ADC12_HPF2
|
||||
0x23, 0x2A, // ADC12_HPF1
|
||||
0x02, 0xC1, // CLK_CTRL: MCLK from I2S, PLL off
|
||||
0x04, 0x01, // SDPOUT_CTL1: TDM output enable
|
||||
0x05, 0x00, // SDPOUT_CTL0
|
||||
0x11, 0x60, // DBIAS: adjust reference voltage for P4
|
||||
0x40, 0x42, // ANALOG_SYS: enable analog supply
|
||||
0x41, 0x70, // MICBIAS12: enable MICBIAS for MIC1+MIC2
|
||||
0x42, 0x70, // MICBIAS34: enable MICBIAS for MIC3+MIC4
|
||||
0x43, 0x1B, // MIC1_GAIN: +30 dB
|
||||
0x44, 0x1B, // MIC2_GAIN: +30 dB
|
||||
0x45, 0x00, // MIC3_GAIN: AEC ref, no gain
|
||||
0x46, 0x00, // MIC4_GAIN: AEC ref, no gain
|
||||
0x47, 0x00, // MIC1_LP
|
||||
0x48, 0x00, // MIC2_LP
|
||||
0x49, 0x00, // MIC3_LP
|
||||
0x4A, 0x00, // MIC4_LP
|
||||
0x4B, 0x00, // MIC12_PDN: power up MIC1+MIC2
|
||||
0x4C, 0xFF, // MIC34_PDN: keep MIC3+MIC4 in power-down (AEC ref not needed)
|
||||
0x01, 0x14, // CLK_ON_OFF: final clock config
|
||||
};
|
||||
|
||||
error_t error = i2c_controller_write_register_array(
|
||||
i2c_controller,
|
||||
ES7210_I2C_ADDR,
|
||||
INIT_DATA,
|
||||
sizeof(INIT_DATA),
|
||||
pdMS_TO_TICKS(1000)
|
||||
);
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to init ES7210: %s", error_to_string(error));
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
static bool initBoot() {
|
||||
auto* i2c0 = device_find_by_name("i2c0");
|
||||
check(i2c0, "i2c0 not found");
|
||||
@@ -212,6 +265,11 @@ static bool initBoot() {
|
||||
LOG_E(TAG, "Failed to enable ES8388");
|
||||
}
|
||||
|
||||
error = initMicrophone(i2c0);
|
||||
if (error != ERROR_NONE) {
|
||||
LOG_E(TAG, "Failed to init ES7210");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
#include "Power.h"
|
||||
|
||||
#include <Tactility/hal/power/PowerDevice.h>
|
||||
#include <drivers/ina226.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/gpio_controller.h>
|
||||
#include <tactility/log.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
|
||||
using namespace tt::hal::power;
|
||||
|
||||
static constexpr auto* TAG = "Tab5Power";
|
||||
|
||||
// NP-F550 is a 2S Li-ion pack; INA226 measures the pack voltage on BAT_IN
|
||||
// before the DC-DC converter. Per-cell range 3.2-4.2V → pack range 6.4-8.4V.
|
||||
static constexpr float MIN_BATTERY_VOLTAGE_MV = 6400.0f;
|
||||
static constexpr float MAX_BATTERY_VOLTAGE_MV = 8400.0f;
|
||||
|
||||
// INA226 convention: negative raw current = charging, positive = discharging.
|
||||
// After negation in getMetric(Current), >50mA means charging into the battery.
|
||||
static constexpr float CHARGING_CURRENT_THRESHOLD_AMPS = 0.05f;
|
||||
|
||||
// GPIO expander 1 (0x44) pin 4: PWROFF_PULSE
|
||||
static constexpr int GPIO_EXP1_PIN_DEVICE_POWER = 4;
|
||||
// GPIO expander 1 (0x44) pin 5: IP2326 nCHG_QC_EN (active-low: LOW = QC enabled)
|
||||
static constexpr int GPIO_EXP1_PIN_IP2326_NCHG_QC_EN = 5;
|
||||
// GPIO expander 1 (0x44) pin 7: IP2326 CHG_EN (HIGH = charging enabled, LOW = disabled)
|
||||
static constexpr int GPIO_EXP1_PIN_IP2326_CHG_EN = 7;
|
||||
|
||||
class Tab5Power final : public PowerDevice {
|
||||
public:
|
||||
Tab5Power(::Device* ina226Device, ::Device* ioExpander1Device)
|
||||
: ina226(ina226Device), ioExpander1(ioExpander1Device) {
|
||||
// Initialize CHG_EN as output HIGH (charging enabled at startup).
|
||||
setAllowedToCharge(true);
|
||||
}
|
||||
|
||||
std::string getName() const override { return "M5Stack Tab5 Power"; }
|
||||
std::string getDescription() const override { return "Battery monitoring via INA226 over I2C"; }
|
||||
|
||||
bool supportsMetric(MetricType type) const override {
|
||||
switch (type) {
|
||||
using enum MetricType;
|
||||
case BatteryVoltage:
|
||||
case ChargeLevel:
|
||||
case Current:
|
||||
case IsCharging:
|
||||
return ina226 != nullptr;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool getMetric(MetricType type, MetricData& data) override {
|
||||
switch (type) {
|
||||
using enum MetricType;
|
||||
|
||||
case BatteryVoltage: {
|
||||
if (ina226 == nullptr) return false;
|
||||
float volts = 0.0f;
|
||||
if (ina226_read_bus_voltage(ina226, &volts) != ERROR_NONE) return false;
|
||||
data.valueAsUint32 = static_cast<uint32_t>(volts * 1000.0f);
|
||||
return true;
|
||||
}
|
||||
|
||||
case ChargeLevel: {
|
||||
if (ina226 == nullptr) return false;
|
||||
float volts = 0.0f;
|
||||
if (ina226_read_bus_voltage(ina226, &volts) != ERROR_NONE) return false;
|
||||
float voltage_mv = volts * 1000.0f;
|
||||
if (voltage_mv >= MAX_BATTERY_VOLTAGE_MV) {
|
||||
data.valueAsUint8 = 100;
|
||||
} else if (voltage_mv <= MIN_BATTERY_VOLTAGE_MV) {
|
||||
data.valueAsUint8 = 0;
|
||||
} else {
|
||||
float factor = (voltage_mv - MIN_BATTERY_VOLTAGE_MV) / (MAX_BATTERY_VOLTAGE_MV - MIN_BATTERY_VOLTAGE_MV);
|
||||
data.valueAsUint8 = static_cast<uint8_t>(factor * 100.0f);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
case Current: {
|
||||
if (ina226 == nullptr) return false;
|
||||
float amps = 0.0f;
|
||||
if (ina226_read_shunt_current(ina226, &s) != ERROR_NONE) return false;
|
||||
// INA226 convention: negative = charging, positive = discharging.
|
||||
// Negate so the HAL value is positive when charging, negative when discharging.
|
||||
data.valueAsInt32 = static_cast<int32_t>(-amps * 1000.0f);
|
||||
return true;
|
||||
}
|
||||
|
||||
case IsCharging: {
|
||||
if (ina226 == nullptr) return false;
|
||||
float amps = 0.0f;
|
||||
if (ina226_read_shunt_current(ina226, &s) != ERROR_NONE) return false;
|
||||
// Raw INA226: negative = charging. Threshold in raw terms = -0.05A.
|
||||
data.valueAsBool = amps < -CHARGING_CURRENT_THRESHOLD_AMPS;
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool supportsChargeControl() const override { return ioExpander1 != nullptr; }
|
||||
|
||||
bool isAllowedToCharge() const override { return chargingAllowed; }
|
||||
|
||||
void setAllowedToCharge(bool allowed) override {
|
||||
if (ioExpander1 == nullptr) return;
|
||||
auto* pin = gpio_descriptor_acquire(ioExpander1, GPIO_EXP1_PIN_IP2326_CHG_EN, GPIO_OWNER_GPIO);
|
||||
if (pin == nullptr) {
|
||||
LOG_W(TAG, "Failed to acquire CHG_EN pin");
|
||||
return;
|
||||
}
|
||||
if (gpio_descriptor_set_flags(pin, GPIO_FLAG_DIRECTION_OUTPUT) != ERROR_NONE) {
|
||||
LOG_W(TAG, "Failed to set CHG_EN pin direction");
|
||||
gpio_descriptor_release(pin);
|
||||
return;
|
||||
}
|
||||
if (gpio_descriptor_set_level(pin, allowed) != ERROR_NONE) {
|
||||
LOG_W(TAG, "Failed to set CHG_EN pin level");
|
||||
gpio_descriptor_release(pin);
|
||||
return;
|
||||
}
|
||||
gpio_descriptor_release(pin);
|
||||
chargingAllowed = allowed;
|
||||
}
|
||||
|
||||
bool supportsQuickCharge() const override { return ioExpander1 != nullptr; }
|
||||
|
||||
bool isQuickChargeEnabled() const override { return quickChargeEnabled; }
|
||||
|
||||
void setQuickChargeEnabled(bool enabled) override {
|
||||
if (ioExpander1 == nullptr) return;
|
||||
auto* pin = gpio_descriptor_acquire(ioExpander1, GPIO_EXP1_PIN_IP2326_NCHG_QC_EN, GPIO_OWNER_GPIO);
|
||||
if (pin == nullptr) {
|
||||
LOG_W(TAG, "Failed to acquire nCHG_QC_EN pin");
|
||||
return;
|
||||
}
|
||||
if (gpio_descriptor_set_flags(pin, GPIO_FLAG_DIRECTION_OUTPUT) != ERROR_NONE) {
|
||||
LOG_W(TAG, "Failed to set nCHG_QC_EN pin direction");
|
||||
gpio_descriptor_release(pin);
|
||||
return;
|
||||
}
|
||||
if (gpio_descriptor_set_level(pin, !enabled) != ERROR_NONE) {
|
||||
LOG_W(TAG, "Failed to set nCHG_QC_EN pin level");
|
||||
gpio_descriptor_release(pin);
|
||||
return;
|
||||
}
|
||||
gpio_descriptor_release(pin);
|
||||
quickChargeEnabled = enabled;
|
||||
}
|
||||
|
||||
bool supportsPowerOff() const override { return ioExpander1 != nullptr; }
|
||||
|
||||
void powerOff() override {
|
||||
if (ioExpander1 == nullptr) return;
|
||||
auto* pin = gpio_descriptor_acquire(ioExpander1, GPIO_EXP1_PIN_DEVICE_POWER, GPIO_OWNER_GPIO);
|
||||
if (pin == nullptr) {
|
||||
LOG_E(TAG, "Failed to acquire DEVICE_POWER pin");
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
gpio_descriptor_set_level(pin, true);
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
gpio_descriptor_set_level(pin, false);
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
}
|
||||
gpio_descriptor_release(pin);
|
||||
}
|
||||
|
||||
private:
|
||||
::Device* ina226;
|
||||
::Device* ioExpander1;
|
||||
bool chargingAllowed = true;
|
||||
bool quickChargeEnabled = false;
|
||||
};
|
||||
|
||||
std::shared_ptr<PowerDevice> createPower() {
|
||||
auto* ina226 = device_find_by_name("ina226");
|
||||
if (ina226 == nullptr) {
|
||||
LOG_E(TAG, "ina226 device not found");
|
||||
}
|
||||
auto* io_expander1 = device_find_by_name("io_expander1");
|
||||
if (io_expander1 == nullptr) {
|
||||
LOG_E(TAG, "io_expander1 not found");
|
||||
}
|
||||
return std::make_shared<Tab5Power>(ina226, io_expander1);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <Tactility/hal/power/PowerDevice.h>
|
||||
|
||||
std::shared_ptr<tt::hal::power::PowerDevice> createPower();
|
||||
@@ -1,14 +1,113 @@
|
||||
#include <tactility/module.h>
|
||||
#include <tactility/device.h>
|
||||
#include <tactility/drivers/gpio_controller.h>
|
||||
#include <tactility/log.h>
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/timers.h>
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#define TAG "Tab5"
|
||||
|
||||
constexpr auto GPIO_EXP0_PIN_SPEAKER_ENABLE = 1;
|
||||
constexpr auto GPIO_EXP0_PIN_HEADPHONE_DETECT = 7;
|
||||
constexpr auto HP_DETECT_POLL_MS = 1000;
|
||||
|
||||
// hp_detect_timer is only touched from start()/stop(), which are called serially
|
||||
// by the module manager — no atomic needed for the handle itself.
|
||||
static TimerHandle_t hp_detect_timer = nullptr;
|
||||
static std::atomic<Device*> io_expander0_cached { nullptr };
|
||||
// Flags are written by the timer daemon task and read by start()/stop() — use atomics.
|
||||
static std::atomic<bool> hp_detect_last { false };
|
||||
static std::atomic<bool> hp_detect_initialized { false };
|
||||
|
||||
static void headphoneDetectCallback(TimerHandle_t /*timer*/) {
|
||||
Device* cached = io_expander0_cached.load(std::memory_order_acquire);
|
||||
if (!cached) {
|
||||
cached = device_find_by_name("io_expander0");
|
||||
io_expander0_cached.store(cached, std::memory_order_release);
|
||||
}
|
||||
auto* io_expander0 = cached;
|
||||
if (!io_expander0) {
|
||||
return; // Not ready yet, will retry on next tick
|
||||
}
|
||||
|
||||
auto* hp_pin = gpio_descriptor_acquire(io_expander0, GPIO_EXP0_PIN_HEADPHONE_DETECT, GPIO_OWNER_GPIO);
|
||||
if (!hp_pin) {
|
||||
LOG_W(TAG, "hp_detect: HP_DET pin busy");
|
||||
return;
|
||||
}
|
||||
|
||||
bool hp = false;
|
||||
error_t err = gpio_descriptor_get_level(hp_pin, &hp);
|
||||
gpio_descriptor_release(hp_pin);
|
||||
|
||||
if (err != ERROR_NONE) {
|
||||
LOG_W(TAG, "hp_detect: HP_DET read error: %s", error_to_string(err));
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_D(TAG, "hp_detect: HP_DET=%d", (int)hp);
|
||||
|
||||
if (!hp_detect_initialized || hp != hp_detect_last) {
|
||||
auto* spk_pin = gpio_descriptor_acquire(io_expander0, GPIO_EXP0_PIN_SPEAKER_ENABLE, GPIO_OWNER_GPIO);
|
||||
if (!spk_pin) {
|
||||
LOG_W(TAG, "hp_detect: SPK_EN pin busy, will retry");
|
||||
return;
|
||||
}
|
||||
error_t spk_err = gpio_descriptor_set_level(spk_pin, !hp);
|
||||
gpio_descriptor_release(spk_pin);
|
||||
if (spk_err != ERROR_NONE) {
|
||||
LOG_W(TAG, "hp_detect: SPK_EN set error: %s, will retry", error_to_string(spk_err));
|
||||
return;
|
||||
}
|
||||
hp_detect_last = hp;
|
||||
hp_detect_initialized = true;
|
||||
LOG_I(TAG, "Headphones %s, speaker %s", hp ? "detected" : "removed", hp ? "disabled" : "enabled");
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
static error_t start() {
|
||||
// Empty for now
|
||||
|
||||
if (hp_detect_timer != nullptr) {
|
||||
LOG_W(TAG, "hp_detect timer already running");
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
hp_detect_initialized = false;
|
||||
hp_detect_last = false;
|
||||
|
||||
hp_detect_timer = xTimerCreate("hp_detect", pdMS_TO_TICKS(HP_DETECT_POLL_MS), pdTRUE, nullptr, headphoneDetectCallback);
|
||||
if (!hp_detect_timer) {
|
||||
LOG_E(TAG, "Failed to create hp_detect timer");
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
if (xTimerStart(hp_detect_timer, pdMS_TO_TICKS(100)) != pdPASS) {
|
||||
LOG_E(TAG, "Failed to start hp_detect timer");
|
||||
xTimerDelete(hp_detect_timer, pdMS_TO_TICKS(100));
|
||||
hp_detect_timer = nullptr;
|
||||
return ERROR_RESOURCE;
|
||||
}
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
static error_t stop() {
|
||||
// Empty for now
|
||||
if (hp_detect_timer == nullptr) {
|
||||
return ERROR_NONE;
|
||||
}
|
||||
if (xTimerStop(hp_detect_timer, pdMS_TO_TICKS(100)) != pdPASS) {
|
||||
LOG_W(TAG, "Failed to stop hp_detect timer");
|
||||
}
|
||||
if (xTimerDelete(hp_detect_timer, pdMS_TO_TICKS(100)) != pdPASS) {
|
||||
LOG_E(TAG, "Failed to delete hp_detect timer");
|
||||
}
|
||||
// Always clear the handle — stale non-null handle is worse than a resource leak,
|
||||
// as it would cause start() to silently skip re-creating the timer.
|
||||
hp_detect_timer = nullptr;
|
||||
io_expander0_cached.store(nullptr, std::memory_order_release);
|
||||
return ERROR_NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,3 +41,9 @@ CONFIG_ESP_HOSTED_PRIV_SDIO_PIN_D3_4BIT_BUS_SLOT_1=8
|
||||
CONFIG_ESP_HOSTED_SDIO_GPIO_RESET_SLAVE=15
|
||||
# Fixes recent changes to esp_hosted
|
||||
CONFIG_ESP_HOSTED_USE_MEMPOOL=n
|
||||
# Performance: larger L2 cache reduces PSRAM stalls for draw/DPI buffers
|
||||
CONFIG_CACHE_L2_CACHE_256KB=y
|
||||
# Performance: use P4's PPA (pixel processing accelerator for rotation)
|
||||
CONFIG_LVGL_PORT_ENABLE_PPA=y
|
||||
CONFIG_LV_DRAW_BUF_ALIGN=64
|
||||
CONFIG_LV_DEF_REFR_PERIOD=15
|
||||
|
||||
@@ -2,5 +2,6 @@ dependencies:
|
||||
- Platforms/platform-esp32
|
||||
- Drivers/pi4ioe5v6408-module
|
||||
- Drivers/bmi270-module
|
||||
- Drivers/ina226-module
|
||||
- Drivers/rx8130ce-module
|
||||
dts: m5stack,tab5.dts
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_i2s.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_uart.h>
|
||||
#include <bindings/bmi270.h>
|
||||
#include <bindings/ina226.h>
|
||||
#include <bindings/pi4ioe5v6408.h>
|
||||
#include <bindings/rx8130ce.h>
|
||||
|
||||
@@ -49,6 +51,12 @@
|
||||
compatible = "epson,rx8130ce";
|
||||
reg = <0x32>;
|
||||
};
|
||||
|
||||
ina226 {
|
||||
compatible = "ti,ina226";
|
||||
reg = <0x41>;
|
||||
shunt-milliohms = <5>;
|
||||
};
|
||||
};
|
||||
|
||||
i2c_port_a: i2c1 {
|
||||
@@ -77,4 +85,12 @@
|
||||
pin-data-in = <&gpio0 28 GPIO_FLAG_NONE>;
|
||||
pin-mclk = <&gpio0 30 GPIO_FLAG_NONE>;
|
||||
};
|
||||
|
||||
uart_port_a: uart1 {
|
||||
compatible = "espressif,esp32-uart";
|
||||
status = "disabled";
|
||||
port = <UART_NUM_1>;
|
||||
pin-tx = <&gpio0 53 GPIO_FLAG_NONE>;
|
||||
pin-rx = <&gpio0 54 GPIO_FLAG_NONE>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,6 +11,7 @@ flashSize=8MB
|
||||
spiRam=true
|
||||
spiRamMode=OCT
|
||||
spiRamSpeed=80M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=3.5"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -9,6 +10,10 @@
|
||||
compatible = "root";
|
||||
model = "unPhone";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -15,6 +15,7 @@ spiRamMode=QUAD
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=1.14"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_sdmmc.h>
|
||||
@@ -11,6 +12,10 @@
|
||||
compatible = "root";
|
||||
model = "Waveshare ESP32-S3-Geek";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -15,6 +15,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=1.3"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -11,6 +12,10 @@
|
||||
compatible = "root";
|
||||
model = "Waveshare S3 LCD 1.3";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -15,6 +15,7 @@ spiRamMode=QUAD
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=1.28"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -11,6 +12,10 @@
|
||||
compatible = "root";
|
||||
model = "Waveshare S3 Touch LCD 1.28";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -15,6 +15,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=1.47"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -10,6 +11,10 @@
|
||||
compatible = "root";
|
||||
model = "Waveshare S3 Touch LCD 1.47";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRamMode=OCT
|
||||
spiRamSpeed=120M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=120M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=4.3"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -10,6 +11,10 @@
|
||||
compatible = "root";
|
||||
model = "Waveshare ESP32-S3-Touch-LCD-4.3";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
@@ -10,13 +10,16 @@ constexpr auto LCD_VERTICAL_RESOLUTION = 480;
|
||||
std::shared_ptr<tt::hal::touch::TouchDevice> createTouch() {
|
||||
auto configuration = std::make_unique<Ft6x36Touch::Configuration>(
|
||||
I2C_NUM_0,
|
||||
GPIO_NUM_7,
|
||||
LCD_HORIZONTAL_RESOLUTION,
|
||||
LCD_VERTICAL_RESOLUTION
|
||||
LCD_VERTICAL_RESOLUTION,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
GPIO_NUM_NC,
|
||||
GPIO_NUM_7
|
||||
);
|
||||
|
||||
auto touch = std::make_shared<Ft6x36Touch>(std::move(configuration));
|
||||
return std::static_pointer_cast<tt::hal::touch::TouchDevice>(touch);
|
||||
return std::make_shared<Ft6x36Touch>(std::move(configuration));
|
||||
}
|
||||
|
||||
std::shared_ptr<tt::hal::display::DisplayDevice> createDisplay() {
|
||||
|
||||
@@ -13,6 +13,7 @@ spiRamMode=QUAD
|
||||
spiRamSpeed=80M
|
||||
tinyUsb=true
|
||||
esptoolFlashFreq=80M
|
||||
bluetooth=true
|
||||
|
||||
[display]
|
||||
size=3.5"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include <tactility/bindings/root.h>
|
||||
#include <tactility/bindings/esp32_ble.h>
|
||||
#include <tactility/bindings/esp32_gpio.h>
|
||||
#include <tactility/bindings/esp32_i2c.h>
|
||||
#include <tactility/bindings/esp32_spi.h>
|
||||
@@ -9,6 +10,10 @@
|
||||
compatible = "root";
|
||||
model = "Wireless-Tag WT32-SC01 Plus";
|
||||
|
||||
ble0 {
|
||||
compatible = "espressif,esp32-ble";
|
||||
};
|
||||
|
||||
gpio0 {
|
||||
compatible = "espressif,esp32-gpio";
|
||||
gpio-count = <49>;
|
||||
|
||||
Reference in New Issue
Block a user