use core::panic::PanicInfo; use arduino_hal::{delay_ms, hal::pins, Peripherals}; use embedded_hal::digital::{OutputPin, StatefulOutputPin}; #[panic_handler] pub unsafe fn panic(_info: &PanicInfo) -> ! { let dp = Peripherals::steal(); let pins = pins!(dp); let mut rx_led = pins.pb0.into_output(); rx_led.set_low(); let panic_reason = _info.message().as_str(); match panic_reason { Some("1") => loop { rx_led.toggle(); delay_ms(500); }, Some("2") => loop { rx_led.toggle(); delay_ms(100); rx_led.toggle(); delay_ms(100); rx_led.toggle(); delay_ms(750); rx_led.toggle(); delay_ms(100); }, _ => loop { rx_led.toggle(); delay_ms(4000); }, } }