Arduino-Pedal-Effects/rust/src/main.rs

32 lines
788 B
Rust
Raw Normal View History

2022-07-18 16:23:07 +00:00
#![no_std]
#![no_main]
use arduino_hal::{delay_ms, pins, Peripherals};
use core::panic::PanicInfo;
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
// disable interrupts - firmware has panicked so no ISRs should continue running
avr_device::interrupt::disable();
// get the peripherals so we can access serial and the LED.
//
// SAFETY: Because main() already has references to the peripherals this is an unsafe
// operation - but because no other code can run after the panic handler was called,
// we know it is okay.
let dp = unsafe { Peripherals::steal() };
let pins = pins!(dp);
let mut led = pins.d13.into_output();
loop {
led.toggle();
delay_ms(500);
}
}
#[arduino_hal::entry]
fn main() -> ! {
loop {}
}