Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

binary is 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

SubcommandPurpose
scanProbe the bus for responding addresses
readRead bytes from one target address
writeWrite bytes to one target address
write-readWrite first, then read from the same target without releasing the bus
set-configSet the I2C frequency
get-configShow the active I2C frequency
batchExecute several I2C operations in one USB transfer

See the I2C chapter and Transaction Batching for examples.

spi

SubcommandPurpose
readClock in bytes
writeClock out bytes
transferFull-duplex SPI transfer
write-readHalf-duplex write followed by read
set-configSet frequency, phase, and polarity
get-configShow the active SPI configuration
batchRun atomic multi-step SPI transactions under chip-select

See the SPI chapter and Transaction Batching.

gpio

SubcommandPurpose
getRead the current level of a pin
putDrive a pin high or low
set-configSet direction and pull resistor
monitorSubscribe to edge events until you stop the process

See the GPIO chapter.

uart

SubcommandPurpose
readRead bytes with a timeout
writeWrite raw bytes
flushWait for the transmit buffer to drain
set-configSet baud rate
get-configShow the active UART configuration

See the UART chapter.

pwm

SubcommandPurpose
set-dutySet a raw duty-cycle value
get-dutyRead current and maximum duty
enableEnable the slice behind a channel
disableDisable the slice behind a channel
set-configSet frequency and phase-correct mode
get-configShow the active PWM configuration

See the PWM chapter.

adc

SubcommandPurpose
readRead one ADC sample
infoShow ADC resolution, reference, and channel count

See the ADC chapter.

onewire

SubcommandPurpose
resetReset the bus and report presence
readRead raw bytes
writeWrite raw bytes
write-pullupWrite, then hold the line high for parasitic-power devices
searchEnumerate 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.