avr_device/devices/atmega2560/
interrupt.rs

1#[doc = r"Enumeration of all the interrupts."]
2#[derive(Copy, Clone, Debug, PartialEq, Eq)]
3#[repr(u16)]
4pub enum Interrupt {
5    #[doc = "0 - External Pin,Power-on Reset,Brown-out Reset,Watchdog Reset,and JTAG AVR Reset. See Datasheet."]
6    RESET = 0,
7    #[doc = "1 - External Interrupt Request 0"]
8    INT0 = 1,
9    #[doc = "2 - External Interrupt Request 1"]
10    INT1 = 2,
11    #[doc = "3 - External Interrupt Request 2"]
12    INT2 = 3,
13    #[doc = "4 - External Interrupt Request 3"]
14    INT3 = 4,
15    #[doc = "5 - External Interrupt Request 4"]
16    INT4 = 5,
17    #[doc = "6 - External Interrupt Request 5"]
18    INT5 = 6,
19    #[doc = "7 - External Interrupt Request 6"]
20    INT6 = 7,
21    #[doc = "8 - External Interrupt Request 7"]
22    INT7 = 8,
23    #[doc = "9 - Pin Change Interrupt Request 0"]
24    PCINT0 = 9,
25    #[doc = "10 - Pin Change Interrupt Request 1"]
26    PCINT1 = 10,
27    #[doc = "11 - Pin Change Interrupt Request 2"]
28    PCINT2 = 11,
29    #[doc = "12 - Watchdog Time-out Interrupt"]
30    WDT = 12,
31    #[doc = "13 - Timer/Counter2 Compare Match A"]
32    TIMER2_COMPA = 13,
33    #[doc = "14 - Timer/Counter2 Compare Match B"]
34    TIMER2_COMPB = 14,
35    #[doc = "15 - Timer/Counter2 Overflow"]
36    TIMER2_OVF = 15,
37    #[doc = "16 - Timer/Counter1 Capture Event"]
38    TIMER1_CAPT = 16,
39    #[doc = "17 - Timer/Counter1 Compare Match A"]
40    TIMER1_COMPA = 17,
41    #[doc = "18 - Timer/Counter1 Compare Match B"]
42    TIMER1_COMPB = 18,
43    #[doc = "19 - Timer/Counter1 Compare Match C"]
44    TIMER1_COMPC = 19,
45    #[doc = "20 - Timer/Counter1 Overflow"]
46    TIMER1_OVF = 20,
47    #[doc = "21 - Timer/Counter0 Compare Match A"]
48    TIMER0_COMPA = 21,
49    #[doc = "22 - Timer/Counter0 Compare Match B"]
50    TIMER0_COMPB = 22,
51    #[doc = "23 - Timer/Counter0 Overflow"]
52    TIMER0_OVF = 23,
53    #[doc = "24 - SPI Serial Transfer Complete"]
54    SPI_STC = 24,
55    #[doc = "25 - USART0, Rx Complete"]
56    USART0_RX = 25,
57    #[doc = "26 - USART0 Data register Empty"]
58    USART0_UDRE = 26,
59    #[doc = "27 - USART0, Tx Complete"]
60    USART0_TX = 27,
61    #[doc = "28 - Analog Comparator"]
62    ANALOG_COMP = 28,
63    #[doc = "29 - ADC Conversion Complete"]
64    ADC = 29,
65    #[doc = "30 - EEPROM Ready"]
66    EE_READY = 30,
67    #[doc = "31 - Timer/Counter3 Capture Event"]
68    TIMER3_CAPT = 31,
69    #[doc = "32 - Timer/Counter3 Compare Match A"]
70    TIMER3_COMPA = 32,
71    #[doc = "33 - Timer/Counter3 Compare Match B"]
72    TIMER3_COMPB = 33,
73    #[doc = "34 - Timer/Counter3 Compare Match C"]
74    TIMER3_COMPC = 34,
75    #[doc = "35 - Timer/Counter3 Overflow"]
76    TIMER3_OVF = 35,
77    #[doc = "36 - USART1, Rx Complete"]
78    USART1_RX = 36,
79    #[doc = "37 - USART1 Data register Empty"]
80    USART1_UDRE = 37,
81    #[doc = "38 - USART1, Tx Complete"]
82    USART1_TX = 38,
83    #[doc = "39 - 2-wire Serial Interface"]
84    TWI = 39,
85    #[doc = "40 - Store Program Memory Read"]
86    SPM_READY = 40,
87    #[doc = "41 - Timer/Counter4 Capture Event"]
88    TIMER4_CAPT = 41,
89    #[doc = "42 - Timer/Counter4 Compare Match A"]
90    TIMER4_COMPA = 42,
91    #[doc = "43 - Timer/Counter4 Compare Match B"]
92    TIMER4_COMPB = 43,
93    #[doc = "44 - Timer/Counter4 Compare Match C"]
94    TIMER4_COMPC = 44,
95    #[doc = "45 - Timer/Counter4 Overflow"]
96    TIMER4_OVF = 45,
97    #[doc = "46 - Timer/Counter5 Capture Event"]
98    TIMER5_CAPT = 46,
99    #[doc = "47 - Timer/Counter5 Compare Match A"]
100    TIMER5_COMPA = 47,
101    #[doc = "48 - Timer/Counter5 Compare Match B"]
102    TIMER5_COMPB = 48,
103    #[doc = "49 - Timer/Counter5 Compare Match C"]
104    TIMER5_COMPC = 49,
105    #[doc = "50 - Timer/Counter5 Overflow"]
106    TIMER5_OVF = 50,
107    #[doc = "51 - USART2, Rx Complete"]
108    USART2_RX = 51,
109    #[doc = "52 - USART2 Data register Empty"]
110    USART2_UDRE = 52,
111    #[doc = "53 - USART2, Tx Complete"]
112    USART2_TX = 53,
113    #[doc = "54 - USART3, Rx Complete"]
114    USART3_RX = 54,
115    #[doc = "55 - USART3 Data register Empty"]
116    USART3_UDRE = 55,
117    #[doc = "56 - USART3, Tx Complete"]
118    USART3_TX = 56,
119}
120#[doc = r" TryFromInterruptError"]
121#[derive(Debug, Copy, Clone)]
122pub struct TryFromInterruptError(());
123impl Interrupt {
124    #[doc = r" Attempt to convert a given value into an `Interrupt`"]
125    #[inline]
126    pub fn try_from(value: u8) -> Result<Self, TryFromInterruptError> {
127        match value {
128            0 => Ok(Interrupt::RESET),
129            1 => Ok(Interrupt::INT0),
130            2 => Ok(Interrupt::INT1),
131            3 => Ok(Interrupt::INT2),
132            4 => Ok(Interrupt::INT3),
133            5 => Ok(Interrupt::INT4),
134            6 => Ok(Interrupt::INT5),
135            7 => Ok(Interrupt::INT6),
136            8 => Ok(Interrupt::INT7),
137            9 => Ok(Interrupt::PCINT0),
138            10 => Ok(Interrupt::PCINT1),
139            11 => Ok(Interrupt::PCINT2),
140            12 => Ok(Interrupt::WDT),
141            13 => Ok(Interrupt::TIMER2_COMPA),
142            14 => Ok(Interrupt::TIMER2_COMPB),
143            15 => Ok(Interrupt::TIMER2_OVF),
144            16 => Ok(Interrupt::TIMER1_CAPT),
145            17 => Ok(Interrupt::TIMER1_COMPA),
146            18 => Ok(Interrupt::TIMER1_COMPB),
147            19 => Ok(Interrupt::TIMER1_COMPC),
148            20 => Ok(Interrupt::TIMER1_OVF),
149            21 => Ok(Interrupt::TIMER0_COMPA),
150            22 => Ok(Interrupt::TIMER0_COMPB),
151            23 => Ok(Interrupt::TIMER0_OVF),
152            24 => Ok(Interrupt::SPI_STC),
153            25 => Ok(Interrupt::USART0_RX),
154            26 => Ok(Interrupt::USART0_UDRE),
155            27 => Ok(Interrupt::USART0_TX),
156            28 => Ok(Interrupt::ANALOG_COMP),
157            29 => Ok(Interrupt::ADC),
158            30 => Ok(Interrupt::EE_READY),
159            31 => Ok(Interrupt::TIMER3_CAPT),
160            32 => Ok(Interrupt::TIMER3_COMPA),
161            33 => Ok(Interrupt::TIMER3_COMPB),
162            34 => Ok(Interrupt::TIMER3_COMPC),
163            35 => Ok(Interrupt::TIMER3_OVF),
164            36 => Ok(Interrupt::USART1_RX),
165            37 => Ok(Interrupt::USART1_UDRE),
166            38 => Ok(Interrupt::USART1_TX),
167            39 => Ok(Interrupt::TWI),
168            40 => Ok(Interrupt::SPM_READY),
169            41 => Ok(Interrupt::TIMER4_CAPT),
170            42 => Ok(Interrupt::TIMER4_COMPA),
171            43 => Ok(Interrupt::TIMER4_COMPB),
172            44 => Ok(Interrupt::TIMER4_COMPC),
173            45 => Ok(Interrupt::TIMER4_OVF),
174            46 => Ok(Interrupt::TIMER5_CAPT),
175            47 => Ok(Interrupt::TIMER5_COMPA),
176            48 => Ok(Interrupt::TIMER5_COMPB),
177            49 => Ok(Interrupt::TIMER5_COMPC),
178            50 => Ok(Interrupt::TIMER5_OVF),
179            51 => Ok(Interrupt::USART2_RX),
180            52 => Ok(Interrupt::USART2_UDRE),
181            53 => Ok(Interrupt::USART2_TX),
182            54 => Ok(Interrupt::USART3_RX),
183            55 => Ok(Interrupt::USART3_UDRE),
184            56 => Ok(Interrupt::USART3_TX),
185            _ => Err(TryFromInterruptError(())),
186        }
187    }
188}