(serialdev: &str, arg: Option<bool>)
| 491 | } |
| 492 | |
| 493 | fn animate_cmd(serialdev: &str, arg: Option<bool>) { |
| 494 | let mut port = serialport::new(serialdev, 115_200) |
| 495 | .timeout(SERIAL_TIMEOUT) |
| 496 | .open() |
| 497 | .expect("Failed to open port"); |
| 498 | |
| 499 | if let Some(animate) = arg { |
| 500 | simple_cmd_port(&mut port, Command::Animate, &[animate as u8]); |
| 501 | } else { |
| 502 | simple_cmd_port(&mut port, Command::Animate, &[]); |
| 503 | |
| 504 | let mut response: Vec<u8> = vec![0; 32]; |
| 505 | port.read_exact(response.as_mut_slice()) |
| 506 | .expect("Found no data!"); |
| 507 | |
| 508 | let animating = response[0] == 1; |
| 509 | println!("Currently animating: {animating}"); |
| 510 | } |
| 511 | } |
| 512 | |
| 513 | /// Stage greyscale values for a single column. Must be committed with commit_cols() |
| 514 | fn send_col(port: &mut Box<dyn SerialPort>, x: u8, vals: &[u8]) { |
no test coverage detected