avr_device/devices/attiny85/
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"]
6 RESET = 0,
7 #[doc = "1 - External Interrupt 0"]
8 INT0 = 1,
9 #[doc = "2 - Pin change Interrupt Request 0"]
10 PCINT0 = 2,
11 #[doc = "3 - Timer/Counter1 Compare Match 1A"]
12 TIMER1_COMPA = 3,
13 #[doc = "4 - Timer/Counter1 Overflow"]
14 TIMER1_OVF = 4,
15 #[doc = "5 - Timer/Counter0 Overflow"]
16 TIMER0_OVF = 5,
17 #[doc = "6 - EEPROM Ready"]
18 EE_RDY = 6,
19 #[doc = "7 - Analog comparator"]
20 ANA_COMP = 7,
21 #[doc = "8 - ADC Conversion ready"]
22 ADC = 8,
23 #[doc = "9 - Timer/Counter1 Compare Match B"]
24 TIMER1_COMPB = 9,
25 #[doc = "10 - Timer/Counter0 Compare Match A"]
26 TIMER0_COMPA = 10,
27 #[doc = "11 - Timer/Counter0 Compare Match B"]
28 TIMER0_COMPB = 11,
29 #[doc = "12 - Watchdog Time-out"]
30 WDT = 12,
31 #[doc = "13 - USI START"]
32 USI_START = 13,
33 #[doc = "14 - USI Overflow"]
34 USI_OVF = 14,
35}
36#[doc = r" TryFromInterruptError"]
37#[derive(Debug, Copy, Clone)]
38pub struct TryFromInterruptError(());
39impl Interrupt {
40 #[doc = r" Attempt to convert a given value into an `Interrupt`"]
41 #[inline]
42 pub fn try_from(value: u8) -> Result<Self, TryFromInterruptError> {
43 match value {
44 0 => Ok(Interrupt::RESET),
45 1 => Ok(Interrupt::INT0),
46 2 => Ok(Interrupt::PCINT0),
47 3 => Ok(Interrupt::TIMER1_COMPA),
48 4 => Ok(Interrupt::TIMER1_OVF),
49 5 => Ok(Interrupt::TIMER0_OVF),
50 6 => Ok(Interrupt::EE_RDY),
51 7 => Ok(Interrupt::ANA_COMP),
52 8 => Ok(Interrupt::ADC),
53 9 => Ok(Interrupt::TIMER1_COMPB),
54 10 => Ok(Interrupt::TIMER0_COMPA),
55 11 => Ok(Interrupt::TIMER0_COMPB),
56 12 => Ok(Interrupt::WDT),
57 13 => Ok(Interrupt::USI_START),
58 14 => Ok(Interrupt::USI_OVF),
59 _ => Err(TryFromInterruptError(())),
60 }
61 }
62}