diff --git a/pico-st7789/src/main.rs b/pico-st7789/src/main.rs index acc1e3e..61534c4 100644 --- a/pico-st7789/src/main.rs +++ b/pico-st7789/src/main.rs @@ -21,6 +21,13 @@ const ROWS: usize = 320; const COLUMNS: usize = 170; const FRAMEBUF: usize = ROWS * COLUMNS * 3; +/* +struct Frame { + columns: usize, + buf: [u8; FRAMEBUF], +} +*/ + struct Step { param_cnt: usize, command: u8, @@ -220,7 +227,13 @@ unsafe fn main() -> ! { timer.delay_ms(1000); - let mut framebuf: [u8; FRAMEBUF] = [0; FRAMEBUF]; + let mut frame: [u8; FRAMEBUF] = [0; FRAMEBUF]; + /* + let mut frame = Frame { + columns: COLUMNS, + buf: [0; FRAMEBUF], + }; + */ let mut strength = 0; loop { @@ -229,12 +242,12 @@ unsafe fn main() -> ! { let _ = data_command.set_low(); let _ = spi.write(&[RAMWR]); let _ = data_command.set_high(); - let _ = spi.write(&framebuf); + let _ = spi.write(&frame); let _ = board_select.set_high(); for x in 80..90 { for y in 155..165 { - write_pixel(&mut framebuf, x, y, (0, 0, 63)); + write_pixel(&mut frame, x, y, (0, 0, 63)); } } @@ -245,9 +258,8 @@ unsafe fn main() -> ! { } } -fn write_pixel(framebuf: &mut[u8], x: usize, y: usize, color: (u8, u8, u8)) { +fn write_pixel(framebuf: &mut [u8], x: usize, y: usize, color: (u8, u8, u8)) { framebuf[(y * COLUMNS + x) * 3 + 0] = color.0 << 2; framebuf[(y * COLUMNS + x) * 3 + 1] = color.1 << 2; framebuf[(y * COLUMNS + x) * 3 + 2] = color.2 << 2; } -