ra2a1/icu/
irqcr.rs

1#[doc = "Register `IRQCR%s` reader"]
2pub struct R(crate::R<IRQCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<IRQCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<IRQCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<IRQCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `IRQCR%s` writer"]
17pub struct W(crate::W<IRQCR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<IRQCR_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<IRQCR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<IRQCR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `IRQMD` reader - IRQ Detection Sense Select"]
38pub type IRQMD_R = crate::FieldReader<u8, IRQMD_A>;
39#[doc = "IRQ Detection Sense Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum IRQMD_A {
43    #[doc = "0: Falling edge"]
44    _00 = 0,
45    #[doc = "1: Rising edge"]
46    _01 = 1,
47    #[doc = "2: Rising and falling edges"]
48    _10 = 2,
49    #[doc = "3: Low level"]
50    _11 = 3,
51}
52impl From<IRQMD_A> for u8 {
53    #[inline(always)]
54    fn from(variant: IRQMD_A) -> Self {
55        variant as _
56    }
57}
58impl IRQMD_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> IRQMD_A {
62        match self.bits {
63            0 => IRQMD_A::_00,
64            1 => IRQMD_A::_01,
65            2 => IRQMD_A::_10,
66            3 => IRQMD_A::_11,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `_00`"]
71    #[inline(always)]
72    pub fn is_00(&self) -> bool {
73        *self == IRQMD_A::_00
74    }
75    #[doc = "Checks if the value of the field is `_01`"]
76    #[inline(always)]
77    pub fn is_01(&self) -> bool {
78        *self == IRQMD_A::_01
79    }
80    #[doc = "Checks if the value of the field is `_10`"]
81    #[inline(always)]
82    pub fn is_10(&self) -> bool {
83        *self == IRQMD_A::_10
84    }
85    #[doc = "Checks if the value of the field is `_11`"]
86    #[inline(always)]
87    pub fn is_11(&self) -> bool {
88        *self == IRQMD_A::_11
89    }
90}
91#[doc = "Field `IRQMD` writer - IRQ Detection Sense Select"]
92pub type IRQMD_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u8, IRQCR_SPEC, u8, IRQMD_A, 2, O>;
93impl<'a, const O: u8> IRQMD_W<'a, O> {
94    #[doc = "Falling edge"]
95    #[inline(always)]
96    pub fn _00(self) -> &'a mut W {
97        self.variant(IRQMD_A::_00)
98    }
99    #[doc = "Rising edge"]
100    #[inline(always)]
101    pub fn _01(self) -> &'a mut W {
102        self.variant(IRQMD_A::_01)
103    }
104    #[doc = "Rising and falling edges"]
105    #[inline(always)]
106    pub fn _10(self) -> &'a mut W {
107        self.variant(IRQMD_A::_10)
108    }
109    #[doc = "Low level"]
110    #[inline(always)]
111    pub fn _11(self) -> &'a mut W {
112        self.variant(IRQMD_A::_11)
113    }
114}
115#[doc = "Field `FCLKSEL` reader - IRQi Digital Filter Sampling Clock Select"]
116pub type FCLKSEL_R = crate::FieldReader<u8, FCLKSEL_A>;
117#[doc = "IRQi Digital Filter Sampling Clock Select\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119#[repr(u8)]
120pub enum FCLKSEL_A {
121    #[doc = "0: PCLKB"]
122    _00 = 0,
123    #[doc = "1: PCLKB/8"]
124    _01 = 1,
125    #[doc = "2: PCLKB/32"]
126    _10 = 2,
127    #[doc = "3: PCLKB/64"]
128    _11 = 3,
129}
130impl From<FCLKSEL_A> for u8 {
131    #[inline(always)]
132    fn from(variant: FCLKSEL_A) -> Self {
133        variant as _
134    }
135}
136impl FCLKSEL_R {
137    #[doc = "Get enumerated values variant"]
138    #[inline(always)]
139    pub fn variant(&self) -> FCLKSEL_A {
140        match self.bits {
141            0 => FCLKSEL_A::_00,
142            1 => FCLKSEL_A::_01,
143            2 => FCLKSEL_A::_10,
144            3 => FCLKSEL_A::_11,
145            _ => unreachable!(),
146        }
147    }
148    #[doc = "Checks if the value of the field is `_00`"]
149    #[inline(always)]
150    pub fn is_00(&self) -> bool {
151        *self == FCLKSEL_A::_00
152    }
153    #[doc = "Checks if the value of the field is `_01`"]
154    #[inline(always)]
155    pub fn is_01(&self) -> bool {
156        *self == FCLKSEL_A::_01
157    }
158    #[doc = "Checks if the value of the field is `_10`"]
159    #[inline(always)]
160    pub fn is_10(&self) -> bool {
161        *self == FCLKSEL_A::_10
162    }
163    #[doc = "Checks if the value of the field is `_11`"]
164    #[inline(always)]
165    pub fn is_11(&self) -> bool {
166        *self == FCLKSEL_A::_11
167    }
168}
169#[doc = "Field `FCLKSEL` writer - IRQi Digital Filter Sampling Clock Select"]
170pub type FCLKSEL_W<'a, const O: u8> =
171    crate::FieldWriterSafe<'a, u8, IRQCR_SPEC, u8, FCLKSEL_A, 2, O>;
172impl<'a, const O: u8> FCLKSEL_W<'a, O> {
173    #[doc = "PCLKB"]
174    #[inline(always)]
175    pub fn _00(self) -> &'a mut W {
176        self.variant(FCLKSEL_A::_00)
177    }
178    #[doc = "PCLKB/8"]
179    #[inline(always)]
180    pub fn _01(self) -> &'a mut W {
181        self.variant(FCLKSEL_A::_01)
182    }
183    #[doc = "PCLKB/32"]
184    #[inline(always)]
185    pub fn _10(self) -> &'a mut W {
186        self.variant(FCLKSEL_A::_10)
187    }
188    #[doc = "PCLKB/64"]
189    #[inline(always)]
190    pub fn _11(self) -> &'a mut W {
191        self.variant(FCLKSEL_A::_11)
192    }
193}
194#[doc = "Field `FLTEN` reader - IRQ Digital Filter Enable"]
195pub type FLTEN_R = crate::BitReader<FLTEN_A>;
196#[doc = "IRQ Digital Filter Enable\n\nValue on reset: 0"]
197#[derive(Clone, Copy, Debug, PartialEq, Eq)]
198pub enum FLTEN_A {
199    #[doc = "0: Digital filter is disabled."]
200    _0 = 0,
201    #[doc = "1: Digital filter is enabled."]
202    _1 = 1,
203}
204impl From<FLTEN_A> for bool {
205    #[inline(always)]
206    fn from(variant: FLTEN_A) -> Self {
207        variant as u8 != 0
208    }
209}
210impl FLTEN_R {
211    #[doc = "Get enumerated values variant"]
212    #[inline(always)]
213    pub fn variant(&self) -> FLTEN_A {
214        match self.bits {
215            false => FLTEN_A::_0,
216            true => FLTEN_A::_1,
217        }
218    }
219    #[doc = "Checks if the value of the field is `_0`"]
220    #[inline(always)]
221    pub fn is_0(&self) -> bool {
222        *self == FLTEN_A::_0
223    }
224    #[doc = "Checks if the value of the field is `_1`"]
225    #[inline(always)]
226    pub fn is_1(&self) -> bool {
227        *self == FLTEN_A::_1
228    }
229}
230#[doc = "Field `FLTEN` writer - IRQ Digital Filter Enable"]
231pub type FLTEN_W<'a, const O: u8> = crate::BitWriter<'a, u8, IRQCR_SPEC, FLTEN_A, O>;
232impl<'a, const O: u8> FLTEN_W<'a, O> {
233    #[doc = "Digital filter is disabled."]
234    #[inline(always)]
235    pub fn _0(self) -> &'a mut W {
236        self.variant(FLTEN_A::_0)
237    }
238    #[doc = "Digital filter is enabled."]
239    #[inline(always)]
240    pub fn _1(self) -> &'a mut W {
241        self.variant(FLTEN_A::_1)
242    }
243}
244impl R {
245    #[doc = "Bits 0:1 - IRQ Detection Sense Select"]
246    #[inline(always)]
247    pub fn irqmd(&self) -> IRQMD_R {
248        IRQMD_R::new(self.bits & 3)
249    }
250    #[doc = "Bits 4:5 - IRQi Digital Filter Sampling Clock Select"]
251    #[inline(always)]
252    pub fn fclksel(&self) -> FCLKSEL_R {
253        FCLKSEL_R::new((self.bits >> 4) & 3)
254    }
255    #[doc = "Bit 7 - IRQ Digital Filter Enable"]
256    #[inline(always)]
257    pub fn flten(&self) -> FLTEN_R {
258        FLTEN_R::new(((self.bits >> 7) & 1) != 0)
259    }
260}
261impl W {
262    #[doc = "Bits 0:1 - IRQ Detection Sense Select"]
263    #[inline(always)]
264    #[must_use]
265    pub fn irqmd(&mut self) -> IRQMD_W<0> {
266        IRQMD_W::new(self)
267    }
268    #[doc = "Bits 4:5 - IRQi Digital Filter Sampling Clock Select"]
269    #[inline(always)]
270    #[must_use]
271    pub fn fclksel(&mut self) -> FCLKSEL_W<4> {
272        FCLKSEL_W::new(self)
273    }
274    #[doc = "Bit 7 - IRQ Digital Filter Enable"]
275    #[inline(always)]
276    #[must_use]
277    pub fn flten(&mut self) -> FLTEN_W<7> {
278        FLTEN_W::new(self)
279    }
280    #[doc = "Writes raw bits to the register."]
281    #[inline(always)]
282    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
283        self.0.bits(bits);
284        self
285    }
286}
287#[doc = "IRQ Control Register %s\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 [irqcr](index.html) module"]
288pub struct IRQCR_SPEC;
289impl crate::RegisterSpec for IRQCR_SPEC {
290    type Ux = u8;
291}
292#[doc = "`read()` method returns [irqcr::R](R) reader structure"]
293impl crate::Readable for IRQCR_SPEC {
294    type Reader = R;
295}
296#[doc = "`write(|w| ..)` method takes [irqcr::W](W) writer structure"]
297impl crate::Writable for IRQCR_SPEC {
298    type Writer = W;
299    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
300    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
301}
302#[doc = "`reset()` method sets IRQCR%s to value 0"]
303impl crate::Resettable for IRQCR_SPEC {
304    const RESET_VALUE: Self::Ux = 0;
305}