diff --git a/assets/README.md b/assets/README.md index 15467c6..07b711d 100644 --- a/assets/README.md +++ b/assets/README.md @@ -21,6 +21,12 @@ Store reusable font files and generated font sources in `fonts/`. Store reusable source images and generated display assets in `images/`. +| File | Dimensions and format | Use and source | +| --- | --- | --- | +| [`images/readme-hardware-specs.png`](images/readme-hardware-specs.png) | 2172 × 724, PNG RGBA | Hardware overview infographic embedded in both `docs/README.md` files. Generated for this repository with the built-in image generation tool on 2026-09-17; the six labels and values were checked against the documented hardware contract. | +| [`images/logo-wordmark.png`](images/logo-wordmark.png) | 1648 × 336, PNG RGBA | Transparent black wordmark extracted from the repository's original `images/logo.png`; embedded in both project README files for light backgrounds. | +| [`images/logo-wordmark-dark.png`](images/logo-wordmark-dark.png) | 1648 × 336, PNG RGBA | White version of the extracted wordmark, used by the README `` element when GitHub is in dark mode. | + - Use descriptive names and document dimensions, pixel format, conversion steps, and destination. - Prefer formats suitable for the 240 × 320 RGB565 display and account for Flash and internal RAM. - Preserve editable sources where licensing permits, and record the source and license. diff --git a/assets/README.zh_CN.md b/assets/README.zh_CN.md index 0be060e..33dff61 100644 --- a/assets/README.zh_CN.md +++ b/assets/README.zh_CN.md @@ -19,6 +19,12 @@ 可复用的源图与生成的显示资产放在 `images/`。 +| 文件 | 尺寸与格式 | 用途与来源 | +| --- | --- | --- | +| [`images/readme-hardware-specs.png`](images/readme-hardware-specs.png) | 2172 × 724,PNG RGBA | 嵌入中英文 `docs/README.md` 的硬件概览图。于 2026-09-17 使用内置图像生成工具为本仓库生成;已根据文档中的硬件能力契约核对图中的六项标签与参数。 | +| [`images/logo-wordmark.png`](images/logo-wordmark.png) | 1648 × 336,PNG RGBA | 从仓库原始 `images/logo.png` 中精确裁切并去除背景的黑色字标;用于中英文项目 README 的浅色主题。 | +| [`images/logo-wordmark-dark.png`](images/logo-wordmark-dark.png) | 1648 × 336,PNG RGBA | 提取字标的白色版本;README 使用 `` 在 GitHub 深色主题下显示。 | + - 使用描述性命名,并记录尺寸、像素格式、转换步骤与目标路径。 - 优先采用适合 240 × 320 RGB565 显示的格式,并纳入 Flash 与内部 RAM 考量。 - 许可允许时保留可编辑源文件,并记录来源与许可。 diff --git a/assets/images/logo-wordmark-dark.png b/assets/images/logo-wordmark-dark.png new file mode 100644 index 0000000..8b2bae4 Binary files /dev/null and b/assets/images/logo-wordmark-dark.png differ diff --git a/assets/images/logo-wordmark.png b/assets/images/logo-wordmark.png new file mode 100644 index 0000000..2200ea7 Binary files /dev/null and b/assets/images/logo-wordmark.png differ diff --git a/assets/images/logo.png b/assets/images/logo.png new file mode 100644 index 0000000..85165bd Binary files /dev/null and b/assets/images/logo.png differ diff --git a/assets/images/readme-hardware-specs.png b/assets/images/readme-hardware-specs.png new file mode 100644 index 0000000..749beef Binary files /dev/null and b/assets/images/readme-hardware-specs.png differ diff --git a/docs/README.md b/docs/README.md index 7cd7e50..17f1df9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,53 +1,79 @@ -# FoloToy AI Passport +**English** · [简体中文](/docs/README.zh_CN.md) -English | [简体中文](README.zh_CN.md) +

FoloToy AI PASSPORT

-FoloToy AI Passport is open wearable AI hardware. This repository is the development baseline for the device. It keeps the **hardware facts, stable interfaces, resource boundaries, reference implementations, and validation methods** needed to build applications in one place. +

+ + + FoloToy wordmark + +

-The repository is organized around the following principles: +

+ Open Wearable AI Agent
+ WEAR · PLAY · CREATE
+ Your idea. Your firmware. Your everyday companion. +

-- `main` is the smallest complete runnable baseline and an executable description of the current hardware capabilities. -- `components/bsp` isolates board-level details and exposes stable APIs to applications. -- `demo/*` branches show different paths from a product requirement to a working implementation. -- Development conventions for AI assistants live in [`AGENTS.md`](../AGENTS.md) and [`docs/development/ai-guide.md`](development/ai-guide.md); the complete hardware context and troubleshooting knowledge is in [`docs/hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md`](hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md). -- Build results and physical-device results are reported separately. A successful build must never be presented as successful hardware validation. +

+ ESP32-C3 with 8 MB Flash + ESP-IDF 5.5.3 + LVGL user interface + MIT License +

-## Hardware capability contract +

+ Website · + Start building · + Community projects · + Documentation +

