v853_pac/uart/
iir.rs

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