Obtain serial device path from cli arg, enable LTO for release builds
This commit is contained in:
parent
f9a4b88222
commit
2e7e91cc58
2 changed files with 14 additions and 1 deletions
|
@ -3,6 +3,9 @@ name = "kulifuli-host"
|
|||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
||||
[dependencies]
|
||||
eyre = "0.6.12"
|
||||
serialport = "4.7.2"
|
||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -1,11 +1,21 @@
|
|||
use eyre::{Result, bail, ensure, eyre};
|
||||
use serialport::TTYPort;
|
||||
use std::env::args;
|
||||
use std::io::{Read, Write, stdin, stdout};
|
||||
use std::process::exit;
|
||||
use std::str::FromStr;
|
||||
use std::time::Duration;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut port = serialport::new("/dev/ttyACM0", 9600)
|
||||
let args = args().collect::<Vec<_>>();
|
||||
let serial_device = args.get(1);
|
||||
if serial_device.is_none() {
|
||||
println!("Please give a serial device path as program argument");
|
||||
exit(1);
|
||||
}
|
||||
let serial_device = serial_device.unwrap();
|
||||
|
||||
let mut port = serialport::new(serial_device, 9600)
|
||||
.timeout(Duration::from_secs(3600))
|
||||
.open_native()?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue