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

Function debug_mode_cmd

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

Source from the content-addressed store, hash-verified

451}
452
453fn debug_mode_cmd(serialdev: &str, arg: Option<bool>) {
454 let mut port = serialport::new(serialdev, 115_200)
455 .timeout(SERIAL_TIMEOUT)
456 .open()
457 .expect("Failed to open port");
458
459 if let Some(enable_debug) = arg {
460 simple_cmd_port(&mut port, Command::DebugMode, &[u8::from(enable_debug)]);
461 } else {
462 simple_cmd_port(&mut port, Command::DebugMode, &[]);
463
464 let mut response: Vec<u8> = vec![0; 32];
465 port.read_exact(response.as_mut_slice())
466 .expect("Found no data!");
467
468 let debug_mode: bool = response[0] == 1;
469 println!("Debug Mode enabled: {debug_mode}");
470 }
471}
472
473fn brightness_cmd(serialdev: &str, arg: Option<u8>) {
474 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