diff --git a/arduino/src/buttons.rs b/arduino/src/buttons.rs index 0057352..c6ccdba 100644 --- a/arduino/src/buttons.rs +++ b/arduino/src/buttons.rs @@ -6,7 +6,6 @@ use arduino_hal::{ }, }; -pub const BUTTON_COUNT: usize = 8; // pub const DEBOUNCE_DELAY: u64 = 50; pub struct Button { diff --git a/arduino/src/main.rs b/arduino/src/main.rs index 0e2d7b0..f022987 100644 --- a/arduino/src/main.rs +++ b/arduino/src/main.rs @@ -5,8 +5,8 @@ mod buttons; use core::panic::PanicInfo; -use arduino_hal::{default_serial, delay_ms, pins, Peripherals}; -use buttons::{Button, BUTTON_COUNT}; +use arduino_hal::{default_serial, pins, Peripherals}; +use buttons::Button; const MESSAGE_START: char = '<'; const MESSAGE_END: char = '>'; @@ -24,12 +24,9 @@ fn panic(_info: &PanicInfo) -> ! { let dp = unsafe { Peripherals::steal() }; let pins = pins!(dp); - let mut led = pins.d13.into_output(); + pins.d13.into_output().set_high(); - loop { - led.toggle(); - delay_ms(500); - } + loop {} } #[arduino_hal::entry] @@ -37,9 +34,9 @@ fn main() -> ! { let dp = Peripherals::take().unwrap(); let pins = pins!(dp); - pins.d13.into_output().set_high(); + pins.d13.into_output().set_low(); - let mut buttons: [Button; BUTTON_COUNT] = [ + let mut buttons = [ Button::new(1, pins.d5.into_pull_up_input().downgrade()), Button::new(2, pins.d6.into_pull_up_input().downgrade()), Button::new(3, pins.d7.into_pull_up_input().downgrade()),