Add LP5562 driver, M1 smoke test, and milestone-based plan

- Integrate LP5562 driver from sibling project (ntag5-samd21-lp562)
  with full doc comments restored
- Update main.rs with complete M1 test: I2C init, GPIO EN, RGBW cycle
- Rewrite DEVELOPMENT_PLAN.md from waterfall to milestone-based groups
  organized by hardware availability (Groups A-E)
- Rewrite STATUS.md with milestone checklist tracking
- Add LP5562 timing constraints and flash script docs to CLAUDE.md
- Add flash_when_ready.sh for auto-flash dev workflow
- Add brainstorm design doc for plan redesign rationale

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
michael
2026-03-03 10:26:24 -08:00
parent bae64c1e3a
commit e4195d2583
8 changed files with 1171 additions and 357 deletions

View File

@@ -10,6 +10,9 @@ cargo build --release
# Flash via UF2 bootloader (XIAO M0: double-tap RST to enter bootloader)
cargo hf2 --release
# Auto-flash: watches for bootloader USB device, flashes when detected
./flash_when_ready.sh
```
## Target
@@ -36,29 +39,31 @@ When porting to bare SAMD21E: replace `xiao_m0` with `atsamd-hal = { version = "
src/
main.rs # Entry point: boot, pattern load, sleep/wake loop
led/
mod.rs # LedController trait + re-exports
mod.rs # LP5562 re-exports (LedController trait added later, M10)
lp5562.rs # LP5562 driver (from ../ntag5-samd21-lp562/)
simple_pwm.rs # Single-color LED driver (GPIO PWM)
ntag5/
mod.rs # NTAG5Link I2C slave driver (MCU-side)
registers.rs # Register map and config constants
eeprom.rs # EEPROM read/write
sram.rs # SRAM mailbox for NFC pass-through
pattern/
mod.rs # Pattern format, parser, serializer
engine.rs # LP5562 engine program builder from patterns
ntag5/ # NTAG5Link I2C slave driver (M4+)
pattern/ # Pattern format and engine builder (M5+)
```
## Architecture Conventions
- **`no_std` only**: No heap allocation. Fixed-size arrays and stack-only data structures.
- **`embedded-hal` generics**: All hardware drivers must be generic over `embedded_hal::i2c::I2c` (1.0 traits). Never use concrete HAL types in driver code.
- **LedController trait**: LED controllers implement the `LedController` trait defined in `src/led/mod.rs`. This enables modular support for LP5562, single-color PWM, and future LED driver ICs.
- **Hardware-first**: Get hardware working before extracting abstractions. Traits and formats are designed after hands-on experience, not before.
- **Error types**: Use `Error<E>` enum wrapping underlying I2C error with `From<E>` impl (see LP5562 driver pattern).
- **Register addresses**: Place in a `reg` submodule as `pub const` values.
- **`const fn`**: Prefer `const fn` where possible (see `EngineCommand` builder in LP5562 driver).
- **No `unsafe`**: Avoid unless absolutely necessary for hardware access.
## LP5562 Timing Constraints
The LP5562 driver does NOT enforce timing delays internally — the caller is responsible:
- **>= 500 us** after `enable()` before any other commands
- **>= 488 us** between consecutive ENABLE register writes (engine exec changes)
- **>= 153 us** between consecutive OP_MODE register writes (engine mode changes)
- When transitioning from Run, set exec to Hold first, then change mode
## Key I2C Addresses
| Device | Address | Notes |
@@ -103,5 +108,5 @@ Key config constants (from `../ntag5sensor/vicinity/ntag5link.py`):
## Sibling Projects
- `../ntag5-samd21-lp562/` — LP5562 driver source (`src/lp5562.rs`), reference `main.rs` boot sequence
- `../ntag5-samd21-lp562/` Original LP5562 driver + smoke test (xblink's `src/led/lp5562.rs` is synced from here)
- `../ntag5sensor/` — NTAG5Link command reference (`vicinity/ntag5link.py`), I2C patterns (`vicinity/i2cbase.py`)