Remove Dpad stuff for now
This commit is contained in:
37
src/dpad.rs
37
src/dpad.rs
@@ -1,37 +0,0 @@
|
||||
use rp2040_hal::gpio::{Pin, DynPinId, FunctionSioInput, PullUp};
|
||||
use embedded_hal::digital::InputPin;
|
||||
|
||||
pub struct Dpad {
|
||||
pinarray: [Pin<DynPinId, FunctionSioInput, PullUp>; 4]
|
||||
}
|
||||
|
||||
impl Dpad {
|
||||
|
||||
// expects pins clockwise starting from top
|
||||
pub fn new(pinarray: [Pin<DynPinId, FunctionSioInput, PullUp>; 4]) -> Self {
|
||||
Self {
|
||||
pinarray
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_state(&mut self) -> DpadState {
|
||||
let up = self.pinarray[0].is_low().unwrap();
|
||||
let right = self.pinarray[1].is_low().unwrap();
|
||||
let down = self.pinarray[2].is_low().unwrap();
|
||||
let left = self.pinarray[3].is_low().unwrap();
|
||||
|
||||
DpadState {
|
||||
up,
|
||||
down,
|
||||
left,
|
||||
right
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct DpadState {
|
||||
pub up: bool,
|
||||
pub down: bool,
|
||||
pub left: bool,
|
||||
pub right: bool
|
||||
}
|
||||
@@ -115,8 +115,6 @@ fn main() -> ! {
|
||||
sprites[0].y = 30;
|
||||
sprites[0].visible = true;
|
||||
|
||||
let mut scanline = 0u8;
|
||||
|
||||
loop {
|
||||
|
||||
gfx_buf.iter_mut().for_each(|x| *x = 0);
|
||||
@@ -131,18 +129,13 @@ fn main() -> ! {
|
||||
|
||||
sprite_atlas.draw_textfield(10, 20, 110, 10, "I think this font has a *lot* of 'character'! ;)", &mut gfx_buf);
|
||||
|
||||
draw_bresenham_line(0, scanline, 128, scanline, &mut gfx_buf);
|
||||
draw_bresenham_line(0, 64, 127, 64, &mut gfx_buf);
|
||||
draw_bresenham_line(0, 0, 127, 0, &mut gfx_buf);
|
||||
draw_bresenham_line(0, 63, 128, 63, &mut gfx_buf);
|
||||
draw_bresenham_line(0, 0, 0, 63, &mut gfx_buf);
|
||||
draw_bresenham_line(127, 0, 127, 63, &mut gfx_buf);
|
||||
blit_framebuffer(&mut i2c, &gfx_buf);
|
||||
|
||||
delay.delay_ms(1);
|
||||
// scanline += 1;
|
||||
// if scanline >= 64 {
|
||||
// scanline = 0;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user