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

Function double_gradient

fl16-inputmodules/src/patterns.rs:292–306  ·  view source on GitHub ↗

Double sided gradient, bright in the middle, dim top and bottom

()

Source from the content-addressed store, hash-verified

290
291/// Double sided gradient, bright in the middle, dim top and bottom
292pub fn double_gradient() -> Grid {
293 let gradient_drop = 1; // Brightness drop between rows
294 let mut grid = Grid::default();
295 for y in 0..(HEIGHT / 2) {
296 for x in 0..WIDTH {
297 grid.0[x][y] = (gradient_drop * (y + 1)) as u8;
298 }
299 }
300 for y in (HEIGHT / 2)..HEIGHT {
301 for x in 0..WIDTH {
302 grid.0[x][y] = (HEIGHT - gradient_drop * (y + 1)) as u8;
303 }
304 }
305 grid
306}
307
308/// Same as fill_grid_pixels but does each pixel individually
309/// So it's much slower because it has to send 306 I2C commands

Callers 1

handle_commandFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected