Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Buildscripts/properties.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
function(GET_PROPERTY_VALUE PROPERTIES_CONTENT_VAR KEY_NAME RESULT_VAR)
# Optional 4th arg: default value returned when key is missing, instead of erroring.
set(has_default FALSE)
if (${ARGC} GREATER 3)
set(has_default TRUE)
set(default_value "${ARGV3}")
endif ()

# Search for the key and its value in the properties content
# Supports KEY=VALUE, KEY="VALUE", and optional spaces around =
# Use parentheses to capture the value
# We use ^ and $ with multiline if available, but string(REGEX) doesn't support them easily for lines.
# So we look for the key at the beginning of the string or after a newline.
if ("${${PROPERTIES_CONTENT_VAR}}" MATCHES "(^|\n)${KEY_NAME}[ \t]*=[ \t]*\"?([^\n\"]*)\"?")
set(${RESULT_VAR} "${CMAKE_MATCH_2}" PARENT_SCOPE)
elseif (has_default)
set(${RESULT_VAR} "${default_value}" PARENT_SCOPE)
else ()
message(FATAL_ERROR "Property '${KEY_NAME}' not found in the properties content.")
endif ()
Expand Down
2 changes: 2 additions & 0 deletions Devices/guition-jc3248w535c/device.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ display.shape=rectangle
display.dpi=165

lvgl.colorDepth=16

sdkconfig.CONFIG_CODEC_DUMMY_SUPPORT=y
2 changes: 2 additions & 0 deletions Devices/guition-jc3248w535c/devicetree.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dependencies:
- Platforms/platform-esp32
- Drivers/dummy-i2s-amp-module
- Drivers/audio-stream-module
dts: guition,jc3248w535c.dts
6 changes: 6 additions & 0 deletions Devices/guition-jc3248w535c/guition,jc3248w535c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <tactility/bindings/esp32_uart.h>
#include <tactility/bindings/esp32_sdspi.h>
#include <tactility/bindings/display_placeholder.h>
#include <bindings/dummy_i2s_amp.h>

/ {
compatible = "root";
Expand Down Expand Up @@ -54,6 +55,11 @@
pin-data-out = <&gpio0 41 GPIO_FLAG_NONE>;
};

speaker0 {
compatible = "nsiway,ns4168";
i2s = <&i2s0>;
};

spi0 {
compatible = "espressif,esp32-spi";
host = <SPI2_HOST>;
Expand Down
2 changes: 2 additions & 0 deletions Devices/guition-jc8048w550c/device.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ display.dpi=187

lvgl.colorDepth=16
lvgl.fontSize=18

sdkconfig.CONFIG_CODEC_DUMMY_SUPPORT=y
2 changes: 2 additions & 0 deletions Devices/guition-jc8048w550c/devicetree.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dependencies:
- Platforms/platform-esp32
- Drivers/dummy-i2s-amp-module
- Drivers/audio-stream-module
dts: guition,jc8048w550c.dts
6 changes: 6 additions & 0 deletions Devices/guition-jc8048w550c/guition,jc8048w550c.dts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <tactility/bindings/esp32_spi.h>
#include <tactility/bindings/esp32_uart.h>
#include <tactility/bindings/esp32_sdspi.h>
#include <bindings/dummy_i2s_amp.h>

/ {
compatible = "root";
Expand Down Expand Up @@ -54,6 +55,11 @@
pin-data-out = <&gpio0 17 GPIO_FLAG_NONE>;
};

speaker0 {
compatible = "nsiway,ns4168";
i2s = <&i2s0>;
};

spi0 {
compatible = "espressif,esp32-spi";
host = <SPI2_HOST>;
Expand Down
2 changes: 2 additions & 0 deletions Devices/lilygo-tdeck-plus/device.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ display.dpi=143
cdn.infoMessage=To put the device into bootloader mode: <br/>1. Press the trackball and then the reset button at the same time,<br/>2. Let go of the reset button, then the trackball.<br/><br/>When this website reports that flashing is finished, you likely have to press the reset button.

lvgl.colorDepth=16

sdkconfig.CONFIG_CODEC_DUMMY_SUPPORT=y
3 changes: 3 additions & 0 deletions Devices/lilygo-tdeck-plus/devicetree.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ dependencies:
- Drivers/st7789-module
- Drivers/gt911-module
- Drivers/lilygo-module
- Drivers/es7210-module
- Drivers/dummy-i2s-amp-module
- Drivers/audio-stream-module
dts: lilygo,tdeck-plus.dts
48 changes: 41 additions & 7 deletions Devices/lilygo-tdeck-plus/lilygo,tdeck-plus.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include <bindings/gt911.h>
#include <bindings/st7789.h>
#include <bindings/es7210.h>
#include <bindings/dummy_i2s_amp.h>

#include <lilygo/bindings/tdeck_keyboard.h>
#include <lilygo/bindings/tdeck_keyboard_backlight.h>
Expand Down Expand Up @@ -64,6 +66,34 @@
pin-click = <&gpio0 0 GPIO_FLAG_NONE>;
};

// i2s0 and i2s1 are declared before i2c0 so i2s1 has started before the es7210 codec (below) references it.
// Speaker I2S (MAX98357A amplifier)
i2s0 {
compatible = "espressif,esp32-i2s";
port = <I2S_NUM_0>;
pin-bclk = <&gpio0 7 GPIO_FLAG_NONE>;
pin-ws = <&gpio0 5 GPIO_FLAG_NONE>;
pin-data-out = <&gpio0 6 GPIO_FLAG_NONE>;
};

// Microphone I2S (ES7210), separate port from the speaker
i2s1 {
compatible = "espressif,esp32-i2s";
port = <I2S_NUM_1>;
pin-bclk = <&gpio0 47 GPIO_FLAG_NONE>;
pin-ws = <&gpio0 21 GPIO_FLAG_NONE>;
pin-data-in = <&gpio0 14 GPIO_FLAG_NONE>;
pin-mclk = <&gpio0 48 GPIO_FLAG_NONE>;
};

// MAX98357A class-D speaker amplifier. No I2C. Per schematic, SD_MODE/GAIN_SLOT is
// tied via fixed resistors (R21/R22), not driven by an MCU GPIO -- the amp is always
// enabled when powered, so no enable-gpio is wired here.
speaker0 {
compatible = "maxim,max98357a";
i2s = <&i2s0>;
};

i2c_internal: i2c0 {
compatible = "espressif,esp32-i2c";
port = <I2C_NUM_0>;
Expand All @@ -90,14 +120,18 @@
compatible = "lilygo,tdeck-keyboard-backlight";
reg = <0x55>;
};
};

