MCPcopy Index your code
hub / github.com/FrameworkComputer/inputmodule-rs / animate_cmd

Function animate_cmd

inputmodule-control/src/inputmodule.rs:493–511  ·  view source on GitHub ↗
(serialdev: &str, arg: Option<bool>)

Source from the content-addressed store, hash-verified

491}
492
493fn 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()
514fn send_col(port: &mut Box<dyn SerialPort>, x: u8, vals: &[u8]) {

Callers 1

serial_commandsFunction · 0.85

Calls 1

simple_cmd_portFunction · 0.85

Tested by

no test coverage detected