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])
| 757 | /// Display 9 values in equalizer diagram starting from the middle, going up and down |
| 758 | /// TODO: Implement a commandline parameter for this |
| 759 | fn 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 |
no test coverage detected