Very cool, started yesterday and I can already talk to my #FPGA :-)
sudo target/debug/tior open /dev/ttyUSB0
Hello World!
init SPI
status: 0x0000000000000025
status: 0x0000000000000025
SPI initialized!
initializing SD...
SD command cmd0 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
SD command cmd41 response : 01
SD command cmd55 response : 01
Serial TTY sessions are working now. The next stop is #zmodem:
target/debug/tior
Connect to serial port
Usage: tior [OPTIONS] <COMMAND>
Commands:
open Open TTY
list List available devices
help Print this message or the help of the given subcommand(s)
Options:
-s, --speed <SPEED> Line speed [default: 115200]
-d, --data-bits <DATA_BITS> Line data bits [default: 8]
-f, --flow-control <FLOW_CONTROL> Flow control [default: none] [possible values: none, software, hardware]
-p, --parity <PARITY> Parity [default: none] [possible values: none, odd, even]
-h, --help Print help
-V, --version Print version
The binary is about 5.8 MiB after the strip, not too bad.
This feels a glitch but works:
impl Drop for Main {
fn drop(&mut self) {
eprintln!("end\n");
terminal::disable_raw_mode().expect("terminal::disable_raw_mode()");
}
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let _main = Main;
I wonder if there is a leaner pattern. This is pretty good Rust exercise/refresher project as you have input handling, command-line arguments, streaming, interactive i/o and file transfer later on. All basics of most system software. And nothing too fancy so that the project does not blow up out of proportions. #rustlang