接口在 components/phonerail_hal/include/,宿主机链 sim/、ESP32-S3 链 esp/ (IDF v5.4 新版 i2c_master / gpio / LEDC / esp_timer)。 sim 提供 A3 起要用的假板子控制面:假 I²C 器件(寄存器表 + 大端 + 指针自增)、 可注入 NAK / 器件失联、GPIO 外部驱动与写计数、虚拟时钟。 组件名不叫 hal —— ESP-IDF 自己有 components/hal(driver 依赖它),同名会盖掉。 验收:bash host/test.sh → 3 条 ctest 全过;build_idf.ps1 → 编过且零警告。 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QYuExfgyYa6DzRRcUso8M8
13 行
560 B
CMake
13 行
560 B
CMake
# PhoneRail 的硬件抽象层(ESP-IDF 侧)。宿主机侧编的是 sim/,由 host/CMakeLists.txt 收。
|
||
#
|
||
# ⚠️ 组件名不能叫 `hal` —— ESP-IDF 自己有一个 components/hal(driver 依赖它),
|
||
# 重名会把 IDF 的那个盖掉。所以目录叫 phonerail_hal。
|
||
idf_component_register(
|
||
SRCS "hal_err.c"
|
||
"esp/hal_i2c_esp.c"
|
||
"esp/hal_gpio_esp.c"
|
||
"esp/hal_pwm_esp.c"
|
||
"esp/hal_time_esp.c"
|
||
INCLUDE_DIRS "include"
|
||
REQUIRES esp_driver_i2c esp_driver_gpio esp_driver_ledc esp_timer freertos)
|