Hardware Peripherals
Human can interface with hardware peripherals via a vtable-based API. Supported boards include Arduino (serial), STM32/Nucleo (probe-rs), and Raspberry Pi (GPIO).
Supported boards
Section titled “Supported boards”| Type | Factory function | Config |
|---|---|---|
| Arduino | hu_arduino_peripheral_create | serial_port |
| STM32 | hu_stm32_peripheral_create | chip (e.g. STM32F401RETx) |
| RPi | hu_rpi_peripheral_create | (none) |
CLI commands
Section titled “CLI commands”human hardware list # List detected hardware and supported boardshuman hardware info <board> # Show info for a specific board typeConfiguration
Section titled “Configuration”Hardware is configured in ~/.human/config.json:
{ "hardware": { "enabled": true, "transport": "auto", "serial_port": "/dev/ttyUSB0", "baud_rate": 115200, "probe_target": "STM32F401RE" }, "peripherals": { "enabled": true, "datasheet_dir": null }}| Field | Description |
|---|---|
hardware.enabled | Enable hardware support |
hardware.transport | Transport mode (e.g. auto) |
hardware.serial_port | Serial port for Arduino |
hardware.baud_rate | Baud rate for serial |
hardware.probe_target | STM32 target for probe-rs |
peripherals.enabled | Enable peripheral subsystem |
Connection methods
Section titled “Connection methods”Arduino
Section titled “Arduino”- Interface: Serial (UART)
- Config:
serial_port,baud_rate - Uses a JSON-based protocol over serial for read/write and similar operations.
STM32 / Nucleo
Section titled “STM32 / Nucleo”- Interface: probe-rs (SWD) or similar
- Config:
chip/probe_target(e.g.STM32F401RETx) - Supports flash programming and register access via probe-rs.
Raspberry Pi
Section titled “Raspberry Pi”- Interface: GPIO via sysfs or gpiod
- Config: No extra config; uses system GPIO
- Provides GPIO read/write for connected devices.
Peripheral API
Section titled “Peripheral API”Peripherals implement hu_peripheral_t with:
name,board_typeinit_peripheralread(addr, out_value),write(addr, data)flash(firmware_path)(where supported)capabilities(board name, features)destroy
Create a peripheral with:
hu_peripheral_t p;hu_peripheral_config_t cfg = { .serial_port = "/dev/ttyUSB0", .serial_port_len = 14, .chip = NULL, .chip_len = 0};hu_peripheral_create(alloc, "arduino", 7, &cfg, &p);Agent integration
Section titled “Agent integration”The agent can interact with peripherals through tools that wrap the peripheral API (e.g. peripheral_read, peripheral_write). These tools are registered when peripherals are enabled and configured.