Improve error state
This commit is contained in:
parent
857840e3bf
commit
4ffffdeec1
2 changed files with 6 additions and 10 deletions
|
@ -6,7 +6,6 @@ use arduino_hal::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const BUTTON_COUNT: usize = 8;
|
|
||||||
// pub const DEBOUNCE_DELAY: u64 = 50;
|
// pub const DEBOUNCE_DELAY: u64 = 50;
|
||||||
|
|
||||||
pub struct Button {
|
pub struct Button {
|
||||||
|
|
|
@ -5,8 +5,8 @@ mod buttons;
|
||||||
|
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
use arduino_hal::{default_serial, delay_ms, pins, Peripherals};
|
use arduino_hal::{default_serial, pins, Peripherals};
|
||||||
use buttons::{Button, BUTTON_COUNT};
|
use buttons::Button;
|
||||||
|
|
||||||
const MESSAGE_START: char = '<';
|
const MESSAGE_START: char = '<';
|
||||||
const MESSAGE_END: char = '>';
|
const MESSAGE_END: char = '>';
|
||||||
|
@ -24,12 +24,9 @@ fn panic(_info: &PanicInfo) -> ! {
|
||||||
let dp = unsafe { Peripherals::steal() };
|
let dp = unsafe { Peripherals::steal() };
|
||||||
let pins = pins!(dp);
|
let pins = pins!(dp);
|
||||||
|
|
||||||
let mut led = pins.d13.into_output();
|
pins.d13.into_output().set_high();
|
||||||
|
|
||||||
loop {
|
loop {}
|
||||||
led.toggle();
|
|
||||||
delay_ms(500);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[arduino_hal::entry]
|
#[arduino_hal::entry]
|
||||||
|
@ -37,9 +34,9 @@ fn main() -> ! {
|
||||||
let dp = Peripherals::take().unwrap();
|
let dp = Peripherals::take().unwrap();
|
||||||
let pins = pins!(dp);
|
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(1, pins.d5.into_pull_up_input().downgrade()),
|
||||||
Button::new(2, pins.d6.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()),
|
Button::new(3, pins.d7.into_pull_up_input().downgrade()),
|
||||||
|
|
Loading…
Reference in a new issue