Get a dummy keyboard working

This commit is contained in:
2023-03-05 21:16:59 +01:00
parent 83af700325
commit 06a47b7a2c
13 changed files with 1782 additions and 156 deletions

25
src/led.rs Normal file
View File

@ -0,0 +1,25 @@
use adafruit_itsy_bitsy_rp2040::hal::gpio::{Output, Pin, PinId, PushPull};
use cortex_m::delay::Delay;
use embedded_hal::digital::v2::OutputPin;
pub struct Led<I: PinId> {
pub pin: Pin<I, Output<PushPull>>,
}
pub struct Blink {
ms: u32,
}
pub const SHORT: Blink = Blink { ms: 200 };
pub const LONG: Blink = Blink { ms: 600 };
impl<I: PinId> Led<I> {
pub fn dance(&mut self, delay: &mut Delay, moves: &[Blink]) {
for m in moves {
self.pin.set_high().unwrap();
delay.delay_ms(m.ms);
self.pin.set_low().unwrap();
delay.delay_ms(100);
}
}
}