i2s0 {
compatible = "espressif,esp32-i2s";
port = <I2S_NUM_0>;
pin-bclk = <&gpio0 7 GPIO_FLAG_NONE>;
pin-ws = <&gpio0 5 GPIO_FLAG_NONE>;
pin-data-out = <&gpio0 6 GPIO_FLAG_NONE>;
// ES7210 microphone ADC. Per schematic all 4 MSM381A3729H9CP mic capsules are
// populated (MIC1-4), and AD0/AD1 are unconnected (default low -> address 0x40).
// Stock LilyGO firmware drives MIC1/MIC2 at 0dB and MIC3/MIC4 at 37.5dB gain --
// the es7210 driver here applies a single gain to all active mics, so per-pair
// gain differentiation is not yet replicated.
es7210 {
compatible = "everest,es7210";
reg = <0x40>;
i2s = <&i2s1>;
mic-mask = <15>;
};
};

display_backlight {
Expand Down
2 changes: 2 additions & 0 deletions Devices/m5stack-cardputer/device.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ display.dpi=139

lvgl.colorDepth=16
lvgl.uiDensity=compact

sdkconfig.CONFIG_CODEC_DUMMY_SUPPORT=y
3 changes: 3 additions & 0 deletions Devices/m5stack-cardputer/devicetree.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ dependencies:
- Platforms/platform-esp32
- Drivers/st7789-module
- Drivers/m5stack-module
- Drivers/dummy-i2s-amp-module
- Drivers/pdm-mic-module
- Drivers/audio-stream-module
dts: m5stack,cardputer.dts
26 changes: 24 additions & 2 deletions Devices/m5stack-cardputer/m5stack,cardputer.dts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include <bindings/st7789.h>
#include <bindings/cardputer_keyboard.h>
#include <bindings/dummy_i2s_amp.h>
#include <bindings/pdm_mic.h>

// Reference: https://docs.m5stack.com/en/core/Cardputer
/ {
Expand Down Expand Up @@ -123,8 +125,17 @@
<&gpio0 7 GPIO_FLAG_NONE>;
};

// Speaker and microphone
// TODO: Microphone I2C init code from https://github.com/m5stack/M5Unified/blob/a6256725481f1bc366655fa48cf03b6095e30ad1/src/M5Unified.cpp#L936
// Speaker (std TX) and PDM mic (RX) share this single I2S controller. PDM RX is
// hardware-restricted to I2S controller 0 on ESP32 targets, and per schematic the
// mic's PDM CLK and the speaker's LRCLK both land on GPIO43 anyway -- splitting them
// across two controllers (as M5Stack's own reference firmware does) isn't possible
// here since Tactility's GPIO ownership model is exclusive-acquire-only (no pin
// sharing), and two I2S controllers both declaring GPIO43 would have one fail to
// start. Keeping both on one controller means only one acquire of GPIO43 happens;
// audio_codec_data_if_i2s.c's data_set_fmt() already tears down and recreates the
// channel on each codec open(), so opening one direction after the other naturally
// reconfigures the shared port/pin -- speaker and mic still cannot be used
// simultaneously, which matches the hardware reality.
i2s0 {
compatible = "espressif,esp32-i2s";
port = <I2S_NUM_0>;
Expand All @@ -133,4 +144,15 @@
pin-data-out = <&gpio0 42 GPIO_FLAG_NONE>;
pin-data-in = <&gpio0 46 GPIO_FLAG_NONE>;
};

speaker0 {
compatible = "nsiway,ns4168";
i2s = <&i2s0>;
};

mic0 {
compatible = "generic,spm1423";
i2s = <&i2s0>;
channels = <1>;
};
};
2 changes: 1 addition & 1 deletion Devices/m5stack-stackchan/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 FT6x36 AXP2101 AW9523 driver vfs fatfs ina226-module py32ioexpander-module
REQUIRES Tactility esp_lvgl_port ILI934x FT6x36 AXP2101 driver vfs fatfs ina226-module py32ioexpander-module
)
Loading
Loading