Skip to content

Commit a757447

Browse files
committed
fix(esp_board_manager): add lyrat_mini_v1_1 board full support
- Add complete YAML configuration files for ESP32 Lyrat Mini V1.1 board * board_info.yaml: Board metadata and description * board_peripherals.yaml: I2C, I2S, GPIO peripherals configuration * board_devices.yaml: ES8311 DAC, ES7243E ADC, and SD card devices - Enhance I2S peripheral support with improved configuration handling - Add board_utils.py helper functions for board configuration - Fixed build errors caused by incorrect use of `extern "C"` guards in `esp_board_manager_includes.h` - Remove unused test_apps dependency - Update audio codec device implementation for better compatibility - Updated version to v0.4.2
1 parent dbbf27d commit a757447

File tree

19 files changed

+618
-133
lines changed

19 files changed

+618
-133
lines changed

packages/esp_board_manager/CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,36 @@
11
# Changelog
22

3+
## v0.4.2
4+
5+
### Features
6+
7+
- Added full board support for ESP32 Lyrat Mini V1.1
8+
* Complete YAML configuration files (board_info.yaml, board_peripherals.yaml, board_devices.yaml)
9+
* Support for ES8311 DAC, ES7243E ADC, and SD card devices
10+
* I2C, I2S, and GPIO peripherals configuration
11+
- Enhanced I2S peripheral support with improved configuration handling
12+
- Added `board_utils.py` helper functions for board configuration
13+
14+
### Bug Fixes
15+
16+
- Fixed build errors caused by incorrect use of `extern "C"` guards in `esp_board_manager_includes.h`
17+
- Removed unused dependency on `test_apps`
18+
- Updated audio codec device implementation for better compatibility
19+
- Appended `esp_board_manager_defs.h` to `esp_board_manager_includes.h` to ensure all necessary header
20+
files are included
21+
322
## v0.4.1
423

524
### Features
25+
626
- Renamed esp_board_manager_ext.py to idf_ext.py for compatibility with ESP-IDF v6.0 auto-discovery
727
- Update `Kconfig.in` with new configuration options to hide the board selection menu
828
- Update the README to include information about how to add new boards and the development roadmap
929
- Added the esp_board_periph_ref_handle and esp_board_periph_unref_handle APIs to obtain and release a handle
1030
- Added esp_board_find_utils.h and esp_board_manager_includes.h
1131

1232
### Bug Fixes
33+
1334
- Delete only `build/CMakeCache.txt` to avoid a full clean when switching boards
1435
- Fixed the configuration of the sdmmc sdcard host slot, ensuring the configuration for the host slot in the yml file takes effect correctly
1536
- Using slot 0 to drive the sdcard for p4_function board, avoiding conflict with wifi hosted
@@ -18,6 +39,7 @@
1839
## v0.4.0
1940

2041
### Features
42+
2143
- Add `init_skip` field to control device auto-initialization
2244
- Add custom device type with test support
2345
- Add gpio expander device type with test support
@@ -37,12 +59,14 @@
3759
- Clear the build directory to get the correct dependencies when switching boards
3860

3961
### Supported Boards
62+
4063
- **ESP32-S3 Korvo2 V3**: Full LCD, LCD Touch, DVP Camera support
4164
- **ESP32-P4 Function-EV**: Codec, SD card supported
4265

4366
## v0.3.0 (Initial Release)
4467

4568
### Core Features
69+
4670
- **ESP Board Manager**: Initial release of comprehensive board configuration management system
4771
- **YAML-based Configuration**: Support for `board_peripherals.yaml` and `board_devices.yaml` configuration files
4872
- **Automatic Code Generation**: Modular code generation system with 8-step streamlined process
@@ -51,6 +75,7 @@
5175
- **SDK Configuration Automation**: Automatic ESP-IDF feature enabling based on board requirements
5276

