一键导入
esp-idf-component-api-research
Structured workflow for researching ESP-IDF component drivers, BSP headers, and struct compatibility before integration
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Structured workflow for researching ESP-IDF component drivers, BSP headers, and struct compatibility before integration
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
How to find and maintain hardware pinout documentation for supported boards
Ensure the serial COM port is available before flashing or monitoring an ESP32 device
Verify and manage the IDF build target (esp32, esp32s3, etc.) to avoid chip mismatch errors and wasted rebuild cycles
How to run ESP-IDF commands (idf.py) in this project
| name | ESP-IDF Component API Research |
| description | Structured workflow for researching ESP-IDF component drivers, BSP headers, and struct compatibility before integration |
idf_component.ymlESP-IDF component macros (especially display driver convenience macros like SH8601_PANEL_BUS_QSPI_CONFIG) are often written for C and break in C++ due to:
int to gpio_num_t (enum) is rejected in C++This skill provides a systematic approach to avoid wasting time on these issues.
Before any external research, check if the component/board is already documented:
// turbo
Get-ChildItem -Path "docs" -Recurse -Filter "*.md" | ForEach-Object { Write-Host $_.FullName }
If a hardware reference or component guide exists, read it first — it likely has the pinout, struct layouts, and known gotchas.
After adding a dependency to idf_component.yml and running idf.py build (which downloads components), headers are at:
managed_components/<registry>__<component>/include/
// turbo
Get-ChildItem -Path "managed_components" -Recurse -Filter "*.h" | Where-Object { $_.DirectoryName -like "*include*" } | ForEach-Object { $_.FullName }
When using designated initializers in C++, field order must match the struct definition. Extract it:
esp_lcd_sh8601.h)SH8601_PANEL_BUS_QSPI_CONFIG)spi_bus_config_t)// turbo
Select-String -Path "d:\esp\v6.0-beta2\esp-idf\components" -Include "*.h" -Pattern "typedef struct" -Recurse | Select-String "<struct_name>"
Before using a component's convenience macro in C++ code:
#define in the component header-1 assignments to gpio_num_t fields// Instead of: SH8601_PANEL_BUS_QSPI_CONFIG(sclk, d0, d1, d2, d3, max_sz)
// Write manually with correct field order:
const spi_bus_config_t spiBusCfg = {
.data0_io_num = LCD_DATA0, // union position [0]
.data1_io_num = LCD_DATA1, // union position [1]
.sclk_io_num = LCD_PCLK, // position [2]
.data2_io_num = LCD_DATA2, // union position [3]
.data3_io_num = LCD_DATA3, // union position [4]
// ... remaining fields in declaration order
};
After successfully integrating a component, update docs/hardware-reference.md with:
This prevents future agents from repeating the research.
| Component | Macro | Issue | Workaround |
|---|---|---|---|
waveshare/esp_lcd_sh8601 | SH8601_PANEL_BUS_QSPI_CONFIG | sclk_io_num before data0_io_num (wrong order) | Manual spi_bus_config_t init |
waveshare/esp_lcd_sh8601 | SH8601_PANEL_IO_QSPI_CONFIG | int to gpio_num_t conversion | Manual esp_lcd_panel_io_spi_config_t init |
espressif/esp-brookesia | ESP_BROOKESIA_CHECK_*_EXIT | Private header, not accessible | Use assert() / ESP_ERROR_CHECK() |