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

Function draw

fl16-inputmodules/src/patterns.rs:28–46  ·  view source on GitHub ↗
(bytes: &[u8; DRAW_BYTES])

Source from the content-addressed store, hash-verified

26>;
27
28pub fn draw(bytes: &[u8; DRAW_BYTES]) -> Grid {
29 let mut grid = Grid::default();
30
31 for y in 0..HEIGHT {
32 for x in 0..WIDTH {
33 let index = x + WIDTH * y;
34 let byte = index / 8;
35 let bit = index % 8;
36 let val = if bytes[byte] & (1 << bit) > 0 {
37 0xFF
38 } else {
39 0x00
40 };
41 grid.0[8 - x][y] = val;
42 }
43 }
44
45 grid
46}
47
48pub fn draw_grey_col(grid: &mut Grid, col: u8, levels: &[u8; HEIGHT]) {
49 // TODO: I don't think I need the [..HEIGHT] slicing

Callers 1

handle_commandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected