Skip to content

Commit

Permalink
Grabs port name from command line
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkar598 committed Jun 23, 2024
1 parent 967614c commit eff9018
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ mod process;
mod signal;

use base64::encode;
use std::{
io::{self, Read},
sync::{Arc, Mutex},
time::Duration,
};
use std::{env, io::{self, Read}, sync::{Arc, Mutex}, time::Duration};

#[derive(strum_macros::Display)]
pub enum PollType {
Expand All @@ -32,8 +28,10 @@ pub struct PollData {
}

fn main() {
// Open serial connection on /dev/ttyS2, max baud rate
let port = serialport::new("/dev/ttyS2", 115_200)
let port_name = env::args().nth(1).expect("Port name argument (1) is required");

// Open serial connection on /dev/hvc2, max baud rate
let port = serialport::new(port_name, 115_200)
.timeout(Duration::from_millis(10))
.open();

Expand Down

0 comments on commit eff9018

Please sign in to comment.