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

Function eq_cmd

inputmodule-control/src/inputmodule.rs:759–777  ·  view source on GitHub ↗

Display 9 values in equalizer diagram starting from the middle, going up and down TODO: Implement a commandline parameter for this

(serialdev: &str, vals: &[u8])

Source from the content-addressed store, hash-verified

757/// Display 9 values in equalizer diagram starting from the middle, going up and down
758/// TODO: Implement a commandline parameter for this
759fn eq_cmd(serialdev: &str, vals: &[u8]) {
760 assert!(vals.len() <= WIDTH);
761 let mut matrix: [[Brightness; 34]; 9] = [[0; 34]; 9];
762
763 for (col, val) in vals[..9].iter().enumerate() {
764 let row: usize = 34 / 2;
765 let above: usize = (*val as usize) / 2;
766 let below = (*val as usize) - above;
767
768 for i in 0..above {
769 matrix[col][row + i] = 0xFF; // Set this LED to full brightness
770 }
771 for i in 0..below {
772 matrix[col][row - 1 - i] = 0xFF; // Set this LED to full brightness
773 }
774 }
775
776 render_matrix(serialdev, &matrix);
777}
778
779/// Show a black/white matrix
780/// Send everything in a single command

Callers 3

serial_commandsFunction · 0.85
random_eq_cmdFunction · 0.85
input_eq_cmdFunction · 0.85

Calls 1

render_matrixFunction · 0.70

Tested by

no test coverage detected