avr_device/devices/atmega4809/ccl/
intctrl0.rs

1#[doc = "Register `INTCTRL0` reader"]
2pub struct R(crate::R<INTCTRL0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<INTCTRL0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<INTCTRL0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<INTCTRL0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `INTCTRL0` writer"]
17pub struct W(crate::W<INTCTRL0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<INTCTRL0_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<INTCTRL0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<INTCTRL0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `INTMODE0` reader - Interrupt Mode for LUT0"]
38pub type INTMODE0_R = crate::FieldReader<u8, INTMODE0_A>;
39#[doc = "Interrupt Mode for LUT0\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum INTMODE0_A {
43    #[doc = "0: Interrupt disabled"]
44    INTDISABLE = 0,
45    #[doc = "1: Sense rising edge"]
46    RISING = 1,
47    #[doc = "2: Sense falling edge"]
48    FALLING = 2,
49    #[doc = "3: Sense both edges"]
50    BOTH = 3,
51}
52impl From<INTMODE0_A> for u8 {
53    #[inline(always)]
54    fn from(variant: INTMODE0_A) -> Self {
55        variant as _
56    }
57}
58impl INTMODE0_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> INTMODE0_A {
62        match self.bits {
63            0 => INTMODE0_A::INTDISABLE,
64            1 => INTMODE0_A::RISING,
65            2 => INTMODE0_A::FALLING,
66            3 => INTMODE0_A::BOTH,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `INTDISABLE`"]
71    #[inline(always)]
72    pub fn is_intdisable(&self) -> bool {
73        *self == INTMODE0_A::INTDISABLE
74    }
75    #[doc = "Checks if the value of the field is `RISING`"]
76    #[inline(always)]
77    pub fn is_rising(&self) -> bool {
78        *self == INTMODE0_A::RISING
79    }
80    #[doc = "Checks if the value of the field is `FALLING`"]
81    #[inline(always)]
82    pub fn is_falling(&self) -> bool {
83        *self == INTMODE0_A::FALLING
84    }
85    #[doc = "Checks if the value of the field is `BOTH`"]
86    #[inline(always)]
87    pub fn is_both(&self) -> bool {
88        *self == INTMODE0_A::BOTH
89    }
90}
91#[doc = "Field `INTMODE0` writer - Interrupt Mode for LUT0"]
92pub type INTMODE0_W<'a, const O: u8> =
93    crate::FieldWriterSafe<'a, u8, INTCTRL0_SPEC, u8, INTMODE0_A, 2, O>;
94impl<'a, const O: u8> INTMODE0_W<'a, O> {
95    #[doc = "Interrupt disabled"]
96    #[inline(always)]
97    pub fn intdisable(self) -> &'a mut W {
98        self.variant(INTMODE0_A::INTDISABLE)
99    }
100    #[doc = "Sense rising edge"]
101    #[inline(always)]
102    pub fn rising(self) -> &'a mut W {
103        self.variant(INTMODE0_A::RISING)
104    }
105    #[doc = "Sense falling edge"]
106    #[inline(always)]
107    pub fn falling(self) -> &'a mut W {
108        self.variant(INTMODE0_A::FALLING)
109    }
110    #[doc = "Sense both edges"]
111    #[inline(always)]
112    pub fn both(self) -> &'a mut W {
113        self.variant(INTMODE0_A::BOTH)
114    }
115}
116#[doc = "Field `INTMODE1` reader - Interrupt Mode for LUT1"]
117pub type INTMODE1_R = crate::FieldReader<u8, INTMODE1_A>;
118#[doc = "Interrupt Mode for LUT1\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120#[repr(u8)]
121pub enum INTMODE1_A {
122    #[doc = "0: Interrupt disabled"]
123    INTDISABLE = 0,
124    #[doc = "1: Sense rising edge"]
125    RISING = 1,
126    #[doc = "2: Sense falling edge"]
127    FALLING = 2,
128    #[doc = "3: Sense both edges"]
129    BOTH = 3,
130}
131impl From<INTMODE1_A> for u8 {
132    #[inline(always)]
133    fn from(variant: INTMODE1_A) -> Self {
134        variant as _
135    }
136}
137impl INTMODE1_R {
138    #[doc = "Get enumerated values variant"]
139    #[inline(always)]
140    pub fn variant(&self) -> INTMODE1_A {
141        match self.bits {
142            0 => INTMODE1_A::INTDISABLE,
143            1 => INTMODE1_A::RISING,
144            2 => INTMODE1_A::FALLING,
145            3 => INTMODE1_A::BOTH,
146            _ => unreachable!(),
147        }
148    }
149    #[doc = "Checks if the value of the field is `INTDISABLE`"]
150    #[inline(always)]
151    pub fn is_intdisable(&self) -> bool {
152        *self == INTMODE1_A::INTDISABLE
153    }
154    #[doc = "Checks if the value of the field is `RISING`"]
155    #[inline(always)]
156    pub fn is_rising(&self) -> bool {
157        *self == INTMODE1_A::RISING
158    }
159    #[doc = "Checks if the value of the field is `FALLING`"]
160    #[inline(always)]
161    pub fn is_falling(&self) -> bool {
162        *self == INTMODE1_A::FALLING
163    }
164    #[doc = "Checks if the value of the field is `BOTH`"]
165    #[inline(always)]
166    pub fn is_both(&self) -> bool {
167        *self == INTMODE1_A::BOTH
168    }
169}
170#[doc = "Field `INTMODE1` writer - Interrupt Mode for LUT1"]
171pub type INTMODE1_W<'a, const O: u8> =
172    crate::FieldWriterSafe<'a, u8, INTCTRL0_SPEC, u8, INTMODE1_A, 2, O>;
173impl<'a, const O: u8> INTMODE1_W<'a, O> {
174    #[doc = "Interrupt disabled"]
175    #[inline(always)]
176    pub fn intdisable(self) -> &'a mut W {
177        self.variant(INTMODE1_A::INTDISABLE)
178    }
179    #[doc = "Sense rising edge"]
180    #[inline(always)]
181    pub fn rising(self) -> &'a mut W {
182        self.variant(INTMODE1_A::RISING)
183    }
184    #[doc = "Sense falling edge"]
185    #[inline(always)]
186    pub fn falling(self) -> &'a mut W {
187        self.variant(INTMODE1_A::FALLING)
188    }
189    #[doc = "Sense both edges"]
190    #[inline(always)]
191    pub fn both(self) -> &'a mut W {
192        self.variant(INTMODE1_A::BOTH)
193    }
194}
195#[doc = "Field `INTMODE2` reader - Interrupt Mode for LUT2"]
196pub type INTMODE2_R = crate::FieldReader<u8, INTMODE2_A>;
197#[doc = "Interrupt Mode for LUT2\n\nValue on reset: 0"]
198#[derive(Clone, Copy, Debug, PartialEq, Eq)]
199#[repr(u8)]
200pub enum INTMODE2_A {
201    #[doc = "0: Interrupt disabled"]
202    INTDISABLE = 0,
203    #[doc = "1: Sense rising edge"]
204    RISING = 1,
205    #[doc = "2: Sense falling edge"]
206    FALLING = 2,
207    #[doc = "3: Sense both edges"]
208    BOTH = 3,
209}
210impl From<INTMODE2_A> for u8 {
211    #[inline(always)]
212    fn from(variant: INTMODE2_A) -> Self {
213        variant as _
214    }
215}
216impl INTMODE2_R {
217    #[doc = "Get enumerated values variant"]
218    #[inline(always)]
219    pub fn variant(&self) -> INTMODE2_A {
220        match self.bits {
221            0 => INTMODE2_A::INTDISABLE,
222            1 => INTMODE2_A::RISING,
223            2 => INTMODE2_A::FALLING,
224            3 => INTMODE2_A::BOTH,
225            _ => unreachable!(),
226        }
227    }
228    #[doc = "Checks if the value of the field is `INTDISABLE`"]
229    #[inline(always)]
230    pub fn is_intdisable(&self) -> bool {
231        *self == INTMODE2_A::INTDISABLE
232    }
233    #[doc = "Checks if the value of the field is `RISING`"]
234    #[inline(always)]
235    pub fn is_rising(&self) -> bool {
236        *self == INTMODE2_A::RISING
237    }
238    #[doc = "Checks if the value of the field is `FALLING`"]
239    #[inline(always)]
240    pub fn is_falling(&self) -> bool {
241        *self == INTMODE2_A::FALLING
242    }
243    #[doc = "Checks if the value of the field is `BOTH`"]
244    #[inline(always)]
245    pub fn is_both(&self) -> bool {
246        *self == INTMODE2_A::BOTH
247    }
248}
249#[doc = "Field `INTMODE2` writer - Interrupt Mode for LUT2"]
250pub type INTMODE2_W<'a, const O: u8> =
251    crate::FieldWriterSafe<'a, u8, INTCTRL0_SPEC, u8, INTMODE2_A, 2, O>;
252impl<'a, const O: u8> INTMODE2_W<'a, O> {
253    #[doc = "Interrupt disabled"]
254    #[inline(always)]
255    pub fn intdisable(self) -> &'a mut W {
256        self.variant(INTMODE2_A::INTDISABLE)
257    }
258    #[doc = "Sense rising edge"]
259    #[inline(always)]
260    pub fn rising(self) -> &'a mut W {
261        self.variant(INTMODE2_A::RISING)
262    }
263    #[doc = "Sense falling edge"]
264    #[inline(always)]
265    pub fn falling(self) -> &'a mut W {
266        self.variant(INTMODE2_A::FALLING)
267    }
268    #[doc = "Sense both edges"]
269    #[inline(always)]
270    pub fn both(self) -> &'a mut W {
271        self.variant(INTMODE2_A::BOTH)
272    }
273}
274#[doc = "Field `INTMODE3` reader - Interrupt Mode for LUT3"]
275pub type INTMODE3_R = crate::FieldReader<u8, INTMODE3_A>;
276#[doc = "Interrupt Mode for LUT3\n\nValue on reset: 0"]
277#[derive(Clone, Copy, Debug, PartialEq, Eq)]
278#[repr(u8)]
279pub enum INTMODE3_A {
280    #[doc = "0: Interrupt disabled"]
281    INTDISABLE = 0,
282    #[doc = "1: Sense rising edge"]
283    RISING = 1,
284    #[doc = "2: Sense falling edge"]
285    FALLING = 2,
286    #[doc = "3: Sense both edges"]
287    BOTH = 3,
288}
289impl From<INTMODE3_A> for u8 {
290    #[inline(always)]
291    fn from(variant: INTMODE3_A) -> Self {
292        variant as _
293    }
294}
295impl INTMODE3_R {
296    #[doc = "Get enumerated values variant"]
297    #[inline(always)]
298    pub fn variant(&self) -> INTMODE3_A {
299        match self.bits {
300            0 => INTMODE3_A::INTDISABLE,
301            1 => INTMODE3_A::RISING,
302            2 => INTMODE3_A::FALLING,
303            3 => INTMODE3_A::BOTH,
304            _ => unreachable!(),
305        }
306    }
307    #[doc = "Checks if the value of the field is `INTDISABLE`"]
308    #[inline(always)]
309    pub fn is_intdisable(&self) -> bool {
310        *self == INTMODE3_A::INTDISABLE
311    }
312    #[doc = "Checks if the value of the field is `RISING`"]
313    #[inline(always)]
314    pub fn is_rising(&self) -> bool {
315        *self == INTMODE3_A::RISING
316    }
317    #[doc = "Checks if the value of the field is `FALLING`"]
318    #[inline(always)]
319    pub fn is_falling(&self) -> bool {
320        *self == INTMODE3_A::FALLING
321    }
322    #[doc = "Checks if the value of the field is `BOTH`"]
323    #[inline(always)]
324    pub fn is_both(&self) -> bool {
325        *self == INTMODE3_A::BOTH
326    }
327}
328#[doc = "Field `INTMODE3` writer - Interrupt Mode for LUT3"]
329pub type INTMODE3_W<'a, const O: u8> =
330    crate::FieldWriterSafe<'a, u8, INTCTRL0_SPEC, u8, INTMODE3_A, 2, O>;
331impl<'a, const O: u8> INTMODE3_W<'a, O> {
332    #[doc = "Interrupt disabled"]
333    #[inline(always)]
334    pub fn intdisable(self) -> &'a mut W {
335        self.variant(INTMODE3_A::INTDISABLE)
336    }
337    #[doc = "Sense rising edge"]
338    #[inline(always)]
339    pub fn rising(self) -> &'a mut W {
340        self.variant(INTMODE3_A::RISING)
341    }
342    #[doc = "Sense falling edge"]
343    #[inline(always)]
344    pub fn falling(self) -> &'a mut W {
345        self.variant(INTMODE3_A::FALLING)
346    }
347    #[doc = "Sense both edges"]
348    #[inline(always)]
349    pub fn both(self) -> &'a mut W {
350        self.variant(INTMODE3_A::BOTH)
351    }
352}
353impl R {
354    #[doc = "Bits 0:1 - Interrupt Mode for LUT0"]
355    #[inline(always)]
356    pub fn intmode0(&self) -> INTMODE0_R {
357        INTMODE0_R::new(self.bits & 3)
358    }
359    #[doc = "Bits 2:3 - Interrupt Mode for LUT1"]
360    #[inline(always)]
361    pub fn intmode1(&self) -> INTMODE1_R {
362        INTMODE1_R::new((self.bits >> 2) & 3)
363    }
364    #[doc = "Bits 4:5 - Interrupt Mode for LUT2"]
365    #[inline(always)]
366    pub fn intmode2(&self) -> INTMODE2_R {
367        INTMODE2_R::new((self.bits >> 4) & 3)
368    }
369    #[doc = "Bits 6:7 - Interrupt Mode for LUT3"]
370    #[inline(always)]
371    pub fn intmode3(&self) -> INTMODE3_R {
372        INTMODE3_R::new((self.bits >> 6) & 3)
373    }
374}
375impl W {
376    #[doc = "Bits 0:1 - Interrupt Mode for LUT0"]
377    #[inline(always)]
378    #[must_use]
379    pub fn intmode0(&mut self) -> INTMODE0_W<0> {
380        INTMODE0_W::new(self)
381    }
382    #[doc = "Bits 2:3 - Interrupt Mode for LUT1"]
383    #[inline(always)]
384    #[must_use]
385    pub fn intmode1(&mut self) -> INTMODE1_W<2> {
386        INTMODE1_W::new(self)
387    }
388    #[doc = "Bits 4:5 - Interrupt Mode for LUT2"]
389    #[inline(always)]
390    #[must_use]
391    pub fn intmode2(&mut self) -> INTMODE2_W<4> {
392        INTMODE2_W::new(self)
393    }
394    #[doc = "Bits 6:7 - Interrupt Mode for LUT3"]
395    #[inline(always)]
396    #[must_use]
397    pub fn intmode3(&mut self) -> INTMODE3_W<6> {
398        INTMODE3_W::new(self)
399    }
400    #[doc = "Writes raw bits to the register."]
401    #[inline(always)]
402    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
403        self.0.bits(bits);
404        self
405    }
406}
407#[doc = "Interrupt Control 0\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 [intctrl0](index.html) module"]
408pub struct INTCTRL0_SPEC;
409impl crate::RegisterSpec for INTCTRL0_SPEC {
410    type Ux = u8;
411}
412#[doc = "`read()` method returns [intctrl0::R](R) reader structure"]
413impl crate::Readable for INTCTRL0_SPEC {
414    type Reader = R;
415}
416#[doc = "`write(|w| ..)` method takes [intctrl0::W](W) writer structure"]
417impl crate::Writable for INTCTRL0_SPEC {
418    type Writer = W;
419    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
420    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
421}
422#[doc = "`reset()` method sets INTCTRL0 to value 0"]
423impl crate::Resettable for INTCTRL0_SPEC {
424    const RESET_VALUE: Self::Ux = 0;
425}