Rename framebuf
This commit is contained in:
parent
f004aa3514
commit
a69a864dca
@ -21,6 +21,13 @@ const ROWS: usize = 320;
|
|||||||
const COLUMNS: usize = 170;
|
const COLUMNS: usize = 170;
|
||||||
const FRAMEBUF: usize = ROWS * COLUMNS * 3;
|
const FRAMEBUF: usize = ROWS * COLUMNS * 3;
|
||||||
|
|
||||||
|
/*
|
||||||
|
struct Frame {
|
||||||
|
columns: usize,
|
||||||
|
buf: [u8; FRAMEBUF],
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
struct Step {
|
struct Step {
|
||||||
param_cnt: usize,
|
param_cnt: usize,
|
||||||
command: u8,
|
command: u8,
|
||||||
@ -220,7 +227,13 @@ unsafe fn main() -> ! {
|
|||||||
|
|
||||||
timer.delay_ms(1000);
|
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;
|
let mut strength = 0;
|
||||||
loop {
|
loop {
|
||||||
@ -229,12 +242,12 @@ unsafe fn main() -> ! {
|
|||||||
let _ = data_command.set_low();
|
let _ = data_command.set_low();
|
||||||
let _ = spi.write(&[RAMWR]);
|
let _ = spi.write(&[RAMWR]);
|
||||||
let _ = data_command.set_high();
|
let _ = data_command.set_high();
|
||||||
let _ = spi.write(&framebuf);
|
let _ = spi.write(&frame);
|
||||||
let _ = board_select.set_high();
|
let _ = board_select.set_high();
|
||||||
|
|
||||||
for x in 80..90 {
|
for x in 80..90 {
|
||||||
for y in 155..165 {
|
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 + 0] = color.0 << 2;
|
||||||
framebuf[(y * COLUMNS + x) * 3 + 1] = color.1 << 2;
|
framebuf[(y * COLUMNS + x) * 3 + 1] = color.1 << 2;
|
||||||
framebuf[(y * COLUMNS + x) * 3 + 2] = color.2 << 2;
|
framebuf[(y * COLUMNS + x) * 3 + 2] = color.2 << 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user