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

Function show_font

inputmodule-control/src/inputmodule.rs:820–837  ·  view source on GitHub ↗

Render up to five 5x6 pixel font items

(serialdev: &str, font_items: &[Vec<u8>])

Source from the content-addressed store, hash-verified

818
819/// Render up to five 5x6 pixel font items
820fn show_font(serialdev: &str, font_items: &[Vec<u8>]) {
821 let mut vals: [u8; 39] = [0x00; 39];
822
823 for (digit_i, digit_pixels) in font_items.iter().enumerate() {
824 let offset = digit_i * 7;
825 for pixel_x in 0..5 {
826 for pixel_y in 0..6 {
827 let pixel_value = digit_pixels[pixel_x + pixel_y * 5];
828 let i = (2 + pixel_x) + (9 * (pixel_y + offset));
829 if pixel_value == 1 {
830 vals[i / 8] |= 1 << (i % 8);
831 }
832 }
833 }
834 }
835
836 simple_cmd(serialdev, Command::DisplayBwImage, &vals);
837}
838
839/// Render a list of up to five symbols
840/// Can use letters/numbers or symbol names, like 'sun', ':)'

Callers 2

show_stringFunction · 0.70
show_symbolsFunction · 0.70

Calls 1

simple_cmdFunction · 0.85

Tested by

no test coverage detected