1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
#[doc = r"Enumeration of all the interrupts."] #[derive(Copy, Clone, Debug, PartialEq, Eq)] #[repr(u16)] pub enum Interrupt { #[doc = "0 - External Pin,Power-on Reset,Brown-out Reset,Watchdog Reset,and JTAG AVR Reset. See Datasheet."] RESET = 0, #[doc = "1 - External Interrupt Request 0"] INT0 = 1, #[doc = "2 - External Interrupt Request 1"] INT1 = 2, #[doc = "3 - External Interrupt Request 2"] INT2 = 3, #[doc = "4 - External Interrupt Request 3"] INT3 = 4, #[doc = "5 - External Interrupt Request 4"] INT4 = 5, #[doc = "6 - External Interrupt Request 5"] INT5 = 6, #[doc = "7 - External Interrupt Request 6"] INT6 = 7, #[doc = "8 - External Interrupt Request 7"] INT7 = 8, #[doc = "9 - Pin Change Interrupt Request 0"] PCINT0 = 9, #[doc = "10 - Pin Change Interrupt Request 1"] PCINT1 = 10, #[doc = "11 - USB General Interrupt Request"] USB_GEN = 11, #[doc = "12 - USB Endpoint/Pipe Interrupt Communication Request"] USB_COM = 12, #[doc = "13 - Watchdog Time-out Interrupt"] WDT = 13, #[doc = "14 - Timer/Counter2 Capture Event"] TIMER1_CAPT = 14, #[doc = "15 - Timer/Counter2 Compare Match B"] TIMER1_COMPA = 15, #[doc = "16 - Timer/Counter2 Compare Match B"] TIMER1_COMPB = 16, #[doc = "17 - Timer/Counter2 Compare Match C"] TIMER1_COMPC = 17, #[doc = "18 - Timer/Counter1 Overflow"] TIMER1_OVF = 18, #[doc = "19 - Timer/Counter0 Compare Match A"] TIMER0_COMPA = 19, #[doc = "20 - Timer/Counter0 Compare Match B"] TIMER0_COMPB = 20, #[doc = "21 - Timer/Counter0 Overflow"] TIMER0_OVF = 21, #[doc = "22 - SPI Serial Transfer Complete"] SPI_STC = 22, #[doc = "23 - USART1, Rx Complete"] USART1_RX = 23, #[doc = "24 - USART1 Data register Empty"] USART1_UDRE = 24, #[doc = "25 - USART1, Tx Complete"] USART1_TX = 25, #[doc = "26 - Analog Comparator"] ANALOG_COMP = 26, #[doc = "27 - EEPROM Ready"] EE_READY = 27, #[doc = "28 - Store Program Memory Read"] SPM_READY = 28, } #[derive(Debug, Copy, Clone)] pub struct TryFromInterruptError(()); impl Interrupt { #[inline] pub fn try_from(value: u8) -> Result<Self, TryFromInterruptError> { match value { 0 => Ok(Interrupt::RESET), 1 => Ok(Interrupt::INT0), 2 => Ok(Interrupt::INT1), 3 => Ok(Interrupt::INT2), 4 => Ok(Interrupt::INT3), 5 => Ok(Interrupt::INT4), 6 => Ok(Interrupt::INT5), 7 => Ok(Interrupt::INT6), 8 => Ok(Interrupt::INT7), 9 => Ok(Interrupt::PCINT0), 10 => Ok(Interrupt::PCINT1), 11 => Ok(Interrupt::USB_GEN), 12 => Ok(Interrupt::USB_COM), 13 => Ok(Interrupt::WDT), 14 => Ok(Interrupt::TIMER1_CAPT), 15 => Ok(Interrupt::TIMER1_COMPA), 16 => Ok(Interrupt::TIMER1_COMPB), 17 => Ok(Interrupt::TIMER1_COMPC), 18 => Ok(Interrupt::TIMER1_OVF), 19 => Ok(Interrupt::TIMER0_COMPA), 20 => Ok(Interrupt::TIMER0_COMPB), 21 => Ok(Interrupt::TIMER0_OVF), 22 => Ok(Interrupt::SPI_STC), 23 => Ok(Interrupt::USART1_RX), 24 => Ok(Interrupt::USART1_UDRE), 25 => Ok(Interrupt::USART1_TX), 26 => Ok(Interrupt::ANALOG_COMP), 27 => Ok(Interrupt::EE_READY), 28 => Ok(Interrupt::SPM_READY), _ => Err(TryFromInterruptError(())), } } }