Fixes and improvements

This commit is contained in:
Ken Van Hoeylandt 2026-07-21 21:05:15 +02:00
parent 66d6348703
commit b3c6be7291
7 changed files with 125 additions and 98 deletions

View File

@ -1,9 +1,11 @@
dependencies:
- Platforms/platform-esp32
- Drivers/bmi270-module
- Drivers/bm8563-module
- Drivers/axp2101-module
- Drivers/aw88298-module
- Drivers/aw9523b-module
- Drivers/axp2101-module
- Drivers/bm8563-module
- Drivers/bmi270-module
- Drivers/es7210-module
- Drivers/ft5x06-module
- Drivers/ili9341-module
dts: m5stack,cores3.dts

View File

@ -9,15 +9,16 @@
#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 <tactility/bindings/gpio_hog.h>
#include <bindings/aw88298.h>
#include <bindings/aw9523b.h>
#include <bindings/axp2101.h>
#include <bindings/axp2101_backlight.h>
#include <bindings/aw9523b.h>
#include <bindings/bmi270.h>
#include <bindings/bm8563.h>
#include <bindings/es7210.h>
#include <bindings/ft5x06.h>
#include <bindings/ili9341.h>
#include <tactility/bindings/esp32_sdspi.h>
#include <tactility/bindings/gpio_hog.h>
// SD card is not supported because of a hardware problem:
// The display uses pin 35 as input (MISO), but the SPI bus (and SD card) uses the same pin as DC (output).
@ -42,6 +43,18 @@
gpio-count = <49>;
};
i2s0 {
// Note: M5Unified sets the following for speaker: magnification = 2, oversampling = 1
// Note: M5Unified sets the following for microphone: magnification = 4
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>;
};
i2c_internal {
compatible = "espressif,esp32-i2c";
port = <I2C_NUM_0>;
@ -61,9 +74,36 @@
// P0_0 = touch reset, P0_1 = bus-out enable, P0_2 = AW88298 reset,
// P0_4 = SD card switch, P1_1 = LCD reset, P1_7 = boost enable (SY7088)
aw9523b: aw9523b {
aw9523b {
compatible = "awinic,aw9523b";
reg = <0x58>;
// Bus-out enable, AW88298 (audio amp) reset, SD card power switch and boost enable
// (SY7088) are AW9523B pins with no owning peripheral driver yet.
aw9523_bus_out_enable {
compatible = "gpio-hog";
pin = <&aw9523b 1 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
aw9523_sdcard_switch {
compatible = "gpio-hog";
pin = <&aw9523b 4 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
aw9523_boost_enable {
compatible = "gpio-hog";
pin = <&aw9523b 15 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
};
aw88298 {
compatible = "awinic,aw88298";
reg = <0x36>;
i2s = <&i2s0>;
pin-reset = <&aw9523b 2 GPIO_FLAG_NONE>;
};
axp2101: axp2101 {
@ -82,7 +122,7 @@
// LCD backlight (DLDO1). Raw register codes [20,28] map to [2500,3300]mV;
// below 2500mV the backlight was considered "too dark" to be useful.
backlight {
display_backlight {
compatible = "axp2101-backlight";
ldo = <AXP2101_DLDO1>;
min-millivolt = <2500>;
@ -97,32 +137,21 @@
y-max = <240>;
pin-reset = <&aw9523b 0 GPIO_FLAG_NONE>;
};
};
// Bus-out enable, AW88298 (audio amp) reset, SD card power switch and boost enable
// (SY7088) are AW9523B pins with no owning peripheral driver yet.
aw9523_bus_out_enable {
compatible = "gpio-hog";
pin = <&aw9523b 1 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
aw9523_aw88298_reset {
compatible = "gpio-hog";
pin = <&aw9523b 2 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
aw9523_sdcard_switch {
compatible = "gpio-hog";
pin = <&aw9523b 4 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
aw9523_boost_enable {
compatible = "gpio-hog";
pin = <&aw9523b 15 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
es7210 {
compatible = "everest,es7210";
reg = <0x40>;
i2s = <&i2s0>;
// Only MIC1/MIC2 are wired to real capsules (see schematic); MIC3/MIC4
// slots carry AEC_P/AEC_N reference signal, not microphone audio.
mic-mask = <3>;
// M5Unified applies a 4x post-gain "magnification" for this exact mic
// wiring (see M5Unified.cpp _mic_data_cb_cores3): the ES7210's own
// hardware ADC gain (already near-max via the default 90% input volume
// setting, ~34dB of its 0-37.5dB range) still isn't enough for these
// capsules on their own.
input-gain-percent = <400>;
};
};
port_a: grove0 {
@ -173,20 +202,8 @@
pixel-clock-hz = <40000000>;
pin-dc = <&gpio0 35 GPIO_FLAG_NONE>;
pin-reset = <&aw9523b 9 GPIO_FLAG_NONE>;
backlight = <&display_backlight>;
};
};
// TODO: Enable speaker via ES7210 I2C: https://github.com/m5stack/M5Unified/blob/a6256725481f1bc366655fa48cf03b6095e30ad1/src/M5Unified.cpp#L417
// TODO: Enable microphone via ES7210 I2C: https://github.com/m5stack/M5Unified/blob/a6256725481f1bc366655fa48cf03b6095e30ad1/src/M5Unified.cpp#L616
i2s0 {
// Note: M5Unified sets the following for speaker: magnification = 2, oversampling = 1
// Note: M5Unified sets the following for microphone: magnification = 4
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>;
};
};

View File

@ -1,14 +1,13 @@
dependencies:
- Platforms/platform-esp32
- Drivers/bmi270-module
- Drivers/bm8563-module
- Drivers/ina226-module
- Drivers/py32ioexpander-module
- Drivers/aw88298-module
- Drivers/aw9523b-module
- Drivers/axp2101-module
- Drivers/bm8563-module
- Drivers/bmi270-module
- Drivers/es7210-module
- Drivers/ft6x36-module
- Drivers/ili9341-module
- Drivers/aw88298-module
- Drivers/es7210-module
- Drivers/audio-stream-module
- Drivers/ina226-module
- Drivers/py32ioexpander-module
dts: m5stack,stackchan.dts

View File

@ -9,17 +9,17 @@
#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>
#include <bindings/aw88298.h>
#include <bindings/aw9523b.h>
#include <bindings/axp2101.h>
#include <bindings/axp2101_backlight.h>
#include <bindings/ft6x36.h>
#include <bindings/aw88298.h>
#include <bindings/bm8563.h>
#include <bindings/bmi270.h>
#include <bindings/es7210.h>
#include <bindings/ft6x36.h>
#include <bindings/ili9341.h>
#include <bindings/ina226.h>
#include <bindings/py32ioexpander.h>
#include <tactility/bindings/esp32_sdspi.h>
#include <tactility/bindings/gpio_hog.h>
@ -44,7 +44,7 @@
};
// AW88298 speaker + ES7210 microphone
i2s0: i2s0 {
i2s0 {
compatible = "espressif,esp32-i2s";
port = <I2S_NUM_0>;
pin-bclk = <&gpio0 34 GPIO_FLAG_NONE>;
@ -84,12 +84,38 @@
power-supply;
};
// AW9523B pin map (same wiring as CoreS3):
// P0_0 = touch reset, P0_1 = bus-out enable, P0_2 = AW88298 reset,
// P0_4 = SD card switch, P1_1 = LCD reset, P1_7 = boost enable (SY7088)
aw9523b: aw9523b {
aw9523b {
compatible = "awinic,aw9523b";
reg = <0x58>;
// Bus-out enable, AW88298 (audio amp) reset, SD card power switch and boost enable
// (SY7088) are AW9523B pins with no owning peripheral driver yet.
aw9523_bus_out_enable {
compatible = "gpio-hog";
pin = <&aw9523b 1 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
aw9523_sdcard_switch {
compatible = "gpio-hog";
pin = <&aw9523b 4 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
aw9523_boost_enable {
compatible = "gpio-hog";
pin = <&aw9523b 15 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
};
aw88298 {
compatible = "awinic,aw88298";
reg = <0x36>;
i2s = <&i2s0>;
pin-reset = <&aw9523b 2 GPIO_FLAG_NONE>;
};
// Same rail assignment as CoreS3: ALDO1=AW88298, ALDO2=ES7210, ALDO3=camera
@ -109,7 +135,7 @@
bldo1-enabled;
bldo2-enabled;
display_backlight: backlight {
display_backlight {
compatible = "axp2101-backlight";
ldo = <AXP2101_DLDO1>;
min-millivolt = <2500>;
@ -117,7 +143,7 @@
};
};
touch0 {
touch {
compatible = "focaltech,ft6x36";
reg = <0x38>;
x-max = <319>;
@ -125,13 +151,6 @@
pin-reset = <&aw9523b 0 GPIO_FLAG_NONE>;
};
aw88298 {
compatible = "awinic,aw88298";
reg = <0x36>;
i2s = <&i2s0>;
pin-reset = <&aw9523b 2 GPIO_FLAG_NONE>;
};
es7210 {
compatible = "everest,es7210";
reg = <0x40>;
@ -153,27 +172,6 @@
// TODO: BMM150 magnetometer @ 0x10 — accessible only via BMI270 aux I2C
};
// Bus-out enable and SD card power switch are AW9523B pins with no owning peripheral
// driver. Touch reset, AW88298 reset and LCD reset are handled directly by their own
// device's pin-reset property instead (see touch0/aw88298/display@0 above/below).
aw9523_bus_out_enable {
compatible = "gpio-hog";
pin = <&aw9523b 1 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
aw9523_sdcard_switch {
compatible = "gpio-hog";
pin = <&aw9523b 4 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
aw9523_boost_enable {
compatible = "gpio-hog";
pin = <&aw9523b 15 GPIO_FLAG_NONE>;
mode = <GPIO_HOG_MODE_OUTPUT_HIGH>;
};
// TODO: Servo UART (SCS9009, 1 Mbaud) — TX=GPIO6, RX=GPIO7
uart_port_a: uart1 {
compatible = "espressif,esp32-uart";

View File

@ -4,7 +4,11 @@
Tactility is an operating system for the ESP32 microcontroller family. It runs on 40+ supported devices (CYD boards, LilyGO, M5Stack, Elecrow, etc.) and includes a desktop simulator. Built with C++23, ESP-IDF, LVGL, and FreeRTOS.
## Build Commands
## Building
### Git
The repository uses git submodules. Make sure to use `--recurse-submodules` on relevant git commands.
### Simulator (Linux/macOS, no ESP-IDF needed)
@ -167,4 +171,4 @@ Pointers are expected to be non-null unless documented otherwise.
- The `Drivers/` directory contains hardware drivers (display controllers, touch controllers, PMICs, etc.) — each is its own CMake component.
- `Modules/` contains cross-cutting modules: `hal-device-module` (device lifecycle) and `lvgl-module` (LVGL task management).
- `Data/system/` and `Data/data/` are flashed as FAT filesystem images on ESP32.
- Translations are in `Translations/` as CSV files, generated via `generate.py`.
- Translations are in `Translations/` as CSV files, generated via `generate.py`.

View File

@ -58,12 +58,12 @@ static error_t pulse_reset(GpioDescriptor* descriptor, bool active_high) {
if (error != ERROR_NONE) {
return error;
}
vTaskDelay(pdMS_TO_TICKS(10));
vTaskDelay(pdMS_TO_TICKS(50));
error = gpio_descriptor_set_level(descriptor, !active_high);
if (error != ERROR_NONE) {
return error;
}
vTaskDelay(pdMS_TO_TICKS(10));
vTaskDelay(pdMS_TO_TICKS(300));
return ERROR_NONE;
}

View File

@ -40,6 +40,13 @@ execute_process(
# Devicetree dependency collection
#
# REQUIRES_LIST below is computed once, at configure time. Without this, editing
# devicetree.yaml (e.g. adding a driver dependency) doesn't trigger a cmake reconfigure,
# so the new component's include dirs never reach the compiler until a fullclean.
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS
"${DEVICETREE_LOCATION}/devicetree.yaml"
)
execute_process(
COMMAND python "${PROJECT_ROOT}/Buildscripts/DevicetreeCompiler/dependencies.py" "${DEVICETREE_LOCATION}"
WORKING_DIRECTORY "${PROJECT_ROOT}"