avr_device/devices/atmega2560/exint/
eicra.rs

1#[doc = "Register `EICRA` reader"]
2pub struct R(crate::R<EICRA_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EICRA_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EICRA_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EICRA_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `EICRA` writer"]
17pub struct W(crate::W<EICRA_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<EICRA_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<EICRA_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<EICRA_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `ISC0` reader - External Interrupt Sense Control Bit"]
38pub type ISC0_R = crate::FieldReader<u8, ISC0_A>;
39#[doc = "External Interrupt Sense Control Bit\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum ISC0_A {
43    #[doc = "0: Low Level of INTX"]
44    VAL_0X00 = 0,
45    #[doc = "1: Any Logical Change of INTX"]
46    VAL_0X01 = 1,
47    #[doc = "2: Falling Edge of INTX"]
48    VAL_0X02 = 2,
49    #[doc = "3: Rising Edge of INTX"]
50    VAL_0X03 = 3,
51}
52impl From<ISC0_A> for u8 {
53    #[inline(always)]
54    fn from(variant: ISC0_A) -> Self {
55        variant as _
56    }
57}
58impl ISC0_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> ISC0_A {
62        match self.bits {
63            0 => ISC0_A::VAL_0X00,
64            1 => ISC0_A::VAL_0X01,
65            2 => ISC0_A::VAL_0X02,
66            3 => ISC0_A::VAL_0X03,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `VAL_0X00`"]
71    #[inline(always)]
72    pub fn is_val_0x00(&self) -> bool {
73        *self == ISC0_A::VAL_0X00
74    }
75    #[doc = "Checks if the value of the field is `VAL_0X01`"]
76    #[inline(always)]
77    pub fn is_val_0x01(&self) -> bool {
78        *self == ISC0_A::VAL_0X01
79    }
80    #[doc = "Checks if the value of the field is `VAL_0X02`"]
81    #[inline(always)]
82    pub fn is_val_0x02(&self) -> bool {
83        *self == ISC0_A::VAL_0X02
84    }
85    #[doc = "Checks if the value of the field is `VAL_0X03`"]
86    #[inline(always)]
87    pub fn is_val_0x03(&self) -> bool {
88        *self == ISC0_A::VAL_0X03
89    }
90}
91#[doc = "Field `ISC0` writer - External Interrupt Sense Control Bit"]
92pub type ISC0_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, EICRA_SPEC, u8, ISC0_A, 2, O>;
93impl<'a, const O: u8> ISC0_W<'a, O> {
94    #[doc = "Low Level of INTX"]
95    #[inline(always)]
96    pub fn val_0x00(self) -> &'a mut W {
97        self.variant(ISC0_A::VAL_0X00)
98    }
99    #[doc = "Any Logical Change of INTX"]
100    #[inline(always)]
101    pub fn val_0x01(self) -> &'a mut W {
102        self.variant(ISC0_A::VAL_0X01)
103    }
104    #[doc = "Falling Edge of INTX"]
105    #[inline(always)]
106    pub fn val_0x02(self) -> &'a mut W {
107        self.variant(ISC0_A::VAL_0X02)
108    }
109    #[doc = "Rising Edge of INTX"]
110    #[inline(always)]
111    pub fn val_0x03(self) -> &'a mut W {
112        self.variant(ISC0_A::VAL_0X03)
113    }
114}
115#[doc = "Field `ISC1` reader - External Interrupt Sense Control Bit"]
116pub type ISC1_R = crate::FieldReader<u8, ISC1_A>;
117#[doc = "External Interrupt Sense Control Bit\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119#[repr(u8)]
120pub enum ISC1_A {
121    #[doc = "0: Low Level of INTX"]
122    VAL_0X00 = 0,
123    #[doc = "1: Any Logical Change of INTX"]
124    VAL_0X01 = 1,
125    #[doc = "2: Falling Edge of INTX"]
126    VAL_0X02 = 2,
127    #[doc = "3: Rising Edge of INTX"]
128    VAL_0X03 = 3,
129}
130impl From<ISC1_A> for u8 {
131    #[inline(always)]
132    fn from(variant: ISC1_A) -> Self {
133        variant as _
134    }
135}
136impl ISC1_R {
137    #[doc = "Get enumerated values variant"]
138    #[inline(always)]
139    pub fn variant(&self) -> ISC1_A {
140        match self.bits {
141            0 => ISC1_A::VAL_0X00,
142            1 => ISC1_A::VAL_0X01,
143            2 => ISC1_A::VAL_0X02,
144            3 => ISC1_A::VAL_0X03,
145            _ => unreachable!(),
146        }
147    }
148    #[doc = "Checks if the value of the field is `VAL_0X00`"]
149    #[inline(always)]
150    pub fn is_val_0x00(&self) -> bool {
151        *self == ISC1_A::VAL_0X00
152    }
153    #[doc = "Checks if the value of the field is `VAL_0X01`"]
154    #[inline(always)]
155    pub fn is_val_0x01(&self) -> bool {
156        *self == ISC1_A::VAL_0X01
157    }
158    #[doc = "Checks if the value of the field is `VAL_0X02`"]
159    #[inline(always)]
160    pub fn is_val_0x02(&self) -> bool {
161        *self == ISC1_A::VAL_0X02
162    }
163    #[doc = "Checks if the value of the field is `VAL_0X03`"]
164    #[inline(always)]
165    pub fn is_val_0x03(&self) -> bool {
166        *self == ISC1_A::VAL_0X03
167    }
168}
169#[doc = "Field `ISC1` writer - External Interrupt Sense Control Bit"]
170pub type ISC1_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, EICRA_SPEC, u8, ISC1_A, 2, O>;
171impl<'a, const O: u8> ISC1_W<'a, O> {
172    #[doc = "Low Level of INTX"]
173    #[inline(always)]
174    pub fn val_0x00(self) -> &'a mut W {
175        self.variant(ISC1_A::VAL_0X00)
176    }
177    #[doc = "Any Logical Change of INTX"]
178    #[inline(always)]
179    pub fn val_0x01(self) -> &'a mut W {
180        self.variant(ISC1_A::VAL_0X01)
181    }
182    #[doc = "Falling Edge of INTX"]
183    #[inline(always)]
184    pub fn val_0x02(self) -> &'a mut W {
185        self.variant(ISC1_A::VAL_0X02)
186    }
187    #[doc = "Rising Edge of INTX"]
188    #[inline(always)]
189    pub fn val_0x03(self) -> &'a mut W {
190        self.variant(ISC1_A::VAL_0X03)
191    }
192}
193#[doc = "Field `ISC2` reader - External Interrupt Sense Control Bit"]
194pub type ISC2_R = crate::FieldReader<u8, ISC2_A>;
195#[doc = "External Interrupt Sense Control Bit\n\nValue on reset: 0"]
196#[derive(Clone, Copy, Debug, PartialEq, Eq)]
197#[repr(u8)]
198pub enum ISC2_A {
199    #[doc = "0: Low Level of INTX"]
200    VAL_0X00 = 0,
201    #[doc = "1: Any Logical Change of INTX"]
202    VAL_0X01 = 1,
203    #[doc = "2: Falling Edge of INTX"]
204    VAL_0X02 = 2,
205    #[doc = "3: Rising Edge of INTX"]
206    VAL_0X03 = 3,
207}
208impl From<ISC2_A> for u8 {
209    #[inline(always)]
210    fn from(variant: ISC2_A) -> Self {
211        variant as _
212    }
213}
214impl ISC2_R {
215    #[doc = "Get enumerated values variant"]
216    #[inline(always)]
217    pub fn variant(&self) -> ISC2_A {
218        match self.bits {
219            0 => ISC2_A::VAL_0X00,
220            1 => ISC2_A::VAL_0X01,
221            2 => ISC2_A::VAL_0X02,
222            3 => ISC2_A::VAL_0X03,
223            _ => unreachable!(),
224        }
225    }
226    #[doc = "Checks if the value of the field is `VAL_0X00`"]
227    #[inline(always)]
228    pub fn is_val_0x00(&self) -> bool {
229        *self == ISC2_A::VAL_0X00
230    }
231    #[doc = "Checks if the value of the field is `VAL_0X01`"]
232    #[inline(always)]
233    pub fn is_val_0x01(&self) -> bool {
234        *self == ISC2_A::VAL_0X01
235    }
236    #[doc = "Checks if the value of the field is `VAL_0X02`"]
237    #[inline(always)]
238    pub fn is_val_0x02(&self) -> bool {
239        *self == ISC2_A::VAL_0X02
240    }
241    #[doc = "Checks if the value of the field is `VAL_0X03`"]
242    #[inline(always)]
243    pub fn is_val_0x03(&self) -> bool {
244        *self == ISC2_A::VAL_0X03
245    }
246}
247#[doc = "Field `ISC2` writer - External Interrupt Sense Control Bit"]
248pub type ISC2_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, EICRA_SPEC, u8, ISC2_A, 2, O>;
249impl<'a, const O: u8> ISC2_W<'a, O> {
250    #[doc = "Low Level of INTX"]
251    #[inline(always)]
252    pub fn val_0x00(self) -> &'a mut W {
253        self.variant(ISC2_A::VAL_0X00)
254    }
255    #[doc = "Any Logical Change of INTX"]
256    #[inline(always)]
257    pub fn val_0x01(self) -> &'a mut W {
258        self.variant(ISC2_A::VAL_0X01)
259    }
260    #[doc = "Falling Edge of INTX"]
261    #[inline(always)]
262    pub fn val_0x02(self) -> &'a mut W {
263        self.variant(ISC2_A::VAL_0X02)
264    }
265    #[doc = "Rising Edge of INTX"]
266    #[inline(always)]
267    pub fn val_0x03(self) -> &'a mut W {
268        self.variant(ISC2_A::VAL_0X03)
269    }
270}
271#[doc = "Field `ISC3` reader - External Interrupt Sense Control Bit"]
272pub type ISC3_R = crate::FieldReader<u8, ISC3_A>;
273#[doc = "External Interrupt Sense Control Bit\n\nValue on reset: 0"]
274#[derive(Clone, Copy, Debug, PartialEq, Eq)]
275#[repr(u8)]
276pub enum ISC3_A {
277    #[doc = "0: Low Level of INTX"]
278    VAL_0X00 = 0,
279    #[doc = "1: Any Logical Change of INTX"]
280    VAL_0X01 = 1,
281    #[doc = "2: Falling Edge of INTX"]
282    VAL_0X02 = 2,
283    #[doc = "3: Rising Edge of INTX"]
284    VAL_0X03 = 3,
285}
286impl From<ISC3_A> for u8 {
287    #[inline(always)]
288    fn from(variant: ISC3_A) -> Self {
289        variant as _
290    }
291}
292impl ISC3_R {
293    #[doc = "Get enumerated values variant"]
294    #[inline(always)]
295    pub fn variant(&self) -> ISC3_A {
296        match self.bits {
297            0 => ISC3_A::VAL_0X00,
298            1 => ISC3_A::VAL_0X01,
299            2 => ISC3_A::VAL_0X02,
300            3 => ISC3_A::VAL_0X03,
301            _ => unreachable!(),
302        }
303    }
304    #[doc = "Checks if the value of the field is `VAL_0X00`"]
305    #[inline(always)]
306    pub fn is_val_0x00(&self) -> bool {
307        *self == ISC3_A::VAL_0X00
308    }
309    #[doc = "Checks if the value of the field is `VAL_0X01`"]
310    #[inline(always)]
311    pub fn is_val_0x01(&self) -> bool {
312        *self == ISC3_A::VAL_0X01
313    }
314    #[doc = "Checks if the value of the field is `VAL_0X02`"]
315    #[inline(always)]
316    pub fn is_val_0x02(&self) -> bool {
317        *self == ISC3_A::VAL_0X02
318    }
319    #[doc = "Checks if the value of the field is `VAL_0X03`"]
320    #[inline(always)]
321    pub fn is_val_0x03(&self) -> bool {
322        *self == ISC3_A::VAL_0X03
323    }
324}
325#[doc = "Field `ISC3` writer - External Interrupt Sense Control Bit"]
326pub type ISC3_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, EICRA_SPEC, u8, ISC3_A, 2, O>;
327impl<'a, const O: u8> ISC3_W<'a, O> {
328    #[doc = "Low Level of INTX"]
329    #[inline(always)]
330    pub fn val_0x00(self) -> &'a mut W {
331        self.variant(ISC3_A::VAL_0X00)
332    }
333    #[doc = "Any Logical Change of INTX"]
334    #[inline(always)]
335    pub fn val_0x01(self) -> &'a mut W {
336        self.variant(ISC3_A::VAL_0X01)
337    }
338    #[doc = "Falling Edge of INTX"]
339    #[inline(always)]
340    pub fn val_0x02(self) -> &'a mut W {
341        self.variant(ISC3_A::VAL_0X02)
342    }
343    #[doc = "Rising Edge of INTX"]
344    #[inline(always)]
345    pub fn val_0x03(self) -> &'a mut W {
346        self.variant(ISC3_A::VAL_0X03)
347    }
348}
349impl R {
350    #[doc = "Bits 0:1 - External Interrupt Sense Control Bit"]
351    #[inline(always)]
352    pub fn isc0(&self) -> ISC0_R {
353        ISC0_R::new(self.bits & 3)
354    }
355    #[doc = "Bits 2:3 - External Interrupt Sense Control Bit"]
356    #[inline(always)]
357    pub fn isc1(&self) -> ISC1_R {
358        ISC1_R::new((self.bits >> 2) & 3)
359    }
360    #[doc = "Bits 4:5 - External Interrupt Sense Control Bit"]
361    #[inline(always)]
362    pub fn isc2(&self) -> ISC2_R {
363        ISC2_R::new((self.bits >> 4) & 3)
364    }
365    #[doc = "Bits 6:7 - External Interrupt Sense Control Bit"]
366    #[inline(always)]
367    pub fn isc3(&self) -> ISC3_R {
368        ISC3_R::new((self.bits >> 6) & 3)
369    }
370}
371impl W {
372    #[doc = "Bits 0:1 - External Interrupt Sense Control Bit"]
373    #[inline(always)]
374    #[must_use]
375    pub fn isc0(&mut self) -> ISC0_W<0> {
376        ISC0_W::new(self)
377    }
378    #[doc = "Bits 2:3 - External Interrupt Sense Control Bit"]
379    #[inline(always)]
380    #[must_use]
381    pub fn isc1(&mut self) -> ISC1_W<2> {
382        ISC1_W::new(self)
383    }
384    #[doc = "Bits 4:5 - External Interrupt Sense Control Bit"]
385    #[inline(always)]
386    #[must_use]
387    pub fn isc2(&mut self) -> ISC2_W<4> {
388        ISC2_W::new(self)
389    }
390    #[doc = "Bits 6:7 - External Interrupt Sense Control Bit"]
391    #[inline(always)]
392    #[must_use]
393    pub fn isc3(&mut self) -> ISC3_W<6> {
394        ISC3_W::new(self)
395    }
396    #[doc = "Writes raw bits to the register."]
397    #[inline(always)]
398    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
399        self.0.bits(bits);
400        self
401    }
402}
403#[doc = "External Interrupt Control Register A\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [eicra](index.html) module"]
404pub struct EICRA_SPEC;
405impl crate::RegisterSpec for EICRA_SPEC {
406    type Ux = u8;
407}
408#[doc = "`read()` method returns [eicra::R](R) reader structure"]
409impl crate::Readable for EICRA_SPEC {
410    type Reader = R;
411}
412#[doc = "`write(|w| ..)` method takes [eicra::W](W) writer structure"]
413impl crate::Writable for EICRA_SPEC {
414    type Writer = W;
415    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
416    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
417}
418#[doc = "`reset()` method sets EICRA to value 0"]
419impl crate::Resettable for EICRA_SPEC {
420    const RESET_VALUE: Self::Ux = 0;
421}