5377
### Supported Boards
78+
5479
- **Echoear Core Board V1.0**: Full audio, LCD, touch, and SD card support
5580
- **ESP-BOX-3**: ESP32-S3 development board with I2C, I2S, SPI, LEDC, and GPIO support
5681
- **Dual Eyes Board V1.0**: Dual LCD display with touch support
@@ -60,13 +85,15 @@
6085
- **ESP32-C5 Spot**: YAML configurations support
6186

6287
### Peripheral Support
88+
6389
- **I2C**: Full support with type safety
6490
- **I2S**: Complete audio interface support
6591
- **SPI**: Full peripheral and device support
6692
- **LEDC**: PWM and LED control support
6793
- **GPIO**: GPIO support
6894

6995
### Device Support
96+
7097
- **Audio Codecs**: ES8311, ES7210, and other audio codec devices
7198
- **SD Cards**: FATFS filesystem support
7299
- **LCD Displays**: SPI LCD with LVGL integration
@@ -76,12 +103,14 @@
76103
- **GPIO Control**: GPIO output control
77104

78105
### APP Interfaces
106+
79107
- **Board Manager API**: `esp_board_manager_init()`, `esp_board_manager_deinit()`, `esp_board_manager_print()`
80108
- **Peripheral API**: `esp_board_manager_get_periph_config()`, `esp_board_manager_get_periph_handle()`
81109
- **Device API**: `esp_board_manager_get_device_config()`, `esp_board_manager_get_device_handle()`
82110
- **Error Handling**: Comprehensive error codes and macros (`ESP_BOARD_RETURN_ON_ERROR`)
83111

84112
### Documentation & Testing
113+
85114
- **Comprehensive Documentation**: README, API documentation, and configuration guides
86115
- **Test Applications**: Complete test suite for all peripherals and devices
87116
- **Configuration Rules**: Detailed YAML configuration rules and best practices

