atsam4lc2b_pac/eic/
imr.rs

1#[doc = "Register `IMR` reader"]
2pub struct R(crate::R<IMR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<IMR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<IMR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<IMR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `NMI` reader - External Non Maskable CPU interrupt"]
17pub type NMI_R = crate::BitReader<bool>;
18#[doc = "Field `INT1` reader - External Interrupt 1"]
19pub type INT1_R = crate::BitReader<INT1SELECT_A>;
20#[doc = "External Interrupt 1\n\nValue on reset: 0"]
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22pub enum INT1SELECT_A {
23    #[doc = "0: Interrupt is disabled"]
24    _0 = 0,
25    #[doc = "1: Interrupt is enabled."]
26    _1 = 1,
27}
28impl From<INT1SELECT_A> for bool {
29    #[inline(always)]
30    fn from(variant: INT1SELECT_A) -> Self {
31        variant as u8 != 0
32    }
33}
34impl INT1_R {
35    #[doc = "Get enumerated values variant"]
36    #[inline(always)]
37    pub fn variant(&self) -> INT1SELECT_A {
38        match self.bits {
39            false => INT1SELECT_A::_0,
40            true => INT1SELECT_A::_1,
41        }
42    }
43    #[doc = "Checks if the value of the field is `_0`"]
44    #[inline(always)]
45    pub fn is_0(&self) -> bool {
46        *self == INT1SELECT_A::_0
47    }
48    #[doc = "Checks if the value of the field is `_1`"]
49    #[inline(always)]
50    pub fn is_1(&self) -> bool {
51        *self == INT1SELECT_A::_1
52    }
53}
54#[doc = "Field `INT2` reader - External Interrupt 2"]
55pub type INT2_R = crate::BitReader<INT2SELECT_A>;
56#[doc = "External Interrupt 2\n\nValue on reset: 0"]
57#[derive(Clone, Copy, Debug, PartialEq, Eq)]
58pub enum INT2SELECT_A {
59    #[doc = "0: Interrupt is disabled"]
60    _0 = 0,
61    #[doc = "1: Interrupt is enabled."]
62    _1 = 1,
63}
64impl From<INT2SELECT_A> for bool {
65    #[inline(always)]
66    fn from(variant: INT2SELECT_A) -> Self {
67        variant as u8 != 0
68    }
69}
70impl INT2_R {
71    #[doc = "Get enumerated values variant"]
72    #[inline(always)]
73    pub fn variant(&self) -> INT2SELECT_A {
74        match self.bits {
75            false => INT2SELECT_A::_0,
76            true => INT2SELECT_A::_1,
77        }
78    }
79    #[doc = "Checks if the value of the field is `_0`"]
80    #[inline(always)]
81    pub fn is_0(&self) -> bool {
82        *self == INT2SELECT_A::_0
83    }
84    #[doc = "Checks if the value of the field is `_1`"]
85    #[inline(always)]
86    pub fn is_1(&self) -> bool {
87        *self == INT2SELECT_A::_1
88    }
89}
90#[doc = "Field `INT3` reader - External Interrupt 3"]
91pub type INT3_R = crate::BitReader<INT3SELECT_A>;
92#[doc = "External Interrupt 3\n\nValue on reset: 0"]
93#[derive(Clone, Copy, Debug, PartialEq, Eq)]
94pub enum INT3SELECT_A {
95    #[doc = "0: Interrupt is disabled"]
96    _0 = 0,
97    #[doc = "1: Interrupt is enabled."]
98    _1 = 1,
99}
100impl From<INT3SELECT_A> for bool {
101    #[inline(always)]
102    fn from(variant: INT3SELECT_A) -> Self {
103        variant as u8 != 0
104    }
105}
106impl INT3_R {
107    #[doc = "Get enumerated values variant"]
108    #[inline(always)]
109    pub fn variant(&self) -> INT3SELECT_A {
110        match self.bits {
111            false => INT3SELECT_A::_0,
112            true => INT3SELECT_A::_1,
113        }
114    }
115    #[doc = "Checks if the value of the field is `_0`"]
116    #[inline(always)]
117    pub fn is_0(&self) -> bool {
118        *self == INT3SELECT_A::_0
119    }
120    #[doc = "Checks if the value of the field is `_1`"]
121    #[inline(always)]
122    pub fn is_1(&self) -> bool {
123        *self == INT3SELECT_A::_1
124    }
125}
126#[doc = "Field `INT4` reader - External Interrupt 4"]
127pub type INT4_R = crate::BitReader<INT4SELECT_A>;
128#[doc = "External Interrupt 4\n\nValue on reset: 0"]
129#[derive(Clone, Copy, Debug, PartialEq, Eq)]
130pub enum INT4SELECT_A {
131    #[doc = "0: Interrupt is disabled"]
132    _0 = 0,
133    #[doc = "1: Interrupt is enabled."]
134    _1 = 1,
135}
136impl From<INT4SELECT_A> for bool {
137    #[inline(always)]
138    fn from(variant: INT4SELECT_A) -> Self {
139        variant as u8 != 0
140    }
141}
142impl INT4_R {
143    #[doc = "Get enumerated values variant"]
144    #[inline(always)]
145    pub fn variant(&self) -> INT4SELECT_A {
146        match self.bits {
147            false => INT4SELECT_A::_0,
148            true => INT4SELECT_A::_1,
149        }
150    }
151    #[doc = "Checks if the value of the field is `_0`"]
152    #[inline(always)]
153    pub fn is_0(&self) -> bool {
154        *self == INT4SELECT_A::_0
155    }
156    #[doc = "Checks if the value of the field is `_1`"]
157    #[inline(always)]
158    pub fn is_1(&self) -> bool {
159        *self == INT4SELECT_A::_1
160    }
161}
162#[doc = "Field `INT5` reader - External Interrupt 5"]
163pub type INT5_R = crate::BitReader<bool>;
164#[doc = "Field `INT6` reader - External Interrupt 6"]
165pub type INT6_R = crate::BitReader<bool>;
166#[doc = "Field `INT7` reader - External Interrupt 7"]
167pub type INT7_R = crate::BitReader<bool>;
168#[doc = "Field `INT8` reader - External Interrupt 8"]
169pub type INT8_R = crate::BitReader<bool>;
170#[doc = "Field `INT9` reader - External Interrupt 9"]
171pub type INT9_R = crate::BitReader<bool>;
172#[doc = "Field `INT10` reader - External Interrupt 10"]
173pub type INT10_R = crate::BitReader<bool>;
174#[doc = "Field `INT11` reader - External Interrupt 11"]
175pub type INT11_R = crate::BitReader<bool>;
176#[doc = "Field `INT12` reader - External Interrupt 12"]
177pub type INT12_R = crate::BitReader<bool>;
178#[doc = "Field `INT13` reader - External Interrupt 13"]
179pub type INT13_R = crate::BitReader<bool>;
180#[doc = "Field `INT14` reader - External Interrupt 14"]
181pub type INT14_R = crate::BitReader<bool>;
182#[doc = "Field `INT15` reader - External Interrupt 15"]
183pub type INT15_R = crate::BitReader<bool>;
184impl R {
185    #[doc = "Bit 0 - External Non Maskable CPU interrupt"]
186    #[inline(always)]
187    pub fn nmi(&self) -> NMI_R {
188        NMI_R::new((self.bits & 1) != 0)
189    }
190    #[doc = "Bit 1 - External Interrupt 1"]
191    #[inline(always)]
192    pub fn int1(&self) -> INT1_R {
193        INT1_R::new(((self.bits >> 1) & 1) != 0)
194    }
195    #[doc = "Bit 2 - External Interrupt 2"]
196    #[inline(always)]
197    pub fn int2(&self) -> INT2_R {
198        INT2_R::new(((self.bits >> 2) & 1) != 0)
199    }
200    #[doc = "Bit 3 - External Interrupt 3"]
201    #[inline(always)]
202    pub fn int3(&self) -> INT3_R {
203        INT3_R::new(((self.bits >> 3) & 1) != 0)
204    }
205    #[doc = "Bit 4 - External Interrupt 4"]
206    #[inline(always)]
207    pub fn int4(&self) -> INT4_R {
208        INT4_R::new(((self.bits >> 4) & 1) != 0)
209    }
210    #[doc = "Bit 5 - External Interrupt 5"]
211    #[inline(always)]
212    pub fn int5(&self) -> INT5_R {
213        INT5_R::new(((self.bits >> 5) & 1) != 0)
214    }
215    #[doc = "Bit 6 - External Interrupt 6"]
216    #[inline(always)]
217    pub fn int6(&self) -> INT6_R {
218        INT6_R::new(((self.bits >> 6) & 1) != 0)
219    }
220    #[doc = "Bit 7 - External Interrupt 7"]
221    #[inline(always)]
222    pub fn int7(&self) -> INT7_R {
223        INT7_R::new(((self.bits >> 7) & 1) != 0)
224    }
225    #[doc = "Bit 8 - External Interrupt 8"]
226    #[inline(always)]
227    pub fn int8(&self) -> INT8_R {
228        INT8_R::new(((self.bits >> 8) & 1) != 0)
229    }
230    #[doc = "Bit 9 - External Interrupt 9"]
231    #[inline(always)]
232    pub fn int9(&self) -> INT9_R {
233        INT9_R::new(((self.bits >> 9) & 1) != 0)
234    }
235    #[doc = "Bit 10 - External Interrupt 10"]
236    #[inline(always)]
237    pub fn int10(&self) -> INT10_R {
238        INT10_R::new(((self.bits >> 10) & 1) != 0)
239    }
240    #[doc = "Bit 11 - External Interrupt 11"]
241    #[inline(always)]
242    pub fn int11(&self) -> INT11_R {
243        INT11_R::new(((self.bits >> 11) & 1) != 0)
244    }
245    #[doc = "Bit 12 - External Interrupt 12"]
246    #[inline(always)]
247    pub fn int12(&self) -> INT12_R {
248        INT12_R::new(((self.bits >> 12) & 1) != 0)
249    }
250    #[doc = "Bit 13 - External Interrupt 13"]
251    #[inline(always)]
252    pub fn int13(&self) -> INT13_R {
253        INT13_R::new(((self.bits >> 13) & 1) != 0)
254    }
255    #[doc = "Bit 14 - External Interrupt 14"]
256    #[inline(always)]
257    pub fn int14(&self) -> INT14_R {
258        INT14_R::new(((self.bits >> 14) & 1) != 0)
259    }
260    #[doc = "Bit 15 - External Interrupt 15"]
261    #[inline(always)]
262    pub fn int15(&self) -> INT15_R {
263        INT15_R::new(((self.bits >> 15) & 1) != 0)
264    }
265}
266#[doc = "Interrupt Mask 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 [imr](index.html) module"]
267pub struct IMR_SPEC;
268impl crate::RegisterSpec for IMR_SPEC {
269    type Ux = u32;
270}
271#[doc = "`read()` method returns [imr::R](R) reader structure"]
272impl crate::Readable for IMR_SPEC {
273    type Reader = R;
274}
275#[doc = "`reset()` method sets IMR to value 0"]
276impl crate::Resettable for IMR_SPEC {
277    const RESET_VALUE: Self::Ux = 0;
278}