Skip to content

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).

TypeFactory functionConfig
Arduinohu_arduino_peripheral_createserial_port
STM32hu_stm32_peripheral_createchip (e.g. STM32F401RETx)
RPihu_rpi_peripheral_create(none)
Terminal window
human hardware list # List detected hardware and supported boards
human hardware info <board> # Show info for a specific board type

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
}
}
FieldDescription
hardware.enabledEnable hardware support
hardware.transportTransport mode (e.g. auto)
hardware.serial_portSerial port for Arduino
hardware.baud_rateBaud rate for serial
hardware.probe_targetSTM32 target for probe-rs
peripherals.enabledEnable peripheral subsystem
  • Interface: Serial (UART)
  • Config: serial_port, baud_rate
  • Uses a JSON-based protocol over serial for read/write and similar operations.
  • Interface: probe-rs (SWD) or similar
  • Config: chip / probe_target (e.g. STM32F401RETx)
  • Supports flash programming and register access via probe-rs.
  • Interface: GPIO via sysfs or gpiod
  • Config: No extra config; uses system GPIO
  • Provides GPIO read/write for connected devices.

Peripherals implement hu_peripheral_t with:

  • name, board_type
  • init_peripheral
  • read(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);

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.