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

Function brightness_cmd

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

Source from the content-addressed store, hash-verified

471}
472
473fn brightness_cmd(serialdev: &str, arg: Option<u8>) {
474 let mut port = serialport::new(serialdev, 115_200)
475 .timeout(SERIAL_TIMEOUT)
476 .open()
477 .expect("Failed to open port");
478
479 if let Some(brightness) = arg {
480 simple_cmd_port(&mut port, Command::Brightness, &[brightness]);
481 } else {
482 simple_cmd_port(&mut port, Command::Brightness, &[]);
483
484 let mut response: Vec<u8> = vec![0; 32];
485 port.read_exact(response.as_mut_slice())
486 .expect("Found no data!");
487
488 let brightness: u8 = response[0];
489 println!("Current brightness: {brightness}");
490 }
491}
492
493fn animate_cmd(serialdev: &str, arg: Option<bool>) {
494 let mut port = serialport::new(serialdev, 115_200)

Callers 1

serial_commandsFunction · 0.85

Calls 1

simple_cmd_portFunction · 0.85

Tested by

no test coverage detected