-The table below describes the application capabilities implemented by the current `main` branch. It is not a list of everything that might be possible according to the chip datasheet. +--- -| Capability | Confirmed implementation | Application interface | Boundaries that must be respected | -| --- | --- | --- | --- | -| Display | ST7789P3, 240 × 320 portrait RGB565, SPI2 at 40 MHz; LEDC backlight | `bsp_display_*`, `bsp_lvgl_*` | The ESP32-C3 has no PSRAM; the current design uses a small single DMA buffer; the BSP exposes no LCD MISO, touch, or TE interface | -| Input | `UP`, `DOWN`, and `OK` share an ADC resistor ladder on GPIO0 | `bsp_button_init()`, `bsp_button_read_mv()` | Callbacks run in the button component task and must not block; do not create a second ADC1 unit | -| Audio | ES8311 with full-duplex PCM over I2S0, supporting playback, microphone capture, and software suspend/resume | `bsp_audio_*` | PCM reads and writes block and belong in a worker task; stop PCM I/O before codec sleep; format changes must retain the BSP close/open sequence | -| Battery | CW2017 state-of-charge and voltage readings | `bsp_battery_*` | This capability is optional at runtime; accuracy depends on the cell and battery profile and is not equivalent to a calibrated result | -| Wi-Fi | On-demand 2.4 GHz STA scan demo | `main/demo_wifi.c` | Scans only; it does not connect, store credentials, or validate antenna/RF performance | -| Bluetooth LE | On-demand non-connectable NimBLE advertising as `FoloPassport` | `main/demo_ble.c` | ESP32-C3 does not support Bluetooth Classic; radio range, coexistence, and power draw require device measurements | -| Low power | Two-second light sleep and five-second deep sleep, both with RTC timer wakeup | `main/demo_low_power.c` | Both modes force and verify ES8311 suspend; light sleep restores audio, while deep sleep first suspends CW2017, releases I2S/shared-I2C pins, sleeps and holds the LCD pins, then restarts on wake; the current demo exposes RTC timer wake only | -| Shared bus | ES8311 and CW2017 share I2C0 | `bsp_i2c_*` | Every device must reuse the bus owned by the BSP; do not create another bus on the same port for scanning or a new device | -| Logging and flashing | Native ESP32-C3 USB Serial/JTAG | ESP-IDF console | GPIO18/19 are reserved for USB; the default UART0 TX on GPIO21 conflicts with the backlight | +Build something you can wear. **FoloToy AI Passport** is open wearable AI hardware, +and this repository is its firmware development baseline: board support, working +examples, AI workflows, and validation tools in one place. -All pins, addresses, panel parameters, and button voltage windows are defined only in [`components/bsp/include/bsp_pins.h`](../components/bsp/include/bsp_pins.h). Application code must not duplicate these constants. See the [AI Hardware Development Guide](hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md) for the complete pin map, panel initialization, ADC thresholds, I2C addressing rules, audio clocks, and memory details. +

+ Hardware at a glance: ESP32-C3, 8 MB Flash, no PSRAM, a 240 by 320 display, three physical buttons, and ES8311 audio. +

