#![no_std] #![no_main] #![feature(abi_avr_interrupt)] mod setup; use arduino_hal::{delay_ms, pins, Peripherals}; use core::panic::PanicInfo; use setup::Setup; #[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() -> ! { let mut setup = Setup::default(); loop { fuzz(&setup); if setup.led.is_set_high() { setup.led.set_low(); } else { setup.led.set_high(); } delay_ms(250); } } fn fuzz(setup: &Setup<'_>) {} #[avr_device::interrupt(atmega328p)] #[allow(non_snake_case)] fn TIMER1_COMPA() {}