gallo CLI
gallo is the fastest way to prove your board works, poke a device, and turn a
manual experiment into a repeatable command. It sits on top of
pico-de-gallo-lib, so the CLI and the Rust library speak the same protocol and
see the same capabilities.
Use it for:
- bring-up and smoke tests,
- one-off I2C / SPI / UART / GPIO / PWM / ADC / 1-Wire operations,
- shell scripting,
- discovering which board is which when several are plugged in.
Top-level Help
$ gallo --help
Access I2C/SPI devices through Pico De Gallo
Usage: gallo [OPTIONS] <COMMAND>
Commands:
list List connected Pico de Gallo devices
version Get firmware version
i2c I2C access methods
spi SPI access methods
gpio GPIO access methods
uart UART access methods
pwm PWM control methods
adc ADC access methods
onewire 1-Wire bus access methods
help Print this message or the help of the given subcommand(s)
Options:
-s, --serial-number <SERIAL_NUMBER> Select a specific board by USB serial
-f, --format <FORMAT> Read output format [default: hex]
[possible values: hex, binary, ascii]
-h, --help Print help
-V, --version Print version
Global Options
-s, --serial-number
If more than one Pico de Gallo is attached, gallo would otherwise use the
first matching device the OS reports. Pass -s to make board selection
explicit.
$ gallo list
Serial Number Bus Address
E6633861A34B8C24 2 14
E6633861A34B9F17 1 8
$ gallo -s E6633861A34B9F17 version
Firmware version: 0.1.0
-f, --format hex|binary|ascii
The global -f flag controls how read-style commands print data:
hex— hexadecimal bytes,binary— raw bytes to stdout,ascii— printable characters, with non-printable bytes shown as..
$ gallo -f ascii uart read --count 5 --timeout 100
Hello
Tip
binaryis the right choice when you want to pipe the output into another program without pretty-printing in the way.
Device Discovery Commands
list
Lists every connected Pico de Gallo device the host can see.
$ gallo list
Serial Number Bus Address
E6633861A34B8C24 2 14
version
Queries the connected board for its firmware version.
$ gallo version
Firmware version: 0.1.0
Peripheral Command Groups
i2c
| Subcommand | Purpose |
|---|---|
scan | Probe the bus for responding addresses |
read | Read bytes from one target address |
write | Write bytes to one target address |
write-read | Write first, then read from the same target without releasing the bus |
set-config | Set the I2C frequency |
get-config | Show the active I2C frequency |
batch | Execute several I2C operations in one USB transfer |
See the I2C chapter and Transaction Batching for examples.
spi
| Subcommand | Purpose |
|---|---|
read | Clock in bytes |
write | Clock out bytes |
transfer | Full-duplex SPI transfer |
write-read | Half-duplex write followed by read |
set-config | Set frequency, phase, and polarity |
get-config | Show the active SPI configuration |
batch | Run atomic multi-step SPI transactions under chip-select |
See the SPI chapter and Transaction Batching.
gpio
| Subcommand | Purpose |
|---|---|
get | Read the current level of a pin |
put | Drive a pin high or low |
set-config | Set direction and pull resistor |
monitor | Subscribe to edge events until you stop the process |
See the GPIO chapter.
uart
| Subcommand | Purpose |
|---|---|
read | Read bytes with a timeout |
write | Write raw bytes |
flush | Wait for the transmit buffer to drain |
set-config | Set baud rate |
get-config | Show the active UART configuration |
See the UART chapter.
pwm
| Subcommand | Purpose |
|---|---|
set-duty | Set a raw duty-cycle value |
get-duty | Read current and maximum duty |
enable | Enable the slice behind a channel |
disable | Disable the slice behind a channel |
set-config | Set frequency and phase-correct mode |
get-config | Show the active PWM configuration |
See the PWM chapter.
adc
| Subcommand | Purpose |
|---|---|
read | Read one ADC sample |
info | Show ADC resolution, reference, and channel count |
See the ADC chapter.
onewire
| Subcommand | Purpose |
|---|---|
reset | Reset the bus and report presence |
read | Read raw bytes |
write | Write raw bytes |
write-pullup | Write, then hold the line high for parasitic-power devices |
search | Enumerate ROM IDs on the bus |
See the 1-Wire chapter.
A Few Crisp Examples
$ gallo i2c get-config
$ gallo spi get-config
$ gallo uart set-config --baud-rate 115200
$ gallo gpio monitor --pin 0 --edge rising
$ gallo adc read --channel 0
$ gallo onewire search
That is the right mental model for gallo: short commands, explicit arguments,
and results you can immediately paste into a shell script or lab notebook.