Merge branch 'feat/add_board_manager' into 'master'

feat(demo): update lua module and board

See merge request ae_group/esp-clawgent!9
This commit is contained in:
Zhou Li
2026-04-12 17:32:49 +08:00
112 changed files with 16786 additions and 196 deletions
+1 -28
View File
@@ -22,34 +22,7 @@ not_formatted_permanent:
# - Upstream source code we don't want to modify
# - Generated files
check: false
include:
- "components/audio/dac_audio/test/wave_1ch_16bits.c"
- "components/audio/dac_audio/test/wave_1ch_8bits.c"
- "components/audio/dac_audio/test/wave_2ch_16bits.c"
- "components/audio/dac_audio/test/wave_2ch_8bits.c"
- "components/audio/pwm_audio/test/wave_1ch_16bits.c"
- "components/audio/pwm_audio/test/wave_1ch_8bits.c"
- "components/audio/pwm_audio/test/wave_2ch_16bits.c"
- "components/audio/pwm_audio/test/wave_2ch_8bits.c"
- "components/bluetooth/ble_profiles/esp/ble_ota/proto-c/"
- "components/bluetooth/ble_profiles/esp/ble_ota/python/"
- "components/display/touch_panel/calibration/basic_painter/fonts/"
- "components/usb/usb_stream/test_apps/main/wave_1ch_16bits.c"
- "components/utilities/xz/"
- "docs/_static/esp32s2_adc_range_to_3300.patch"
- "docs/_static/esp32s2_adc_range_to_3300_v531.patch"
- "docs/_static/esp32s3_adc_range_to_3300.patch"
- "docs/_static/esp32s3_adc_range_to_3300_v531.patch"
- "docs/doxygen-known-warnings.txt"
- "docs/sphinx-known-warnings.txt"
- "examples/usb/device/usb_webcam/eyes_show/"
- "examples/ai/esp_dl/self_learning_classification/main/ui"
- "examples/usb/host/usb_camera_lcd_display/components/esp_painter/font/"
- "examples/usb/host/usb_camera_mic_spk/main/wave_1ch_16bits.c"
- "examples/robot/ragtime_panther/follower/main/ui/"
- "components/sensors/gas/bme690/bme69x.c"
- "components/sensors/gas/bme690/bme69x.h"
- "components/sensors/gas/bme690/bme69x_defs.h"
docs:
# Docs directory contains some .inc files, which are not C include files
+17 -16
View File
@@ -38,15 +38,16 @@
# By configuring this macro, you can append the compiled configuration file.
# For example, using "sdkconf.etc=default" specifies the default sdkconfig file.
EXAMPLE_CONFIG: "="
EXAMPLE_TARGET: ""
EXAMPLE_APPEND_ARGS: ""
EXAMPLE_BOARD: "default"
BUILD_RECURSIVE: "1"
script:
- pip install idf_build_apps
- pip install idf_build_apps esp-bmgr-assist
- |
python .gitlab/ci/build_apps.py ${EXAMPLE_DIR} \
--config ${EXAMPLE_CONFIG} \
-t all \
-t ${EXAMPLE_TARGET} \
-r ${BUILD_RECURSIVE} \
-vv \
--board ${EXAMPLE_BOARD} \
@@ -62,25 +63,25 @@
.build_idf_active_release_version:
parallel:
matrix: # EOL date
- IMAGE: espressif/idf:release-v5.5 # 2028-01-21
# ESP-IDF 6.0 is currently in pre-release stage.
.build_idf_active_release_version_with_pre_release:
parallel:
matrix:
- IMAGE: espressif/idf:release-v5.2
- IMAGE: espressif/idf:release-v5.3
- IMAGE: espressif/idf:release-v5.4
- IMAGE: espressif/idf:release-v5.5
- IMAGE: espressif/idf:release-v6.0
build_application_basic_demo:
extends:
- .build_examples_template
- .rules:build:application_basic_demo
- .build_idf_active_release_version
parallel:
matrix:
- IMAGE: espressif/idf:release-v5.5
EXAMPLE_BOARD: esp_SensairHalo
EXAMPLE_TARGET: esp32c5
- IMAGE: espressif/idf:release-v5.5
EXAMPLE_BOARD: esp_SensairShuttle
EXAMPLE_TARGET: esp32c5
- IMAGE: espressif/idf:release-v5.5
EXAMPLE_BOARD: esp_vocat_board_v1_2
EXAMPLE_TARGET: esp32s3
- IMAGE: espressif/idf:release-v5.5
EXAMPLE_BOARD: esp32_S3_DevKitC_1
EXAMPLE_TARGET: esp32s3
variables:
EXAMPLE_DIR: application/basic_demo
-53
View File
@@ -134,50 +134,6 @@ class CustomApp(CMakeApp):
shutil.rmtree(proj_path / 'components' / 'gen_bmgr_codes', ignore_errors=True)
(proj_path / 'board_manager.defaults').unlink(missing_ok=True)
def _download_bmgr_component(self) -> bool:
"""
Extract the esp_board_manager dependency from the manifest file and download it.
Returns True if successful, False otherwise.
"""
if not all([yaml, download_project_dependencies, ManifestManager, ProjectRequirements]):
logger.warning('idf-component-manager is not available, cannot download board manager component')
return False
proj = Path(self.work_dir).absolute()
managed_path = proj / 'managed_components'
lock_path = proj / 'dependencies.lock'
bmgr_dep = self._find_bmgr_dependency()
if not bmgr_dep:
logger.warning(
'esp_board_manager dependency not found in project manifests under %s/main or %s/components/*',
proj,
proj,
)
return False
manifest_path, bmgr_key, bmgr_value = bmgr_dep
managed_path.mkdir(parents=True, exist_ok=True)
try:
with tempfile.TemporaryDirectory() as temp_dir:
temp_manifest = Path(temp_dir) / 'idf_component.yml'
with open(temp_manifest, 'w', encoding='utf-8') as f:
yaml.dump({'dependencies': {bmgr_key: bmgr_value}}, f)
manifest = ManifestManager(str(temp_dir), 'temp').load()
download_project_dependencies(
ProjectRequirements([manifest]),
str(lock_path),
str(managed_path),
)
logger.info('Successfully downloaded esp_board_manager component from %s to %s', manifest_path, managed_path)
return True
except Exception as e:
logger.error('Error downloading esp_board_manager component: %s', e)
return False
def _pre_hook(self, board_name: str) -> None:
logger.info(
"Pre build hook for app '%s' at '%s' for target '%s', board '%s'",
@@ -194,17 +150,8 @@ class CustomApp(CMakeApp):
logger.warning('IDF_PATH is not set; skip board manager config generation.')
return
# Download board manager component if needed
bmgr_path = Path(self.work_dir).absolute() / 'managed_components' / 'espressif__esp_board_manager'
if not bmgr_path.exists():
logger.info('Board manager component not found, downloading...')
if not self._download_bmgr_component():
logger.error('Failed to download board manager component, cannot generate config')
return
# Set environment variable for IDF_EXTRA_ACTIONS_PATH
env = os.environ.copy()
env['IDF_EXTRA_ACTIONS_PATH'] = str(bmgr_path)
subprocess.run(
[
-9
View File
@@ -1,14 +1,5 @@
cmake_minimum_required(VERSION 3.16)
set(EXTRA_COMPONENT_DIRS
"../../components/claw_modules"
"../../components/lua_modules"
"../../components/claw_capabilities"
)
if(NOT DEFINED IDF_TARGET)
set(IDF_TARGET "esp32s3" CACHE STRING "ESP-IDF target")
endif()
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(basic_demo)
@@ -0,0 +1,53 @@
version: 1.0.0
# Devices Configuration
devices:
- name: led_strip
chip: ws2812
type: custom
version: default
init_skip: true
dependencies:
espressif/led_strip:
version: "^3.0"
public: true
config:
max_leds: 1 # Number of LEDs in the strip
peripherals:
- name: rmt_tx # RMT TX peripheral used by the LED strip
# Example GPIO Button device configuration
- name: gpio_button_0 # The name of the device, must be unique
type: button # The type of the device
sub_type: gpio # Button sub type: "gpio", "adc_single", or "adc_multi"
config:
# GPIO Configuration
active_level: 0 # [TO_BE_CONFIRMED] Active level (0-low, 1-high) when button is pressed
enable_power_save: false # Enable power save mode (default: false)
disable_pull: false # Disable internal pull-up/pull-down (default: false)
# Button Timing Configuration
long_press_time: 2000 # Long press time in milliseconds (default: 2000)
short_press_time: 100 # Short press time in milliseconds (default: 100)
# Event Configuration (NEW - Easy button features)
events_cfg:
press_down: true # Enable press down event (default: true)
press_up: true # Enable press up event (default: true)
single_click: true # Enable single click event (default: true)
double_click: true # Enable double click event (default: true)
multi_click: false # Enable multi click event (default: false)
click_counts: [] # Multi click counts configuration (default: [])
# eg: Set to [3, 4] means enable multi_click event with 3 and 4 counts
long_press_start: true # Enable long press start event (default: true)
long_press_start_time: [] # Long press start time configuration in ms (default: [])
# eg: Set to [3000, 4000] means enable long_press_start event with 3 and 4 seconds
long_press_hold: false # Enable long press hold event (default: false)
long_press_up: true # Enable long press up event (default: true)
long_press_up_time: [] # Long press up time configuration in ms (default: [])
press_repeat: false # Enable press repeat event (default: false)
press_repeat_done: false # Enable press repeat done event (default: false)
press_end: false # Enable press end event (default: false)
peripherals:
- name: gpio_button # [TO_BE_CONFIRMED] GPIO peripheral name
@@ -0,0 +1,5 @@
board: esp32_S3_DevKitC_1
chip: esp32s3
version: 1.3.0
description: "ESP32-S3-DevKitC-1 Development Board"
manufacturer: "ESPRESSIF"
@@ -0,0 +1,27 @@
version: 1.0.0
# Peripherals Configuration
peripherals:
- name: gpio_button
type: gpio
config:
pin: 0
mode: GPIO_MODE_INPUT
default_level: 1
- name: rmt_tx
type: rmt
role: tx
config:
gpio_num: 38
clk_src: RMT_CLK_SRC_DEFAULT
resolution_hz: 10000000
mem_block_symbols: 64
trans_queue_depth: 4
intr_priority: 1
flags:
invert_out: false
with_dma: true # RMT peripheral can connect to DMA channel in esp32s3
io_loop_back: false
io_od_mode: false
allow_pd: false
init_level: false
@@ -0,0 +1,9 @@
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_120M=y
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_8MB.csv"
CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_SPEED_120M=y
@@ -0,0 +1,14 @@
/*
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "esp_log.h"
#include "esp_check.h"
#include "esp_board_manager_includes.h"
#include "gen_board_device_custom.h"
#include "periph_rmt.h"
#include "led_strip.h"
#include "led_strip_rmt.h"
#include "led_strip_types.h"
@@ -0,0 +1,143 @@
version: 1.0.0
# Devices Configuration
devices:
- name: display_lcd
type: display_lcd
version: default
sub_type: parlio
chip: ili9341
dependencies:
espressif/esp_lcd_ili9341: "*"
config:
mirror_x: false
mirror_y: true
swap_xy: true
x_max: 284 # [TO_BE_CONFIRMED] Horizontal resolution
y_max: 240 # [TO_BE_CONFIRMED] Vertical resolution
need_reset: true # Whether to reset the LCD panel during initialization (default: true)
# dev_display_lcd_parlio_sub_config_t fields for Parlio communication
io_parl_config:
dc_gpio_num: 7 # [IO] GPIO used for D/C line
clk_gpio_num: 1 # [IO] GPIO used for CLK line
cs_gpio_num: 6 # [IO] GPIO used for CS line
# GPIOs used for data lines (ESP_PARLIO_LCD_WIDTH_MAX == 8); 1-line SPI uses index 0 only, rest -1
data_gpio_nums: [0, -1, -1, -1, -1, -1, -1, -1] # [IO] GPIOs used for data lines
data_width: 1 # Number of data lines, 1 (SPI) or 8 (I80)
pclk_hz: 40000000 # [TO_BE_CONFIRMED] Frequency of pixel clock
clk_src: PARLIO_CLK_SRC_DEFAULT # Clock source for the Parlio peripheral (parlio_clock_source_t)
max_transfer_bytes: 136320 # Maximum transfer size; determines internal DMA link length
dma_burst_size: 32 # DMA burst size, in bytes
trans_queue_depth: 10 # Transaction queue size; larger queue, higher throughput
lcd_cmd_bits: 8 # [TO_BE_CONFIRMED] Bit-width of LCD command
lcd_param_bits: 8 # [TO_BE_CONFIRMED] Bit-width of LCD parameter
dc_levels:
dc_cmd_level: 0 # [TO_BE_CONFIRMED] Level of DC line in CMD phase
dc_data_level: 1 # [TO_BE_CONFIRMED] Level of DC line in DATA phase
flags:
# If set, high CS selects device; otherwise CS is low-active
cs_active_high: false
lcd_panel_config:
reset_gpio_num: -1
rgb_ele_order: LCD_RGB_ELEMENT_ORDER_RGB # [TO_BE_CONFIRMED] RGB element order (default: RGB)
# Valid values:
# - LCD_RGB_ELEMENT_ORDER_RGB
# - LCD_RGB_ELEMENT_ORDER_BGR
data_endian: LCD_RGB_DATA_ENDIAN_LITTLE # [TO_BE_CONFIRMED] Data endianness (default: LITTLE)
# Valid values:
# - LCD_RGB_DATA_ENDIAN_BIG
# - LCD_RGB_DATA_ENDIAN_LITTLE
bits_per_pixel: 16 # [TO_BE_CONFIRMED] Bits per pixel (default: 16)
flags:
reset_active_high: true # Reset pin active level (default: false)
vendor_config: ""
# Touch Panel Configuration
- name: lcd_touch
chip: cst816s
type: lcd_touch_i2c
version: default
dependencies:
espressif/esp_lcd_touch_cst816s: "*"
config:
# esp_lcd_panel_io_i2c_config_t fields for touch communication
io_i2c_config:
dev_addr: 0x15 # CST816S I2C address (different from default 0x5A)
peripherals:
- name: i2c_master # I2C peripheral for touch communication
# esp_lcd_touch_config_t fields for touch configuration
touch_config:
x_max: 284 # Maximum X coordinate (BSP_LCD_H_RES)
y_max: 240 # Maximum Y coordinate (BSP_LCD_V_RES)
int_gpio_num: -1 # Interrupt GPIO (BSP_LCD_TOUCH_INT)
flags:
swap_xy: true # Swap X and Y coordinates (default: false)
mirror_x: false # Mirror X coordinates (default: false)
mirror_y: true # Mirror Y coordinates (default: false)
- name: touch_button
chip: bs8112
type: custom
version: default
dependencies:
touch_ic_bs8112a3:
version: "^0.1"
peripherals:
- name: i2c_master # I2C peripheral for touch communication
config:
irq_pin: 4
- name: camera
type: camera
sub_type: spi
config:
spi_config:
intf: ESP_CAM_CTLR_SPI_CAM_INTF_SPI
# SPI CAM data I/O mode (SPI interface only supports 1-bit): ESP_CAM_CTLR_SPI_CAM_IO_MODE_1BIT / _2BIT
io_mode: ESP_CAM_CTLR_SPI_CAM_IO_MODE_1BIT
spi_port: 1 # [TO_BE_CONFIRMED] SPI port
spi_cs_pin: 27 # [IO] SPI CS pin
spi_sclk_pin: 25 # [IO] SPI SCLK pin
spi_data0_io_pin: 23 # [IO] SPI data0 I/O pin
spi_data1_io_pin: -1 # [IO] SPI data1 I/O pin
reset_pin: -1 # [IO] SPI interface camera sensor reset pin
pwdn_pin: -1 # [IO] SPI interface camera sensor power down pin
xclk_source: ESP_CAM_SENSOR_XCLK_LEDC
xclk_freq: 24000000 # [TO_BE_CONFIRMED] XCLK frequency in Hz (default: 20MHz)
xclk_pin: 24 # [IO] XCLK pin
xclk_ledc_cfg:
timer: 0 # [TO_BE_CONFIRMED] The timer source of channel
clk_cfg: LEDC_AUTO_CLK # [TO_BE_CONFIRMED] LEDC source clock from ledc_clk_cfg_t
channel: 0 # [TO_BE_CONFIRMED] LEDC channel used for XCLK
peripherals:
- name: i2c_master # Must match a periph_i2c name; provides SCCB i2c_handle to esp_video
frequency: 100000 # SCCB I2C frequency (Hz)
- name: audio_adc
chip: internal
type: audio_codec
config:
adc_enabled: true
dac_enabled: false
adc_local_cfg:
channel_list: [4] # required
sample_rate_hz: 16000
max_store_buf_size: 1024
conv_frame_size: 256
unit_id: ADC_UNIT_1
atten: ADC_ATTEN_DB_0
- name: audio_dac
chip: internal
type: audio_codec
version: default
config:
dac_enabled: true
peripherals:
- name: i2s_audio_out
tx_aux_out_io: 10
tx_aux_out_invert: true
- name: gpio_pa_control
gain: 6
active_level: 1
@@ -0,0 +1,5 @@
board: esp_SensairHalo
chip: esp32c5
version: 1.3.0
description: "ESP-SensairHalo Development Board"
manufacturer: "ESPRESSIF"
@@ -0,0 +1,51 @@
version: 1.0.0
# Peripherals Configuration
peripherals:
- name: i2c_master
type: i2c
role: master
config:
port: 0
pins:
sda: 2
scl: 3
- name: i2s_audio_out
type: i2s
role: master
format: pdm-out
config:
sample_rate_hz: 16000
clk_src: I2S_CLK_SRC_DEFAULT
mclk_multiple: 256
up_sample_fp: 960
up_sample_fs: 441
bclk_div: 8
data_bit_width: 16
slot_bit_width: I2S_SLOT_BIT_WIDTH_AUTO
slot_mode: I2S_SLOT_MODE_MONO
slot_mask: I2S_PDM_SLOT_LEFT
data_fmt: "I2S_PDM_DATA_FMT_PCM"
sd_prescale: 0
sd_scale: I2S_PDM_SIG_SCALING_MUL_4
hp_scale: I2S_PDM_SIG_SCALING_MUL_4
lp_scale: I2S_PDM_SIG_SCALING_MUL_4
sinc_scale: I2S_PDM_SIG_SCALING_MUL_4
line_mode: I2S_PDM_TX_ONE_LINE_CODEC
hp_en: false
hp_cut_off_freq_hz: 35.5
sd_dither: 0
sd_dither2: 1
pins:
doubt: 9 # [IO] Data output pin
invert_flags:
clk_inv: false
# PA CONTROL
- name: gpio_pa_control
type: gpio
role: io
config:
pin: 8 # GPIO pin number
mode: GPIO_MODE_OUTPUT
default_level: 1
@@ -0,0 +1,20 @@
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_16MB.csv"
CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_SPEED_80M=y
CONFIG_CODEC_DUMMY_SUPPORT=y
CONFIG_CODEC_DATA_ADC_SUPPORT=y
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y
CONFIG_ESP_CONSOLE_UART_NUM=-1
CONFIG_CAMERA_BF3901=y
CONFIG_CAMERA_BF3901_SPI_RGB565_240X320_15FPS=y
CONFIG_CAMERA_BF3901_SPI_YUV422_240X320_15FPS=n
@@ -0,0 +1,131 @@
/*
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "esp_board_device.h"
#include "esp_codec_dev.h"
#include "periph_i2c.h"
#include "periph_gpio.h"
#include "gen_board_device_custom.h"
#include "dev_audio_codec.h"
#include "touch_ic_bs8112a3.h"
#include "dev_custom.h"
#include "esp_lcd_panel_ops.h"
#include "esp_lcd_ili9341.h"
#include "esp_lcd_touch_cst816s.h"
#include "esp_log.h"
#include "esp_check.h"
static const char *TAG = "SETUP_DEVICE";
static const ili9341_lcd_init_cmd_t s_vendor_init_cmds[] = {
{0x11, NULL, 0, 120},
{0x3A, (uint8_t []){0x05}, 1, 0},
{0xB2, (uint8_t []){0x0C, 0x0C, 0x00, 0x33, 0x33}, 5, 0},
{0xB7, (uint8_t []){0x05}, 1, 0},
{0xBB, (uint8_t []){0x21}, 1, 0},
{0xC0, (uint8_t []){0x2C}, 1, 0},
{0xC2, (uint8_t []){0x01}, 1, 0},
{0xC3, (uint8_t []){0x15}, 1, 0},
{0xC6, (uint8_t []){0x0F}, 1, 0},
{0xD0, (uint8_t []){0xA7}, 1, 0},
{0xD0, (uint8_t []){0xA4, 0xA1}, 2, 0},
{0xD6, (uint8_t []){0xA1}, 1, 0},
{0xE0, (uint8_t []){0xF0, 0x05, 0x0E, 0x08, 0x0A, 0x17, 0x39, 0x54,
0x4E, 0x37, 0x12, 0x12, 0x31, 0x37}, 14, 0},
{0xE1, (uint8_t []){0xF0, 0x10, 0x14, 0x0D, 0x0B, 0x05, 0x39, 0x44,
0x4D, 0x38, 0x14, 0x14, 0x2E, 0x35}, 14, 0},
{0xE4, (uint8_t []){0x23, 0x00, 0x00}, 3, 0},
{0x21, NULL, 0, 0},
{0x29, NULL, 0, 0},
{0x2C, NULL, 0, 0},
};
static const ili9341_vendor_config_t vendor_config = {
.init_cmds = s_vendor_init_cmds,
.init_cmds_size = sizeof(s_vendor_init_cmds) / sizeof(s_vendor_init_cmds[0]),
};
esp_err_t lcd_panel_factory_entry_t(esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel)
{
esp_lcd_panel_dev_config_t panel_dev_cfg = {0};
memcpy(&panel_dev_cfg, panel_dev_config, sizeof(esp_lcd_panel_dev_config_t));
panel_dev_cfg.vendor_config = (void *)&vendor_config;
int ret = esp_lcd_new_panel_ili9341(io, &panel_dev_cfg, ret_panel);
if (ret != ESP_OK) {
ESP_LOGE("lcd_panel_factory_entry_t", "New ili9341 panel failed");
return ret;
}
esp_lcd_panel_set_gap(*ret_panel, 36, 0);
return ESP_OK;
}
esp_err_t lcd_touch_factory_entry_t(esp_lcd_panel_io_handle_t io, const esp_lcd_touch_config_t *touch_dev_config, esp_lcd_touch_handle_t *ret_touch)
{
esp_lcd_touch_config_t touch_cfg = {0};
memcpy(&touch_cfg, touch_dev_config, sizeof(esp_lcd_touch_config_t));
if (touch_cfg.int_gpio_num != GPIO_NUM_NC) {
ESP_LOGW("lcd_touch_factory_entry_t", "Touch interrupt supported!");
touch_cfg.interrupt_callback = NULL;
}
esp_err_t ret = esp_lcd_touch_new_i2c_cst816s(io, &touch_cfg, ret_touch);
if (ret != ESP_OK) {
ESP_LOGE("lcd_touch_factory_entry_t", "Failed to create gt911 touch driver: %s", esp_err_to_name(ret));
return ret;
}
return ESP_OK;
}
static int touch_button_init(void *config, int cfg_size, void **device_handle)
{
esp_err_t ret = ESP_OK;
dev_custom_touch_button_config_t *touch_button_cfg = (dev_custom_touch_button_config_t *)config;
ESP_LOGI(TAG, "Initializing %s device", touch_button_cfg->name);
ESP_RETURN_ON_FALSE(strcmp(touch_button_cfg->chip, "bs8112") == 0, ESP_ERR_INVALID_ARG,
TAG, "Unsupported chip: %s", touch_button_cfg->chip);
// Try to get existing I2C bus handle first
i2c_master_bus_handle_t i2c_bus_handle = NULL;
esp_board_periph_ref_handle(touch_button_cfg->peripheral_name, (void**)&i2c_bus_handle);
ESP_RETURN_ON_FALSE(i2c_bus_handle != NULL, ESP_ERR_INVALID_STATE, TAG, "Failed to get I2C bus handle");
// Use default chip configuration
bs8112a3_chip_config_t default_chip_cfg = TOUCH_IC_BS8112A3_DEFAULT_CHIP_CONFIG();
default_chip_cfg.lsc_mode = BS8112A3_LSC_MODE_NORMAL;
default_chip_cfg.irq_oms = BS8112A3_IRQ_OMS_LEVEL_HOLD;
default_chip_cfg.k12_mode = BS8112A3_K12_MODE_IRQ;
touch_ic_bs8112a3_config_t bs8112_cfg = {
.i2c_bus_handle = i2c_bus_handle,
.device_address = BS8112A3_I2C_ADDR,
.scl_speed_hz = 400000,
.irq_pin = touch_button_cfg->irq_pin,
.chip_config = &default_chip_cfg,
};
touch_ic_bs8112a3_handle_t touch_handle = NULL;
ret = touch_ic_bs8112a3_create(&bs8112_cfg, &touch_handle);
ESP_RETURN_ON_ERROR(ret, TAG, "Failed to create BS8112A3 touch IC instance");
// Store handle in device_handle
*device_handle = (void *)touch_handle;
return ESP_OK;
}
static int touch_button_deinit(void *device_handle)
{
if (!device_handle) {
return ESP_OK;
}
touch_ic_bs8112a3_handle_t touch_handle = (touch_ic_bs8112a3_handle_t)device_handle;
esp_err_t ret = touch_ic_bs8112a3_delete(touch_handle);
return ret;
}
CUSTOM_DEVICE_IMPLEMENT(touch_button, touch_button_init, touch_button_deinit);
@@ -0,0 +1,87 @@
version: 1.0.0
# Devices Configuration
devices:
- name: display_lcd
chip: ili9341
type: display_lcd
sub_type: spi
version: default
dependencies:
espressif/esp_lcd_ili9341: "*"
config:
mirror_x: true
mirror_y: false
swap_xy: true
x_max: 284
y_max: 240
# esp_lcd_panel_io_spi_config_t fields
io_spi_config:
cs_gpio_num: 25 # GPIO14 - LCD_CS (BSP_LCD_CS)
dc_gpio_num: 26 # GPIO45 - LCD_DC (BSP_LCD_DC)
spi_mode: 3 # Traditional SPI mode (0~3)
pclk_hz: 20000000 # Frequency of pixel clock
flags:
sio_mode: true # Single line mode
peripherals:
- name: spi_display # SPI peripheral for LCD communication
lcd_panel_config:
reset_gpio_num: -1
data_endian: "LCD_RGB_DATA_ENDIAN_LITTLE" # LCD_RGB_DATA_ENDIAN_LITTLE
flags:
reset_active_high: true
# ST77916 specific configuration
vendor_config: NULL
# Touch Panel Configuration
- name: lcd_touch
chip: cst816s
type: lcd_touch_i2c
version: default
dependencies:
espressif/esp_lcd_touch_cst816s: "*"
config:
# esp_lcd_panel_io_i2c_config_t fields for touch communication
io_i2c_config:
dev_addr: 0x15 # CST816S I2C address (different from default 0x5A)
peripherals:
- name: i2c_master # I2C peripheral for touch communication
# esp_lcd_touch_config_t fields for touch configuration
touch_config:
x_max: 240 # Maximum X coordinate (BSP_LCD_H_RES)
y_max: 284 # Maximum Y coordinate (BSP_LCD_V_RES)
int_gpio_num: -1 # Interrupt GPIO (BSP_LCD_TOUCH_INT)
flags:
swap_xy: true # Swap X and Y coordinates (default: false)
mirror_x: true # Mirror X coordinates (default: false)
mirror_y: true # Mirror Y coordinates (default: false)
- name: audio_dac
chip: internal
type: audio_codec
version: default
config:
dac_enabled: true
peripherals:
- name: i2s_audio_out
tx_aux_out_io: 8
tx_aux_out_invert: true
- name: gpio_pa_control
gain: 6
active_level: 1
- name: audio_adc
chip: internal
type: audio_codec
config:
adc_enabled: true
dac_enabled: false
adc_local_cfg:
channel_list: [5] # required
sample_rate_hz: 16000
max_store_buf_size: 1024
conv_frame_size: 256
unit_id: ADC_UNIT_1
atten: ADC_ATTEN_DB_0
@@ -0,0 +1,5 @@
board: esp_SensairShuttle
chip: esp32c5
version: 1.3.0
description: "ESP-SensairShuttle Development Board"
manufacturer: "ESPRESSIF"
@@ -0,0 +1,63 @@
version: 1.0.0
# Peripherals Configuration
peripherals:
- name: i2c_master
type: i2c
role: master
config:
port: 0
pins:
sda: 2
scl: 3
# LCD SPI Configuration for ST77916 QSPI
- name: spi_display
type: spi
role: master
config:
# spi_bus_config_t fields
spi_bus_config:
spi_port: SPI2_HOST # 0: SPI1_HOST, 1: SPI2_HOST, 2: SPI3_HOST
data0_io_num: 23 # MOSI_IO_NUM
sclk_io_num: 24 # SPI Clock signal
max_transfer_sz: 3600 # Maximum transfer size in bytes
- name: i2s_audio_out
type: i2s
role: master
format: pdm-out
config:
sample_rate_hz: 16000
clk_src: I2S_CLK_SRC_DEFAULT
mclk_multiple: 256
up_sample_fp: 960
up_sample_fs: 441
bclk_div: 8
data_bit_width: 16
slot_bit_width: I2S_SLOT_BIT_WIDTH_AUTO
slot_mode: I2S_SLOT_MODE_MONO
slot_mask: I2S_PDM_SLOT_LEFT
data_fmt: "I2S_PDM_DATA_FMT_PCM"
sd_prescale: 0
sd_scale: I2S_PDM_SIG_SCALING_MUL_4
hp_scale: I2S_PDM_SIG_SCALING_MUL_4
lp_scale: I2S_PDM_SIG_SCALING_MUL_4
sinc_scale: I2S_PDM_SIG_SCALING_MUL_4
line_mode: I2S_PDM_TX_ONE_LINE_CODEC
hp_en: false
hp_cut_off_freq_hz: 35.5
sd_dither: 0
sd_dither2: 1
pins:
doubt: 7 # [IO] Data output pin
invert_flags:
clk_inv: false
# PA CONTROL
- name: gpio_pa_control
type: gpio
role: io
config:
pin: 1 # GPIO pin number
mode: GPIO_MODE_OUTPUT
default_level: 1
@@ -0,0 +1,16 @@
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
CONFIG_PARTITION_TABLE_CUSTOM=y
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_16MB.csv"
CONFIG_SPIRAM=y
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_SPIRAM_SPEED_80M=y
CONFIG_CODEC_DUMMY_SUPPORT=y
CONFIG_CODEC_DATA_ADC_SUPPORT=y
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG_ENABLED=y
CONFIG_ESP_CONSOLE_UART_NUM=-1
@@ -0,0 +1,85 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include "esp_board_manager_includes.h"
#include "esp_lcd_panel_ops.h"
#include "esp_lcd_ili9341.h"
#include "esp_lcd_touch_cst816s.h"
#include "esp_log.h"
#include "esp_check.h"
static const char *TAG = "SETUP_DEVICE";
static const ili9341_lcd_init_cmd_t vendor_specific_init[] = {
{0x11, NULL, 0, 120}, // Sleep Out
{0x36, (uint8_t []){0x00}, 1, 0}, // Memory Data Access Control
{0x3A, (uint8_t []){0x05}, 1, 0}, // Interface Pixel Format (16-bit)
{0xB2, (uint8_t []){0x0C, 0x0C, 0x00, 0x33, 0x33}, 5, 0}, // Porch Setting
{0xB7, (uint8_t []){0x05}, 1, 0}, // Gate Control
{0xBB, (uint8_t []){0x21}, 1, 0}, // VCOM Setting
{0xC0, (uint8_t []){0x2C}, 1, 0}, // LCM Control
{0xC2, (uint8_t []){0x01}, 1, 0}, // VDV and VRH Command Enable
{0xC3, (uint8_t []){0x15}, 1, 0}, // VRH Set
{0xC6, (uint8_t []){0x0F}, 1, 0}, // Frame Rate Control
{0xD0, (uint8_t []){0xA7}, 1, 0}, // Power Control 1
{0xD0, (uint8_t []){0xA4, 0xA1}, 2, 0}, // Power Control 1
{0xD6, (uint8_t []){0xA1}, 1, 0}, // Gate output GND in sleep mode
{
0xE0, (uint8_t [])
{
0xF0, 0x05, 0x0E, 0x08, 0x0A, 0x17, 0x39, 0x54,
0x4E, 0x37, 0x12, 0x12, 0x31, 0x37
}, 14, 0
}, // Positive Gamma Control
{
0xE1, (uint8_t [])
{
0xF0, 0x10, 0x14, 0x0D, 0x0B, 0x05, 0x39, 0x44,
0x4D, 0x38, 0x14, 0x14, 0x2E, 0x35
}, 14, 0
}, // Negative Gamma Control
{0xE4, (uint8_t []){0x23, 0x00, 0x00}, 3, 0}, // Gate position control
{0x21, NULL, 0, 0}, // Display Inversion On
{0x29, NULL, 0, 0}, // Display On
{0x2C, NULL, 0, 0}, // Memory Write
};
// define st77916_vendor_config_t
static const ili9341_vendor_config_t vendor_config = {
.init_cmds = vendor_specific_init,
.init_cmds_size = sizeof(vendor_specific_init) / sizeof(vendor_specific_init[0]),
};
esp_err_t lcd_panel_factory_entry_t(esp_lcd_panel_io_handle_t io, const esp_lcd_panel_dev_config_t *panel_dev_config, esp_lcd_panel_handle_t *ret_panel)
{
esp_lcd_panel_dev_config_t panel_dev_cfg = {0};
memcpy(&panel_dev_cfg, panel_dev_config, sizeof(esp_lcd_panel_dev_config_t));
panel_dev_cfg.vendor_config = (void *)&vendor_config;
int ret = esp_lcd_new_panel_ili9341(io, &panel_dev_cfg, ret_panel);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "New ili9341 panel failed");
return ret;
}
// esp_lcd_panel_set_gap(*ret_panel, 36, 0);
return ESP_OK;
}
esp_err_t lcd_touch_factory_entry_t(esp_lcd_panel_io_handle_t io, const esp_lcd_touch_config_t *touch_dev_config, esp_lcd_touch_handle_t *ret_touch)
{
esp_lcd_touch_config_t touch_cfg = {0};
memcpy(&touch_cfg, touch_dev_config, sizeof(esp_lcd_touch_config_t));
if (touch_cfg.int_gpio_num != GPIO_NUM_NC) {
ESP_LOGW(TAG, "Touch interrupt supported!");
touch_cfg.interrupt_callback = NULL;
}
esp_err_t ret = esp_lcd_touch_new_i2c_cst816s(io, &touch_cfg, ret_touch);
if (ret != ESP_OK) {
ESP_LOGE(TAG, "Failed to create gt911 touch driver: %s", esp_err_to_name(ret));
return ret;
}
return ESP_OK;
}
@@ -0,0 +1,153 @@
# Devices Configuration for EchoEar Core Board V1.0
devices:
# Audio Power Control after Audio init
- name: audio_power
type: gpio_ctrl
version: default
config:
active_level: 1
default_level: 0
peripherals:
- name: gpio_power_audio
# LCD and SDCard Power Control before LCD init
- name: lcd_sdcard_power
type: power_ctrl
sub_type: gpio
peripherals:
- name: gpio_power_lcd_sdcard
active_level: 0
- name: lcd_brightness
type: ledc_ctrl
version: default
config:
default_percent: 100 # 0-100, default 0 percent
peripherals:
- name: ledc_backlight # LEDC peripheral for GPIO 44
- name: audio_dac
chip: es8311
type: audio_codec
version: default
config:
adc_enabled: false
dac_enabled: true
dac_max_channel: 1
# DAC channel mask, 1-enable, 0-disable, layout: left,right
dac_channel_mask: "1" # Left, Right enable
mclk_enabled: true
# Power amplifier configuration
peripherals:
- name: gpio_pa_control
gain: 6 # dB
active_level: 1 # 0-low, 1-high
# I2S interface configuration
- name: i2s_audio_out
# I2C interface configuration
- name: i2c_master
address: 0x30
frequency: 400000 # Hz
# Audio ADC Configuration (ES7210)
- name: audio_adc
chip: es7210
type: audio_codec
version: default
config:
adc_enabled: true
adc_max_channel: 4
# The channel mask, 1-enable, 0-disable
# e.g."0111", bit0: Mic0 enable, bit1: Mic1 enable, bit2: Mic2 enable, bit3: Mic3 enable, bit4: Mic4 disable
adc_channel_mask: "0111" # Mic0, Mic1, Mic2 enable
adc_channel_labels: ['NA', 'RE', 'FR', 'FL'] # MSB ~ LSB
adc_init_gain: 0 # dB
# I2S interface configuration
peripherals:
# I2S interface configuration
- name: i2s_audio_in
# I2C interface configuration
- name: i2c_master
address: 0x80
frequency: 400000 # Hz
- name: fs_sdcard
type: fs_fat
sub_type: sdmmc
power_ctrl_device: lcd_sdcard_power
version: default
config:
vfs_config:
format_if_mount_failed: true
sub_config:
bus_width: 1 # 1, 4, or 8 for slot 0; 1 or 4 for slot 1
slot_flags: "SDMMC_SLOT_FLAG_INTERNAL_PULLUP" # SDMMC_SLOT_FLAG_INTERNAL_PULLUP, SDMMC_SLOT_FLAG_WP_ACTIVE_HIGH, SDMMC_SLOT_FLAG_UHS1
pins:
clk: 16 # GPIO_NUM_16
cmd: 38 # GPIO_NUM_38
d0: 17 # GPIO_NUM_17
# LCD Display Configuration
- name: display_lcd
chip: st77916
type: display_lcd
sub_type: spi
power_ctrl_device: lcd_sdcard_power
version: default
dependencies:
espressif/esp_lcd_st77916: "*"
config:
x_max: 360
y_max: 360
need_reset: false
# esp_lcd_panel_io_spi_config_t fields
io_spi_config:
cs_gpio_num: 14 # GPIO14 - LCD_CS (BSP_LCD_CS)
dc_gpio_num: 45 # GPIO45 - LCD_DC (BSP_LCD_DC)
spi_mode: 0 # Traditional SPI mode (0~3)
lcd_cmd_bits: 32 # Bit-width of LCD command
flags:
quad_mode: true # Quad mode (4 data lines) - ST77916 uses quad mode
lcd_panel_config:
reset_gpio_num: 47
flags:
reset_active_high: true # Reset pin active level (default: false)
# ST77916 specific configuration
vendor_config: NULL
peripherals:
- name: spi_display # SPI peripheral for LCD communication
# Touch Panel Configuration
- name: lcd_touch
chip: cst816s
type: lcd_touch_i2c
version: default
dependencies:
espressif/esp_lcd_touch_cst816s: "*"
config:
# esp_lcd_panel_io_i2c_config_t fields for touch communication
io_i2c_config:
dev_addr: 0x15 # CST816S I2C address (different from default 0x5A)
peripherals:
- name: i2c_master # I2C peripheral for touch communication
# esp_lcd_touch_config_t fields for touch configuration
touch_config:
x_max: 360 # Maximum X coordinate (BSP_LCD_H_RES)
y_max: 360 # Maximum Y coordinate (BSP_LCD_V_RES)
int_gpio_num: 10 # Interrupt GPIO (BSP_LCD_TOUCH_INT)
# LED GREEN
- name: led_green
type: gpio_ctrl
version: default
config:
active_level: 0
default_level: 1
peripherals:
- name: gpio_led_g

Some files were not shown because too many files have changed in this diff Show More