packages/esp_board_manager/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ idf_component_register(
2828
${DEVICE_INCLUDES} # Add device includes
2929
REQUIRES
3030
driver
31+
esp_driver_i2s
3132
esp_common
3233
fatfs
3334
esp_lcd

packages/esp_board_manager/boards/lyrat_mini_v1_1/board_devices.yaml

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,66 @@ chip: esp32
33
version: 1.0.0
44
# Devices Configuration
55
devices:
6+
# SD Card Power Control
7+
- name: lcd_power
8+
type: gpio_ctrl
9+
version: default
10+
config:
11+
active_level: 0 # Low level to enable power
12+
default_level: 1 # Default to power off
13+
peripherals:
14+
- name: gpio_sd_power # SDCARD_PWR_CTRL
15+
16+
# Audio Codec (ES8311) - DAC for audio output
17+
- name: audio_dac
18+
chip: es8311
19+
type: audio_codec
20+
version: default
21+
skip_init: true
22+
config:
23+
dac_enabled: true
24+
dac_max_channel: 1
25+
dac_channel_mask: "1" # Left channel enable
26+
mclk_enabled: false
27+
aec: false
28+
peripherals:
29+
- name: gpio_power_amp
30+
gain: 20 # BOARD_PA_GAIN (dB)
31+
active_level: 1 # High level active
32+
- name: i2s_audio_out
33+
- name: i2c_master
34+
address: 0x30 # ES8311 I2C address, 0x18 << 1 = 0x30
35+
frequency: 100000 # 100kHz I2C frequency
36+
37+
# Audio ADC (ES7243/ES7243E) - ADC for audio input
38+
- name: audio_adc
39+
chip: es7243e # Some old boards use ES7243, ES7243 is EOL
40+
type: audio_codec
41+
version: default
42+
# skip_init: true
43+
config:
44+
adc_enabled: true
45+
adc_max_channel: 2
46+
adc_channel_mask: "11" # Left, Right channel enable
47+
adc_channel_labels: ['RE', 'FL'] # Reference channel, Front channel
48+
mclk_enabled: true
49+
aec: false
50+
peripherals:
51+
- name: i2s_audio_in
52+
- name: i2c_master
53+
address: 0x20 # ES7243E I2C address (0x26 for ES7243)
54+
frequency: 100000 # 100kHz I2C frequency
55+
56+
# SD Card (FATFS)
657
- name: fs_sdcard
758
type: fatfs_sdcard
859
version: default
960
config:
10-
bus_width: 1 # 1, 4, 8, not used on SPI type
61+
mount_point: "/sdcard"
62+
vfs_config:
63+
max_files: 5
64+
bus_width: 1 # 1-line mode only
1165
pins:
12-
clk: 15 # GPIO_NUM_15
13-
cmd: 7 # GPIO_NUM_7
14-
d0: 4 # GPIO_NUM_4
15-
66+
clk: 14
67+
cmd: 15
68+
d0: 2

packages/esp_board_manager/boards/lyrat_mini_v1_1/board_peripherals.yaml

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,90 @@ chip: esp32
33
version: 1.0.0
44
# Peripherals Configuration
55
peripherals:
6+
# I2C Master for audio codec communication
67
- name: i2c_master
78
type: i2c
89
role: master
910
config:
1011
port: 0
1112
pins:
12-
sda: 17
13-
scl: 18
13+
sda: 18
14+
scl: 23
15+
16+
# I2S for audio output (DAC)
17+
- name: i2s_audio_out
18+
type: i2s
19+
role: master
20+
config:
21+
port: 0
22+
format: "std-out"
23+
pins:
24+
mclk: -1
25+
bclk: 5
26+
ws: 25
27+
dout: 26
28+
din: 35 #NOT USED
29+
sample_rate_hz: 48000
30+
data_bit_width: 16
31+
32+
# I2S for audio input (ADC)
33+
- name: i2s_audio_in
34+
type: i2s
35+
role: master
36+
config:
37+
port: 1
38+
format: "std-in"
39+
pins:
40+
mclk: 0 # GPIO_NUM_0 (ES7243_MCLK_GPIO)
41+
bclk: 32
42+
ws: 33
43+
dout: -1
44+
din: 36
45+
sample_rate_hz: 16000
46+
data_bit_width: 16
47+
48+
# GPIO peripherals for various controls
49+
- name: gpio_sd_power # SD Card power control
50+
type: gpio
51+
config:
52+
pin: 13
53+
mode: "GPIO_MODE_OUTPUT"
54+
55+
- name: gpio_headphone_detection # Headphone detection
56+
type: gpio
57+
config:
58+
pin: 19
59+
mode: "GPIO_MODE_INPUT"
60+
pullup_en: true
61+
62+
- name: gpio_power_amp # Power amplifier enable
63+
type: gpio
64+
config:
65+
pin: 21
66+
mode: "GPIO_MODE_OUTPUT"
67+
68+
- name: gpio_green_led # Green LED
69+
type: gpio
70+
config:
71+
pin: 22
72+
mode: "GPIO_MODE_OUTPUT"
73+
74+
- name: gpio_blue_led # Blue LED
75+
type: gpio
76+
config:
77+
pin: 27
78+
mode: "GPIO_MODE_OUTPUT"
79+
80+
- name: gpio_sd_detect # SD Card detect
81+
type: gpio
82+
config:
83+
pin: 34
84+
mode: "GPIO_MODE_INPUT"
85+
pullup_en: true
86+
87+
- name: gpio_adc_button # ADC button input
88+
type: gpio
89+
config:
90+
pin: 39
91+
mode: "GPIO_MODE_INPUT"
92+
pulldown_en: true

packages/esp_board_manager/devices/dev_audio_codec/dev_audio_codec.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static const codec_registry_entry_t codec_registry[] = {
206206
static const codec_registry_entry_t *find_codec(const char *name)
207207
{
208208
for (int i = 0; codec_registry[i].name != NULL; i++) {
209-
ESP_LOGI(TAG, "codec_registry[%d].name: %s,wanted: %s", i, codec_registry[i].name, name);
209+
ESP_LOGD(TAG, "codec_registry[%d].name: %s,wanted: %s", i, codec_registry[i].name, name);
210210
if (strcmp(codec_registry[i].name, name) == 0) {
211211
return &codec_registry[i];
212212
}
@@ -292,8 +292,7 @@ int dev_audio_codec_init(void *cfg, int cfg_size, void **device_handle)
292292
.dev_type = dev_type,
293293
};
294294
codec_handles->codec_dev = esp_codec_dev_new(&dev_cfg);
295-
ESP_LOGI(TAG, "Create esp_codec_dev success, dev:%p, type:%d",
296-
codec_handles->codec_dev, dev_type);
295+
ESP_LOGI(TAG, "Create esp_codec_dev success, dev:%p, chip:%s", codec_handles->codec_dev, codec_cfg->chip);
297296
*device_handle = codec_handles;
298297
return 0;
299298
}

packages/esp_board_manager/devices/dev_audio_codec/dev_audio_codec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151

5252
# I2C interface configuration
5353
- name: i2c-0 # I2C peripheral for codec control
54-
address: 0x30 # I2C device address (hex format) (default: 0x30)
54+
address: 0x30 # I2C device address, include the read/write bit (hex format) (default: 0x30)
5555
frequency: 400000 # I2C clock frequency in Hz (default: 400000)

packages/esp_board_manager/gen_bmgr_config_codes.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -788,11 +788,11 @@ def clear_gen_bmgr_codes_directory(self, project_root: str) -> bool:
788788
file_path = os.path.join(gen_bmgr_codes_dir, filename)
789789
if os.path.isfile(file_path):
790790
os.remove(file_path)
791-
self.logger.info(f' Removed file: {filename}')
791+
self.logger.debug(f' Removed file: {filename}')
792792
elif os.path.isdir(file_path):
793793
import shutil
794794
shutil.rmtree(file_path)
795-
self.logger.info(f' Removed directory: {filename}')
795+
self.logger.debug(f' Removed directory: {filename}')
796796

797797
self.logger.info(' ✅ gen_bmgr_codes directory cleared successfully')
798798
else:
@@ -805,24 +805,20 @@ def clear_gen_bmgr_codes_directory(self, project_root: str) -> bool:
805805

806806
def get_chip_name_from_board_path(self, board_path: str) -> Optional[str]:
807807
"""Extract chip name from board_info.yaml file"""
808+
from generators.utils.board_utils import get_chip_name_from_board_path as get_chip_name_legacy
809+
808810
board_info_path = os.path.join(board_path, 'board_info.yaml')
809811

810812
if not os.path.exists(board_info_path):
811813
self.logger.warning(f'⚠️ board_info.yaml not found at {board_info_path}')
812814
return None
813815

814-
try:
815-
with open(board_info_path, 'r', encoding='utf-8') as f:
816-
board_yml = yaml.safe_load(f)
817-
chip = board_yml.get('chip')
818-
if chip:
819-
self.logger.debug(f' Found chip name: {chip}')
820-
return chip
821-
else:
822-
self.logger.warning(f'⚠️ No chip field found in {board_info_path}')
823-
return None
824-
except Exception as e:
825-
self.logger.error(f'❌ Error reading board_info.yaml: {e}')
816+
chip = get_chip_name_legacy(board_path)
817+
if chip:
818+
self.logger.debug(f' Found chip name: {chip}')
819+
return chip
820+
else:
821+
self.logger.warning(f'⚠️ No chip field found in {board_info_path}')
826822
return None
827823

828824
def get_version_info(self):
@@ -983,6 +979,13 @@ def run(self, args):
983979
periph_name_map = None
984980
device_dependencies = {} # Initialize device_dependencies
985981

982+
# Set board path for global board utilities
983+
board_path = all_boards.get(selected_board) if selected_board in all_boards else None
984+
if board_path:
985+
from generators.utils.board_utils import set_board_path
986+
set_board_path(board_path)
987+
self.logger.debug(f' Set global board path: {board_path}')
988+
986989
if not args.devices_only:
987990
self.logger.info('⚙️ Step 4/8: Processing peripherals...')
988991
try:

packages/esp_board_manager/generators/utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
from .file_utils import *
1313
from .yaml_utils import *
1414
from .path_utils import *
15+
from .board_utils import *

0 commit comments

Comments
 (0)