jamesmunns / pretty-hal-machine

Apache License 2.0
59 stars 7 forks source link

Turn `phm-cli` into an actual CLI tool #10

Closed jamesmunns closed 2 years ago

jamesmunns commented 2 years ago

Right now, phm-cli is mostly just a smoke test, used to verify the end-to-end communications.

We should probably add the ability to control the interfaces from a command like or bash script. Maybe something like this:

# Write [0x10, 0x20] to address 0x42
phm-cli i2c write -a 0x42 --write='0x10,0x20'
# ok

# Read three bytes from address 0x42
phm-cli i2c read -a 0x42 --read-ct 3
# [0x10, 0x20, 0x30]

# Write one byte then read four bytes from address 0x42
phm-cli i2c write-read -a 0x42 --write='0x01' --read-ct 4
# [0x10, 0x20, 0x30, 0x40]

This probably means a lot of engineering with the clap crate. In the future, we might want some kind of scripting to do multiple things in sequence? But for now, one command at a time, with basic output, is probably good enough.

We should probably also see if there are existing CLI tools that we could use here to have a consistent API.

hedonhermdev commented 2 years ago

Hi James, can I take up this issue?

jamesmunns commented 2 years ago

Hi @hedonhermdev, that would be excellent! let me know if you need any help. Feel free to also stop by #anachro:matrix.org if you'd like to chat about it first :)