Skip to content

Hardware Peripherals

Human can interact with hardware boards through the hu_peripheral_t vtable. Peripherals expose read, write, and flash operations.

MethodDescription
namePeripheral identifier
board_typeBoard type (e.g. arduino, stm32, rpi)
health_checkReport connectivity
init_peripheralInitialize connection
readRead byte at address
writeWrite byte to address
flashFlash firmware from path
capabilitiesBoard capabilities (GPIO, flash, serial)
destroyCleanup
  • Transport: Serial (JSON protocol)
  • Config: serial_port (e.g. /dev/ttyUSB0, COM3)
  • Protocol: JSON commands over serial; responses in JSON
  • Capabilities: GPIO, serial, ADC (model-dependent)
  • Transport: probe-rs CLI (SWD/JTAG)
  • Config: chip (e.g. STM32F401RETx)
  • Flash: probe-rs for flashing firmware
  • Capabilities: Flash, read/write memory maps
  • Transport: GPIO (Linux sysfs or similar)
  • Config: No serial/chip; uses system GPIO
  • Capabilities: GPIO read/write

Config:

{
"peripherals": {
"enabled": true,
"datasheet_dir": "/path/to/datasheets"
},
"hardware": {
"enabled": true,
"transport": "serial",
"serial_port": "/dev/ttyUSB0",
"baud_rate": 115200,
"probe_target": "STM32F401RETx"
}
}

Build: Peripherals are included when the main binary is built; no separate flag for Arduino/STM32/RPi.

  • hardware_memory — Read/write memory maps via probe-rs or serial
  • hardware_info — Query system and peripheral info

On macOS/Windows, peripheral support may return HU_ERR_NOT_SUPPORTED for serial or probe-rs–based backends. Use explicit error handling rather than silent no-ops.