d1_pac/uart/
iir.rs

1#[doc = "Register `iir` reader"]
2pub type R = crate::R<IIR_SPEC>;
3#[doc = "Field `iid` reader - Interrupt ID"]
4pub type IID_R = crate::FieldReader<IID_A>;
5#[doc = "Interrupt ID\n\nValue on reset: 0"]
6#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[repr(u8)]
8pub enum IID_A {
9    #[doc = "0: `0`"]
10    MODEM_STATUS = 0,
11    #[doc = "1: `1`"]
12    NO_INTERRUPT_PENDING = 1,
13    #[doc = "2: `10`"]
14    THR_EMPTY = 2,
15    #[doc = "3: `11`"]
16    RS485_INTERRUPT = 3,
17    #[doc = "4: `100`"]
18    RECEIVED_DATA_AVAILABLE = 4,
19    #[doc = "6: `110`"]
20    RECEIVER_LINE_STATUS = 6,
21    #[doc = "7: `111`"]
22    BUSY_DETECT = 7,
23    #[doc = "12: `1100`"]
24    CHARACTER_TIMEOUT = 12,
25}
26impl From<IID_A> for u8 {
27    #[inline(always)]
28    fn from(variant: IID_A) -> Self {
29        variant as _
30    }
31}
32impl crate::FieldSpec for IID_A {
33    type Ux = u8;
34}
35impl IID_R {
36    #[doc = "Get enumerated values variant"]
37    #[inline(always)]
38    pub const fn variant(&self) -> Option<IID_A> {
39        match self.bits {
40            0 => Some(IID_A::MODEM_STATUS),
41            1 => Some(IID_A::NO_INTERRUPT_PENDING),
42            2 => Some(IID_A::THR_EMPTY),
43            3 => Some(IID_A::RS485_INTERRUPT),
44            4 => Some(IID_A::RECEIVED_DATA_AVAILABLE),
45            6 => Some(IID_A::RECEIVER_LINE_STATUS),
46            7 => Some(IID_A::BUSY_DETECT),
47            12 => Some(IID_A::CHARACTER_TIMEOUT),
48            _ => None,
49        }
50    }
51    #[doc = "`0`"]
52    #[inline(always)]
53    pub fn is_modem_status(&self) -> bool {
54        *self == IID_A::MODEM_STATUS
55    }
56    #[doc = "`1`"]
57    #[inline(always)]
58    pub fn is_no_interrupt_pending(&self) -> bool {
59        *self == IID_A::NO_INTERRUPT_PENDING
60    }
61    #[doc = "`10`"]
62    #[inline(always)]
63    pub fn is_thr_empty(&self) -> bool {
64        *self == IID_A::THR_EMPTY
65    }
66    #[doc = "`11`"]
67    #[inline(always)]
68    pub fn is_rs485_interrupt(&self) -> bool {
69        *self == IID_A::RS485_INTERRUPT
70    }
71    #[doc = "`100`"]
72    #[inline(always)]
73    pub fn is_received_data_available(&self) -> bool {
74        *self == IID_A::RECEIVED_DATA_AVAILABLE
75    }
76    #[doc = "`110`"]
77    #[inline(always)]
78    pub fn is_receiver_line_status(&self) -> bool {
79        *self == IID_A::RECEIVER_LINE_STATUS
80    }
81    #[doc = "`111`"]
82    #[inline(always)]
83    pub fn is_busy_detect(&self) -> bool {
84        *self == IID_A::BUSY_DETECT
85    }
86    #[doc = "`1100`"]
87    #[inline(always)]
88    pub fn is_character_timeout(&self) -> bool {
89        *self == IID_A::CHARACTER_TIMEOUT
90    }
91}
92#[doc = "Field `feflag` reader - FIFOs Enable Flag"]
93pub type FEFLAG_R = crate::FieldReader<FEFLAG_A>;
94#[doc = "FIFOs Enable Flag\n\nValue on reset: 0"]
95#[derive(Clone, Copy, Debug, PartialEq, Eq)]
96#[repr(u8)]
97pub enum FEFLAG_A {
98    #[doc = "0: `0`"]
99    DISABLE = 0,
100    #[doc = "3: `11`"]
101    ENABLE = 3,
102}
103impl From<FEFLAG_A> for u8 {
104    #[inline(always)]
105    fn from(variant: FEFLAG_A) -> Self {
106        variant as _
107    }
108}
109impl crate::FieldSpec for FEFLAG_A {
110    type Ux = u8;
111}
112impl FEFLAG_R {
113    #[doc = "Get enumerated values variant"]
114    #[inline(always)]
115    pub const fn variant(&self) -> Option<FEFLAG_A> {
116        match self.bits {
117            0 => Some(FEFLAG_A::DISABLE),
118            3 => Some(FEFLAG_A::ENABLE),
119            _ => None,
120        }
121    }
122    #[doc = "`0`"]
123    #[inline(always)]
124    pub fn is_disable(&self) -> bool {
125        *self == FEFLAG_A::DISABLE
126    }
127    #[doc = "`11`"]
128    #[inline(always)]
129    pub fn is_enable(&self) -> bool {
130        *self == FEFLAG_A::ENABLE
131    }
132}
133impl R {
134    #[doc = "Bits 0:3 - Interrupt ID"]
135    #[inline(always)]
136    pub fn iid(&self) -> IID_R {
137        IID_R::new((self.bits & 0x0f) as u8)
138    }
139    #[doc = "Bits 6:7 - FIFOs Enable Flag"]
140    #[inline(always)]
141    pub fn feflag(&self) -> FEFLAG_R {
142        FEFLAG_R::new(((self.bits >> 6) & 3) as u8)
143    }
144}
145#[doc = "UART Interrupt Identity Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`iir::R`](R).  See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
146pub struct IIR_SPEC;
147impl crate::RegisterSpec for IIR_SPEC {
148    type Ux = u32;
149}
150#[doc = "`read()` method returns [`iir::R`](R) reader structure"]
151impl crate::Readable for IIR_SPEC {}
152#[doc = "`reset()` method sets iir to value 0"]
153impl crate::Resettable for IIR_SPEC {
154    const RESET_VALUE: Self::Ux = 0;
155}