-Applications may also use ESP-IDF timers, FreeRTOS tasks, and internal Flash/NVS; the Pomodoro branch contains an NVS example. Wi-Fi and Bluetooth LE remain ESP-IDF application services rather than BSP APIs: their menu pages initialize each stack only while open and release it on exit. `demo/claude-buddy-port` remains a fuller BLE application architecture reference, not a substitute for measuring the current board's antenna, RF performance, power consumption, and coexistence behavior. The default custom-firmware baseline uses 8 MB Flash with only NVS, PHY data, and one factory-app partition spanning the remaining space; user firmware may replace it with another valid 8 MB layout. +| Make it yours | Start with working code | Check what you build | +| --- | --- | --- | +| Create timers, small games, or an everyday companion with your own UI. | Reuse the BSP for display, buttons, audio, and battery; learn from independent demo branches. | Run host tests, build a verified merged image, then validate on your device. | -### Capabilities outside the current contract +## Find your starting point -The public firmware contract is limited to the interfaces listed above. Do not infer additional board interfaces from the ESP32-C3 feature list. New hardware interfaces require an explicit BSP definition and on-device acceptance criteria. +| I want to… | Start here | +| --- | --- | +| Use the device or try an official play | [Getting started](https://ai-passport.folotoy.cn/guides/getting-started/) · [Official plays](https://ai-passport.folotoy.cn/plays/) | +| Build a custom application with AI | [Agent instructions](../AGENTS.md) · [AI development guide](development/ai-guide.md) · [Required skills](../skills/README.md) | +| Prepare my environment and build firmware | [Environment setup](development/engineering/environment-setup.md) · [Build and test](development/engineering/build-and-test.md) | +| Explore the board or contribute | [Hardware guide](hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md) · [Contributing](../.github/CONTRIBUTING.md) | + +> [!IMPORTANT] +> `main` is a minimal, runnable **hardware-test baseline**, not a finished application. +> Derivative applications must design their own UI; the current demo test menu and +> screens must not be reused. BSP APIs and non-UI logic remain reusable. ## Start development with one requirement -A simple request can be given directly to an AI assistant: +1. Open the repository in your AI coding tool and have it read [`AGENTS.md`](../AGENTS.md). +2. Let it check and install the [five required skills](../skills/README.md), with any permissions your environment requires. +3. Describe what you want to build. Start from `main` on a new `feature/*` branch. + +Copy this prompt and adapt it to your idea: ```text Build an offline habit-tracking application for FoloToy AI Passport. Use the three physical buttons and the 240×320 display, and preserve records across power loss. Start from `main`, create a `feature/*` branch, and develop the application there. -Follow AGENTS.md and docs/hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md. Inspect relevant demo branches and docs/reference/ application archives first, -keep hardware logic in components/bsp and application logic in main, deliver a runnable -implementation with tests, and report the build result, unexecuted device checks, and exact -on-device acceptance steps separately. +Follow AGENTS.md and docs/hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md. +Inspect relevant demo branches and docs/reference/ application archives first. +Keep hardware logic in components/bsp and application logic in main. +Deliver a runnable implementation with tests; report build results, +unexecuted device checks, and on-device acceptance steps separately. Redesign the application's UI; do not use the current demo test menu or screens. ``` @@ -55,6 +81,9 @@ Before starting, check [`docs/reference/`](reference/README.md) for an existing reference application and previously recorded, reusable experience, and the demo branches. See what is already built and reusable. +
+Write a clearer requirement — pages, controls, data, and acceptance + The more specific the requirement, the more likely the assistant is to implement it correctly in one pass. Useful details include: - User flow: what each page displays and what short press, double press, and long press do for each button. @@ -65,6 +94,14 @@ The more specific the requirement, the more likely the assistant is to implement When details are omitted, the assistant may choose conservative defaults that do not change the product direction, but it must list those assumptions in the delivery. Decisions involving new wiring, electrical safety, board revisions, or irreversible data formats require confirmation first. +
+ +> [!NOTE] +> A successful build is not hardware validation. Test the application on a real +> device after implementation; flashing requires your approval. Deliver a verified +> merged `full.bin` for flashing at `0x0`. No original-firmware backup is required, +> but a merged flash may reset stored data. See the [flashing policy](development/engineering/firmware-layout.md#flashing-and-stored-data). + ## Demo branches are design cases, not a feature pile Each `demo/*` branch evolves the baseline into an independent application. The branches demonstrate how specific problems were solved. New applications should normally branch from `main` and consult relevant examples instead of merging multiple demos wholesale. @@ -79,6 +116,9 @@ The menu and `demo_*.c` pages on `main` are hardware-capability tests, not an ap | `demo/tetris-game` | Three-button Tetris | Real-time game loop, low-latency `PRESS` input, partial refresh, a pure game model, audio, and microphone interaction | | `demo/claude-buddy-port` | Desktop AI hardware companion | Replacing the demo menu with a complete application, encrypted BLE, protocol parsing, state reduction, task communication, and extensive host tests | +
+Explore a demo and create your application branch + Inspect an example without switching the current working tree: ```bash @@ -96,8 +136,51 @@ git switch -c feature/my-passport-app Example branches may change the same menu, configuration, or driver in incompatible ways. Understand the differences before extracting a state model, asset pipeline, or concurrency pattern. Code appearing in an example branch is not automatically part of the current `main` BSP contract. +
+ +## Hardware capability contract + +**ESP32-C3 · 8 MB Flash · no PSRAM · 240 × 320 display · three physical buttons** + +The default layout contains only **NVS, PHY data, and one factory application** +spanning the remaining Flash. User firmware may use another valid 8 MB layout. +See [firmware layout](development/engineering/firmware-layout.md). + +
+Expand the capability table — interfaces, limits, and implementation details + +The table below describes the application capabilities implemented by the current `main` branch. It is not a list of everything that might be possible according to the chip datasheet. + +| Capability | Confirmed implementation | Application interface | Boundaries that must be respected | +| --- | --- | --- | --- | +| Display | ST7789P3, 240 × 320 portrait RGB565, SPI2 at 40 MHz; LEDC backlight | `bsp_display_*`, `bsp_lvgl_*` | The ESP32-C3 has no PSRAM; the current design uses a small single DMA buffer; the BSP exposes no LCD MISO, touch, or TE interface | +| Input | `UP`, `DOWN`, and `OK` share an ADC resistor ladder on GPIO0 | `bsp_button_init()`, `bsp_button_read_mv()` | Callbacks run in the button component task and must not block; do not create a second ADC1 unit | +| Audio | ES8311 with full-duplex PCM over I2S0, supporting playback, microphone capture, and software suspend/resume | `bsp_audio_*` | PCM reads and writes block and belong in a worker task; stop PCM I/O before codec sleep; format changes must retain the BSP close/open sequence | +| Battery | CW2017 state-of-charge and voltage readings | `bsp_battery_*` | This capability is optional at runtime; accuracy depends on the cell and battery profile and is not equivalent to a calibrated result | +| Wi-Fi | On-demand 2.4 GHz STA scan demo | `main/demo_wifi.c` | Scans only; it does not connect, store credentials, or validate antenna/RF performance | +| Bluetooth LE | On-demand non-connectable NimBLE advertising as `FoloPassport` | `main/demo_ble.c` | ESP32-C3 does not support Bluetooth Classic; radio range, coexistence, and power draw require device measurements | +| Low power | Two-second light sleep and five-second deep sleep, both with RTC timer wakeup | `main/demo_low_power.c` | Both modes force and verify ES8311 suspend; light sleep restores audio, while deep sleep first suspends CW2017, releases I2S/shared-I2C pins, sleeps and holds the LCD pins, then restarts on wake; the current demo exposes RTC timer wake only | +| Shared bus | ES8311 and CW2017 share I2C0 | `bsp_i2c_*` | Every device must reuse the bus owned by the BSP; do not create another bus on the same port for scanning or a new device | +| Logging and flashing | Native ESP32-C3 USB Serial/JTAG | ESP-IDF console | GPIO18/19 are reserved for USB; the default UART0 TX on GPIO21 conflicts with the backlight | + +All pins, addresses, panel parameters, and button voltage windows are defined only in [`components/bsp/include/bsp_pins.h`](../components/bsp/include/bsp_pins.h). Application code must not duplicate these constants. See the [AI Hardware Development Guide](hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md) for the complete pin map, panel initialization, ADC thresholds, I2C addressing rules, audio clocks, and memory details. + +Applications may also use ESP-IDF timers, FreeRTOS tasks, and internal Flash/NVS; the Pomodoro branch contains an NVS example. Wi-Fi and Bluetooth LE remain ESP-IDF application services rather than BSP APIs: their menu pages initialize each stack only while open and release it on exit. `demo/claude-buddy-port` remains a fuller BLE application architecture reference, not a substitute for measuring the current board's antenna, RF performance, power consumption, and coexistence behavior. + +### Capabilities outside the current contract + +The public firmware contract is limited to the interfaces listed above. Do not infer additional board interfaces from the ESP32-C3 feature list. New hardware interfaces require an explicit BSP definition and on-device acceptance criteria. + +
+ ## Project structure +Board support lives in `components/bsp`; application pages, state, and tasks live +in `main`. Keep that boundary when building your own firmware. + +
+Browse the repository map + ```text components/bsp/include/ Public BSP APIs and bsp_pins.h hardware facts components/bsp/src/ Display, button, audio, battery, and shared-I2C implementations @@ -114,17 +197,27 @@ CLAUDE.md Claude Code pointer to AGENTS.md (paired Chinese versio LICENSE Repository license ``` +
+ ## Documentation index -Repository documentation is organized by function area. `authoritative` documents define development or collaboration requirements; `reference` documents provide background or an index. +Engineering and contribution guides define the rules; examples and archives +provide reference material. Choose the entry that matches your task. -- [`docs/development/`](development/README.md) — engineering rules and reusable workflows: the `ai-guide.md`, `engineering/`, `ci/`, and `release/` areas. Its README lists them. -- [`docs/contribution/`](contribution/README.md) — collaboration, documentation, and commit/PR conventions. -- [`docs/hardware-design/`](hardware-design/README.md) — board facts, constraints, acceptance matrix, and troubleshooting. -- [`docs/reference/`](reference/README.md) — reference material: reusable development experience and archived application playbooks, grouped by contributor (`docs/reference//`, relative to the repository root). -- [`docs/brand/`](brand/README.md) — public brand and product language (`brand-and-product.md`) and the official product visual references. -- [`docs/`](README.md) top-level — [`CHANGELOG.md`](CHANGELOG.md), [`brand-and-product.md`](brand/brand-and-product.md), and [`fork-guide.md`](fork-guide.md). +| Resource | What you will find | +| --- | --- | +| [Development](development/README.md) | AI workflow, engineering conventions, CI, and release guidance | +| [AI skills](../skills/README.md) | Development, environment setup, builds, device testing, and debugging | +| [Hardware](hardware-design/README.md) | Board facts, interface boundaries, acceptance checklists, and troubleshooting | +| [Chinese fonts](development/engineering/lvgl-chinese-fonts.md) | Glyph coverage, widget font selection, and blank-text troubleshooting | +| [Wi-Fi provisioning](development/engineering/wifi-provisioning.md) | Bluetooth provisioning reference and companion mini program | +| [Community projects and experience](reference/README.md) | Playbooks and reusable knowledge under `docs/reference//` | +| [Contributing](contribution/README.md) | Documentation, commits, and pull-request conventions | +| [Brand assets](brand/README.md) | Product visual references and [brand language](brand/brand-and-product.md) | +| [Fork guide](fork-guide.md) · [Changelog](CHANGELOG.md) | Downstream workflows and release history | -GitHub community documents: [CONTRIBUTING.md](../.github/CONTRIBUTING.md), [CODE_OF_CONDUCT.md](../.github/CODE_OF_CONDUCT.md), [SECURITY.md](../.github/SECURITY.md), and [SUPPORT.md](../.github/SUPPORT.md). +--- -> This README describes the product and repository. AI agents must begin with `AGENTS.md` and follow its task-specific routing. +[Contribute](../.github/CONTRIBUTING.md) · [Get help](../.github/SUPPORT.md) · [Code of conduct](../.github/CODE_OF_CONDUCT.md) · [Security](../.github/SECURITY.md) · [MIT License](../LICENSE) + +AI agents: start with [`AGENTS.md`](../AGENTS.md) and follow its task-specific routing. diff --git a/docs/README.zh_CN.md b/docs/README.zh_CN.md index d2d9492..7612245 100644 --- a/docs/README.zh_CN.md +++ b/docs/README.zh_CN.md @@ -1,57 +1,85 @@ -# FoloToy AI Passport +[English](/docs/README.md) · **简体中文** -[English](README.md) | 简体中文 +

FoloToy AI PASSPORT

-FoloToy AI Passport 是一个开放式可穿戴 AI 硬件,本仓库是这款 AI 硬件的开发基线。它不只展示"板子能运行什么",还把开发应用所需的**硬件事实、稳定接口、资源边界、参考实现和验收方法**放在同一仓库中。 +

+ + + FoloToy 字标 + +

-这个仓库的组织方式是: +

+ 开放式可穿戴 AI Agent
+ WEAR · PLAY · CREATE
+ 把你的创意,变成随身的日常伙伴。 +

-- `main` 是最小但完整的可运行基线,也是当前硬件能力的可执行说明; -- `components/bsp` 隔离板级差异,为应用提供稳定 API; -- `demo/*` 分支展示从需求到成品的不同实现路径; -- AI 开发约定见 [`AGENTS.zh_CN.md`](../AGENTS.zh_CN.md) 与 [`docs/development/ai-guide.zh_CN.md`](development/ai-guide.zh_CN.md);完整硬件上下文和故障知识见 [`docs/hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.zh_CN.md`](hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.zh_CN.md); -- 构建结果与真机结果分开记录,禁止把"编译通过"描述成"硬件验证通过"。 +

+ ESP32-C3,8 MB Flash + ESP-IDF 5.5.3 + LVGL 用户界面 + MIT 许可证 +

-## 硬件能力契约 +

+ 产品官网 · + 开始开发 · + 社区作品 · + 开发文档 +

-下表描述的是当前 `main` 已提供的应用能力,而不是芯片数据手册中所有可能的能力。 +--- -| 能力 | 已确认实现 | 应用接口 | 必须遵守的边界 | -| --- | --- | --- | --- | -| 显示 | ST7789P3,240 × 320,竖屏 RGB565,SPI2 40 MHz;LEDC 背光 | `bsp_display_*`、`bsp_lvgl_*` | ESP32-C3 无 PSRAM;当前为小型单 DMA 缓冲;BSP 未暴露 LCD MISO、触摸或 TE 接口 | -| 输入 | `UP` / `DOWN` / `OK` 三键,共用 GPIO0 的 ADC 电阻分压 | `bsp_button_init()`、`bsp_button_read_mv()` | 回调运行在 button 组件任务中,不能阻塞;不能再创建第二个 ADC1 unit | -| 音频 | ES8311,I2S0 全双工 PCM,支持播放、麦克风录音及软件休眠/恢复 | `bsp_audio_*` | PCM 读写为阻塞调用,应放工作任务;codec 休眠前必须停止 PCM I/O;格式切换必须保留 BSP 内的 close/open 流程 | -| 电池 | CW2017 的 SOC 与电压读取 | `bsp_battery_*` | 是可缺省能力;读数精度取决于电芯与 profile,不能等同于已标定结果 | -| Wi-Fi | 按需 2.4 GHz STA 扫描 demo | `main/demo_wifi.c` | 仅扫描;不连接、不存凭证、不验证天线/射频表现 | -| Bluetooth LE | 按需以 `FoloPassport` 名义做不可连接的 NimBLE 广播 | `main/demo_ble.c` | ESP32-C3 不支持蓝牙经典;射频范围、共存与功耗需实测 | -| 低功耗 | 两秒浅睡眠与五秒深睡眠,均以 RTC 定时器唤醒 | `main/demo_low_power.c` | 两种模式都强制暂停 ES8311 并回读校验;浅睡眠恢复音频,深睡眠则先暂停 CW2017、释放 I2S/共享 I2C 引脚、休眠并保持 LCD 引脚,唤醒时重启应用;当前 demo 只提供 RTC 定时器唤醒 | -| 共享总线 | ES8311 与 CW2017 共用 I2C0 | `bsp_i2c_*` | 所有设备复用 BSP 持有的总线;不能为扫描或新设备再创建同端口总线 | -| 日志与烧录 | ESP32-C3 原生 USB Serial/JTAG | ESP-IDF console | GPIO18/19 保留给 USB;UART0 默认 TX GPIO21 与背光冲突 | +让创意不止停留在屏幕里。**FoloToy AI Passport** 是开放式可穿戴 AI 硬件, +本仓库是它的固件开发基线,将板级支持、可运行示例、AI 工作流和验证工具放在一起。 -所有引脚、地址、面板参数和按键电压窗口只在 [`components/bsp/include/bsp_pins.h`](../components/bsp/include/bsp_pins.h) 定义。应用代码不得复制这些常量。完整引脚表、面板初始化、ADC 阈值、I2C 地址规则、音频时钟和内存说明见 [AI 硬件开发指南](hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.zh_CN.md)。 +

+ 硬件参数一览:ESP32-C3、8 MB Flash、无 PSRAM、240 × 320 屏幕、三个实体按键和 ES8311 音频。 +

-应用也可以使用 ESP-IDF 提供的定时器、FreeRTOS 任务和内部 Flash/NVS;番茄钟分支提供了 NVS 示例。Wi-Fi 和 Bluetooth LE 仍是 ESP-IDF 应用服务而非 BSP API:其菜单页面仅在打开时初始化对应协议栈、退出时释放。`demo/claude-buddy-port` 仍是更完整的 BLE 应用架构参考,不能替代对当前板卡天线、射频表现、功耗和共存行为的实测。默认自定义固件基线使用 8 MB Flash,只包含 NVS、PHY data,以及占用剩余空间的单个 factory-app 分区;用户固件可以替换成其它合法的 8 MB 布局。 +| 定义你的玩法 | 从可运行代码出发 | 让每次交付有据可查 | +| --- | --- | --- | +| 用独立 UI 打造计时器、小游戏或日常随身伙伴。 | 复用显示、按键、音频、电池 BSP,参考独立 demo 分支。 | 运行主机测试,生成已校验的合并固件,再到设备上验收。 | -### 不属于当前能力契约的事项 +## 找到你的起点 -公开固件能力以表中接口为限,不能仅凭 ESP32-C3 芯片能力推断其他板级接口。新增硬件接口必须提供明确的 BSP 定义和实机验收标准。 +| 我想要…… | 从这里开始 | +| --- | --- | +| 使用设备、体验官方玩法 | [快速上手](https://ai-passport.folotoy.cn/guides/getting-started/) · [官方玩法](https://ai-passport.folotoy.cn/plays/) | +| 让 AI 开发自定义应用 | [Agent 规范](../AGENTS.zh_CN.md) · [AI 开发指南](development/ai-guide.zh_CN.md) · [必需技能](../skills/README.zh_CN.md) | +| 准备环境、编译固件 | [环境准备](development/engineering/environment-setup.zh_CN.md) · [构建与测试](development/engineering/build-and-test.zh_CN.md) | +| 了解硬件、参与贡献 | [硬件指南](hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.zh_CN.md) · [贡献指南](../.github/CONTRIBUTING.zh_CN.md) | + +> [!IMPORTANT] +> `main` 是最小可运行的**硬件测试基线**,不是成品应用。 +> 二次开发必须重新设计 UI,禁止沿用当前 demo 测试菜单和页面; +> BSP API 与非 UI 逻辑仍可复用。 ## 用一句需求开始开发 -简单需求可以直接交给 AI 助手: +1. 在 AI 编程工具中打开仓库,让它先阅读 [`AGENTS.md`](../AGENTS.md)。 +2. 由 AI 自行检查、安装[五个必需技能](../skills/README.zh_CN.md),按当前环境要求取得必要权限。 +3. 描述你想做的应用,从 `main` 创建新的 `feature/*` 分支开始开发。 + +复制这段提示词,替换成你的创意: ```text 请为 FoloToy AI Passport 开发一个离线习惯打卡应用。 使用三个实体按键和 240×320 屏幕,记录保存在掉电不丢失的存储中。 从 `main` 开始,创建 `feature/*` 分支并在该分支上开发。 -遵守 AGENTS.md 和 docs/hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md;先查找相关 demo 分支与 docs/reference/ 应用档案, -保持硬件逻辑在 components/bsp、应用逻辑在 main,完成可运行实现与测试, -最后分别报告构建结果、未执行的真机项目和逐项验收方法。 +遵守 AGENTS.md 和 docs/hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md。 +先查找相关 demo 分支与 docs/reference/ 应用档案。 +硬件逻辑放在 components/bsp,应用逻辑放在 main。 +完成可运行实现与测试,分别报告构建结果、未执行的真机项目和逐项验收方法。 必须重新设计应用 UI,禁止使用当前 demo 测试菜单和页面。 ``` -开始前先看 [`docs/reference/`](reference/README.zh_CN.md) 有没有已存在或可参考的应用、以及已沉淀、可复用的经验,再配合相关 demo 分支。 -这些列出了已经构建好、可复用的东西。 +开始前先看 [`docs/reference/`](reference/README.zh_CN.md) 中已有的应用与开发经验, +再配合相关 demo 分支,确认哪些实现可以参考和复用。 + +
+把需求说得更清楚 — 页面、按键、数据与验收 需求越具体,AI 助手越容易一次实现正确。建议说明: @@ -63,6 +91,13 @@ FoloToy AI Passport 是一个开放式可穿戴 AI 硬件,本仓库是这款 A 若需求没有给出所有细节,AI 助手可以在不改变产品方向的范围内采用保守默认值,但应在交付中列出这些假设。涉及新接线、电源安全、硬件版本或不可恢复数据格式的决定必须先确认。 +
+ +> [!NOTE] +> 编译通过不等于硬件验证通过。实现完成后应在真实设备上验收,刷写需要获得用户同意。 +> 交付固件须为已校验、可从 `0x0` 烧录的合并 `full.bin`。 +> 无需备份设备原有固件,但合并烧录可能重置已存数据,详见[烧录说明](development/engineering/firmware-layout.zh_CN.md#烧录与已存数据)。 + ## 示例分支是设计案例,不是功能堆叠 每个 `demo/*` 分支都从基线演化出一个独立应用。它们的价值是展示具体问题的实现方式;新应用通常应从 `main` 建分支,按需参考,而不是把多个 demo 整体合并。 @@ -77,6 +112,9 @@ FoloToy AI Passport 是一个开放式可穿戴 AI 硬件,本仓库是这款 A | `demo/tetris-game` | 三键俄罗斯方块 | 实时游戏循环、低延迟 `PRESS` 输入、局部刷新、纯游戏模型、音效与麦克风交互 | | `demo/claude-buddy-port` | 桌面 AI 硬件伴侣 | 用完整应用替换 demo 菜单、加密 BLE、协议解析、状态归约、任务通信和较完整的主机测试 | +
+查看示例并创建应用分支 + 查看示例而不切换当前工作区: ```bash @@ -94,8 +132,50 @@ git switch -c feature/my-passport-app 示例分支之间可能改变了同一菜单、配置或驱动。应先理解差异,再提取状态模型、资源流水线或并发模式;不能因为代码曾出现在示例分支,就把它当成当前 `main` 的 BSP 保证。 +
+ +## 硬件能力契约 + +**ESP32-C3 · 8 MB Flash · 无 PSRAM · 240 × 320 屏幕 · 三个实体按键** + +默认分区仅包含 **NVS、PHY data 和占用剩余 Flash 的单个 factory 应用**。 +用户固件可按需调整为其他合法的 8 MB 布局,详见[固件布局](development/engineering/firmware-layout.zh_CN.md)。 + +
+展开完整能力表 — 接口、限制与实现细节 + +下表描述的是当前 `main` 已提供的应用能力,而不是芯片数据手册中所有可能的能力。 + +| 能力 | 已确认实现 | 应用接口 | 必须遵守的边界 | +| --- | --- | --- | --- | +| 显示 | ST7789P3,240 × 320,竖屏 RGB565,SPI2 40 MHz;LEDC 背光 | `bsp_display_*`、`bsp_lvgl_*` | ESP32-C3 无 PSRAM;当前为小型单 DMA 缓冲;BSP 未暴露 LCD MISO、触摸或 TE 接口 | +| 输入 | `UP` / `DOWN` / `OK` 三键,共用 GPIO0 的 ADC 电阻分压 | `bsp_button_init()`、`bsp_button_read_mv()` | 回调运行在 button 组件任务中,不能阻塞;不能再创建第二个 ADC1 unit | +| 音频 | ES8311,I2S0 全双工 PCM,支持播放、麦克风录音及软件休眠/恢复 | `bsp_audio_*` | PCM 读写为阻塞调用,应放工作任务;codec 休眠前必须停止 PCM I/O;格式切换必须保留 BSP 内的 close/open 流程 | +| 电池 | CW2017 的 SOC 与电压读取 | `bsp_battery_*` | 是可缺省能力;读数精度取决于电芯与 profile,不能等同于已标定结果 | +| Wi-Fi | 按需 2.4 GHz STA 扫描 demo | `main/demo_wifi.c` | 仅扫描;不连接、不存凭证、不验证天线/射频表现 | +| Bluetooth LE | 按需以 `FoloPassport` 名义做不可连接的 NimBLE 广播 | `main/demo_ble.c` | ESP32-C3 不支持蓝牙经典;射频范围、共存与功耗需实测 | +| 低功耗 | 两秒浅睡眠与五秒深睡眠,均以 RTC 定时器唤醒 | `main/demo_low_power.c` | 两种模式都强制暂停 ES8311 并回读校验;浅睡眠恢复音频,深睡眠则先暂停 CW2017、释放 I2S/共享 I2C 引脚、休眠并保持 LCD 引脚,唤醒时重启应用;当前 demo 只提供 RTC 定时器唤醒 | +| 共享总线 | ES8311 与 CW2017 共用 I2C0 | `bsp_i2c_*` | 所有设备复用 BSP 持有的总线;不能为扫描或新设备再创建同端口总线 | +| 日志与烧录 | ESP32-C3 原生 USB Serial/JTAG | ESP-IDF console | GPIO18/19 保留给 USB;UART0 默认 TX GPIO21 与背光冲突 | + +所有引脚、地址、面板参数和按键电压窗口只在 [`components/bsp/include/bsp_pins.h`](../components/bsp/include/bsp_pins.h) 定义。应用代码不得复制这些常量。完整引脚表、面板初始化、ADC 阈值、I2C 地址规则、音频时钟和内存说明见 [AI 硬件开发指南](hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.zh_CN.md)。 + +应用也可以使用 ESP-IDF 提供的定时器、FreeRTOS 任务和内部 Flash/NVS;番茄钟分支提供了 NVS 示例。Wi-Fi 和 Bluetooth LE 仍是 ESP-IDF 应用服务而非 BSP API:其菜单页面仅在打开时初始化对应协议栈、退出时释放。`demo/claude-buddy-port` 仍是更完整的 BLE 应用架构参考,不能替代对当前板卡天线、射频表现、功耗和共存行为的实测。 + +### 不属于当前能力契约的事项 + +公开固件能力以表中接口为限,不能仅凭 ESP32-C3 芯片能力推断其他板级接口。新增硬件接口必须提供明确的 BSP 定义和实机验收标准。 + +
+ ## 项目结构 +板级支持放在 `components/bsp`;应用页面、状态与任务放在 `main`。 +开发自定义固件时继续保持这条边界。 + +
+展开仓库目录说明 + ```text components/bsp/include/ BSP 公开 API 与 bsp_pins.h 硬件事实 components/bsp/src/ 显示、按键、音频、电池、共享 I2C 实现 @@ -112,17 +192,26 @@ CLAUDE.md Claude Code 指向 AGENTS.md 的入口(含中文配 LICENSE 仓库许可证 ``` +
+ ## 文档索引 -本仓库文档按功能域组织。`authoritative` 指对开发与协作有约束力的文档;`参考` 指提供背景或索引的文档。 +工程与协作文档定义开发规则,示例与档案提供参考资料。按当前任务选择入口即可。 -- [`docs/development/`](development/README.zh_CN.md) — 工程规则与可复用工作流:`ai-guide.md`、`engineering/`、`ci/`、`release/` 区。其 README 列明它们。 -- [`docs/contribution/`](contribution/README.zh_CN.md) — 协作、文档与提交/PR 约定。 -- [`docs/hardware-design/`](hardware-design/README.zh_CN.md) — 板卡事实、约束、验收矩阵与排障。 -- [`docs/reference/`](reference/README.zh_CN.md) — 参考资料:按贡献者(相对仓库根目录的 `docs/reference//`)组织可复用开发经验与已归档应用档案。 -- [`docs/brand/`](brand/README.zh_CN.md) — 公开品牌与产品语言(`brand-and-product.zh_CN.md`)与官方产品视觉参考。 -- [`docs/`](README.zh_CN.md) 顶层 — [`CHANGELOG.zh_CN.md`](CHANGELOG.zh_CN.md)、[`brand-and-product.zh_CN.md`](brand/brand-and-product.zh_CN.md)、[`fork-guide.zh_CN.md`](fork-guide.zh_CN.md)。 +| 入口 | 你可以找到 | +| --- | --- | +| [开发指南](development/README.zh_CN.md) | AI 工作流、工程规范、CI 与发布流程 | +| [AI 技能](../skills/README.zh_CN.md) | 开发、环境准备、构建、真机测试与故障诊断 | +| [硬件资料](hardware-design/README.zh_CN.md) | 板卡事实、接口边界、验收清单与排障 | +| [中文字体](development/engineering/lvgl-chinese-fonts.zh_CN.md) | 字形覆盖、控件字体选择,以及中文空白排查 | +| [Wi-Fi 配网](development/engineering/wifi-provisioning.zh_CN.md) | 蓝牙配网实现参考与配套小程序 | +| [社区作品与经验](reference/README.zh_CN.md) | `docs/reference//` 下的应用档案和可复用知识 | +| [参与贡献](contribution/README.zh_CN.md) | 文档、提交与 Pull Request 约定 | +| [品牌素材](brand/README.zh_CN.md) | 产品视觉参考与[品牌说明](brand/brand-and-product.zh_CN.md) | +| [Fork 指南](fork-guide.zh_CN.md) · [更新记录](CHANGELOG.zh_CN.md) | 下游工作流与版本历史 | -GitHub 社区治理文档:[CONTRIBUTING.zh_CN.md](../.github/CONTRIBUTING.zh_CN.md)、[CODE_OF_CONDUCT.zh_CN.md](../.github/CODE_OF_CONDUCT.zh_CN.md)、[SECURITY.zh_CN.md](../.github/SECURITY.zh_CN.md)、[SUPPORT.zh_CN.md](../.github/SUPPORT.zh_CN.md)。 +--- -> 注:本 README 只描述产品与仓库,不含给 AI 的执行说明;AI 开始开发前请先读根目录 `AGENTS.zh_CN.md`,再按任务路由读取相关文档。 +[参与贡献](../.github/CONTRIBUTING.zh_CN.md) · [获取帮助](../.github/SUPPORT.zh_CN.md) · [行为准则](../.github/CODE_OF_CONDUCT.zh_CN.md) · [安全说明](../.github/SECURITY.zh_CN.md) · [MIT 许可证](../LICENSE) + +AI 助手请从 [`AGENTS.md`](../AGENTS.md) 开始,再按任务路由读取相关文档。