Hw Interface
Write firmware's pin needs from hardware specs, check board.json against them, and ensure requirement IDs follow REQ-<AREA>-<NNN> format for traceability with the board repo.
Editor's Note
Before running `trace.py --firmware`, ensure all `REQ-*` IDs cited in the board repo's `docs/requirements.md` are defined in this repository. Also, copy the board repo's `board.json` to `hardware/board.json` and run the validation script before modifying any driver code.
When to Use It
- Define firmware pin requirements from hardware specs
- Validate board.json against firmware pin needs
- Ensure requirement IDs are correctly formatted and referenced
SKILL.md
SkillsHunter provides this listing for informational purposes only. Review the skill’s source, license, and required permissions before use. You are responsible for deciding whether to install or run it. Terms of Use
Keep the hardware interface between this firmware and its board repo. The board repo follows hardware-agent-kit:
its trace.py --firmware checks each REQ-* it cites, and its pins.py assigns pins from the firmware's needs.
Files
| File | Owner | Content |
|---|---|---|
hardware/pin-needs.txt |
firmware | One function per line: FUNCTION SIGNALS [GROUP]. The board repo copies it to pin-data/pin-needs.txt. |
hardware/board.json |
board repo | Copy of the board repo's pin-data/board.json (pins.py export): pins, signals, peripherals, interrupt lines, rails, revision, hardware ID. Do not edit it. |
Steps
- Read the specs in
roadmap/that touch hardware: their Interfaces (peripheral, pins, bus speed) and Behaviour. - Write one line per function in
hardware/pin-needs.txt. Name the function as the schematic net will be named (IMU_SCK,MOTOR_PWM_A). Give the signals the function can use, alternatives separated by|:- an alternate-function name, with
*and{x}placeholders:SPI{n}_SCK,ADC1_IN*; GPIO(any I/O pin),EXTI(any pin with its own interrupt line), or an exact pin (PA13). Give the functions of one bus the same group, so one peripheral instance serves the whole bus.
- an alternate-function name, with
- Give
hardware/pin-needs.txtto the board repo. Do not choose pins: the board picks them from the placement. - When the board repo exports a new
board.json, copy it tohardware/board.json. Runpython3 .claude/skills/hw-interface/hw_interface.py check hardware/pin-needs.txt hardware/board.json. Fix each error before you change a driver. - Configure each driver's pins, peripheral instance and interrupt line from
hardware/board.json. Do not copy a pin by hand into a source file without a check that readsboard.json. - Run
python3 .claude/skills/hw-interface/hw_interface.py ids .. Fix each error. - Report changed files, the
checkandidsresults, and each warning.
Requirement IDs
- Each requirement has one ID:
REQ-<AREA>-<NNN>. AREA is capital letters and digits (MOTOR,BLE,PWR). NNN is three digits. - Define each ID once: in the first cell of its table row, or at the start of its heading.
- Never reuse or renumber an ID. A removed requirement keeps its ID, marked Deleted.
- The board repo cites these IDs in
docs/requirements.md.trace.py --firmware <this repo>fails on an ID that this repository does not contain.
Rules
board.jsondescribes one revision (revision,hardware_id). Firmware that supports several revisions reads the hardware ID at start-up (the board's straps or ADC ladder) and selects the pin set.- A board function that no need names is a warning: confirm that the board repo did not add a function the firmware does not drive.
View original Markdown
---
name: hw-interface
description: Keep the firmware and its board in step with a hardware-agent-kit board repo. Write the firmware's pin needs from the roadmap specs, check the board's board.json against them, and keep requirement IDs in the REQ-<AREA>-<NNN> form the board traces to. Use when a spec touches pins, buses or interrupts, or when the board repo exports a new board.json.
---
Keep the hardware interface between this firmware and its board repo. The board repo follows hardware-agent-kit:
its `trace.py --firmware` checks each `REQ-*` it cites, and its `pins.py` assigns pins from the firmware's needs.
## Files
| File | Owner | Content |
|---|---|---|
| `hardware/pin-needs.txt` | firmware | One function per line: `FUNCTION SIGNALS [GROUP]`. The board repo copies it to `pin-data/pin-needs.txt`. |
| `hardware/board.json` | board repo | Copy of the board repo's `pin-data/board.json` (`pins.py export`): pins, signals, peripherals, interrupt lines, rails, revision, hardware ID. Do not edit it. |
## Steps
1. Read the specs in `roadmap/` that touch hardware: their *Interfaces* (peripheral, pins, bus speed) and *Behaviour*.
2. Write one line per function in `hardware/pin-needs.txt`. Name the function as the schematic net will be named
(`IMU_SCK`, `MOTOR_PWM_A`). Give the signals the function can use, alternatives separated by `|`:
- an alternate-function name, with `*` and `{x}` placeholders: `SPI{n}_SCK`, `ADC1_IN*`;
- `GPIO` (any I/O pin), `EXTI` (any pin with its own interrupt line), or an exact pin (`PA13`).
Give the functions of one bus the same group, so one peripheral instance serves the whole bus.
3. Give `hardware/pin-needs.txt` to the board repo. Do not choose pins: the board picks them from the placement.
4. When the board repo exports a new `board.json`, copy it to `hardware/board.json`. Run
`python3 .claude/skills/hw-interface/hw_interface.py check hardware/pin-needs.txt hardware/board.json`.
Fix each error before you change a driver.
5. Configure each driver's pins, peripheral instance and interrupt line from `hardware/board.json`.
Do not copy a pin by hand into a source file without a check that reads `board.json`.
6. Run `python3 .claude/skills/hw-interface/hw_interface.py ids .`. Fix each error.
7. Report changed files, the `check` and `ids` results, and each warning.
## Requirement IDs
- Each requirement has one ID: `REQ-<AREA>-<NNN>`. AREA is capital letters and digits (`MOTOR`, `BLE`, `PWR`).
NNN is three digits.
- Define each ID once: in the first cell of its table row, or at the start of its heading.
- Never reuse or renumber an ID. A removed requirement keeps its ID, marked *Deleted*.
- The board repo cites these IDs in `docs/requirements.md`. `trace.py --firmware <this repo>` fails on an ID that
this repository does not contain.
## Rules
- `board.json` describes one revision (`revision`, `hardware_id`). Firmware that supports several revisions
reads the hardware ID at start-up (the board's straps or ADC ladder) and selects the pin set.
- A board function that no need names is a warning: confirm that the board repo did not add a function the firmware
does not drive.
Community Reviews & Field Notes
Tried this skill on your own project? Share the model you used and the results you got.