mk66f18/llwu/
pe6.rs

1#[doc = "Reader of register PE6"]
2pub type R = crate::R<u8, super::PE6>;
3#[doc = "Writer for register PE6"]
4pub type W = crate::W<u8, super::PE6>;
5#[doc = "Register PE6 `reset()`'s with value 0"]
6impl crate::ResetValue for super::PE6 {
7    type Type = u8;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Wakeup Pin Enable For LLWU_P20\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum WUPE20_A {
16    #[doc = "0: External input pin disabled as wakeup input"]
17    _00,
18    #[doc = "1: External input pin enabled with rising edge detection"]
19    _01,
20    #[doc = "2: External input pin enabled with falling edge detection"]
21    _10,
22    #[doc = "3: External input pin enabled with any change detection"]
23    _11,
24}
25impl From<WUPE20_A> for u8 {
26    #[inline(always)]
27    fn from(variant: WUPE20_A) -> Self {
28        match variant {
29            WUPE20_A::_00 => 0,
30            WUPE20_A::_01 => 1,
31            WUPE20_A::_10 => 2,
32            WUPE20_A::_11 => 3,
33        }
34    }
35}
36#[doc = "Reader of field `WUPE20`"]
37pub type WUPE20_R = crate::R<u8, WUPE20_A>;
38impl WUPE20_R {
39    #[doc = r"Get enumerated values variant"]
40    #[inline(always)]
41    pub fn variant(&self) -> WUPE20_A {
42        match self.bits {
43            0 => WUPE20_A::_00,
44            1 => WUPE20_A::_01,
45            2 => WUPE20_A::_10,
46            3 => WUPE20_A::_11,
47            _ => unreachable!(),
48        }
49    }
50    #[doc = "Checks if the value of the field is `_00`"]
51    #[inline(always)]
52    pub fn is_00(&self) -> bool {
53        *self == WUPE20_A::_00
54    }
55    #[doc = "Checks if the value of the field is `_01`"]
56    #[inline(always)]
57    pub fn is_01(&self) -> bool {
58        *self == WUPE20_A::_01
59    }
60    #[doc = "Checks if the value of the field is `_10`"]
61    #[inline(always)]
62    pub fn is_10(&self) -> bool {
63        *self == WUPE20_A::_10
64    }
65    #[doc = "Checks if the value of the field is `_11`"]
66    #[inline(always)]
67    pub fn is_11(&self) -> bool {
68        *self == WUPE20_A::_11
69    }
70}
71#[doc = "Write proxy for field `WUPE20`"]
72pub struct WUPE20_W<'a> {
73    w: &'a mut W,
74}
75impl<'a> WUPE20_W<'a> {
76    #[doc = r"Writes `variant` to the field"]
77    #[inline(always)]
78    pub fn variant(self, variant: WUPE20_A) -> &'a mut W {
79        {
80            self.bits(variant.into())
81        }
82    }
83    #[doc = "External input pin disabled as wakeup input"]
84    #[inline(always)]
85    pub fn _00(self) -> &'a mut W {
86        self.variant(WUPE20_A::_00)
87    }
88    #[doc = "External input pin enabled with rising edge detection"]
89    #[inline(always)]
90    pub fn _01(self) -> &'a mut W {
91        self.variant(WUPE20_A::_01)
92    }
93    #[doc = "External input pin enabled with falling edge detection"]
94    #[inline(always)]
95    pub fn _10(self) -> &'a mut W {
96        self.variant(WUPE20_A::_10)
97    }
98    #[doc = "External input pin enabled with any change detection"]
99    #[inline(always)]
100    pub fn _11(self) -> &'a mut W {
101        self.variant(WUPE20_A::_11)
102    }
103    #[doc = r"Writes raw bits to the field"]
104    #[inline(always)]
105    pub fn bits(self, value: u8) -> &'a mut W {
106        self.w.bits = (self.w.bits & !0x03) | ((value as u8) & 0x03);
107        self.w
108    }
109}
110#[doc = "Wakeup Pin Enable For LLWU_P21\n\nValue on reset: 0"]
111#[derive(Clone, Copy, Debug, PartialEq)]
112pub enum WUPE21_A {
113    #[doc = "0: External input pin disabled as wakeup input"]
114    _00,
115    #[doc = "1: External input pin enabled with rising edge detection"]
116    _01,
117    #[doc = "2: External input pin enabled with falling edge detection"]
118    _10,
119    #[doc = "3: External input pin enabled with any change detection"]
120    _11,
121}
122impl From<WUPE21_A> for u8 {
123    #[inline(always)]
124    fn from(variant: WUPE21_A) -> Self {
125        match variant {
126            WUPE21_A::_00 => 0,
127            WUPE21_A::_01 => 1,
128            WUPE21_A::_10 => 2,
129            WUPE21_A::_11 => 3,
130        }
131    }
132}
133#[doc = "Reader of field `WUPE21`"]
134pub type WUPE21_R = crate::R<u8, WUPE21_A>;
135impl WUPE21_R {
136    #[doc = r"Get enumerated values variant"]
137    #[inline(always)]
138    pub fn variant(&self) -> WUPE21_A {
139        match self.bits {
140            0 => WUPE21_A::_00,
141            1 => WUPE21_A::_01,
142            2 => WUPE21_A::_10,
143            3 => WUPE21_A::_11,
144            _ => unreachable!(),
145        }
146    }
147    #[doc = "Checks if the value of the field is `_00`"]
148    #[inline(always)]
149    pub fn is_00(&self) -> bool {
150        *self == WUPE21_A::_00
151    }
152    #[doc = "Checks if the value of the field is `_01`"]
153    #[inline(always)]
154    pub fn is_01(&self) -> bool {
155        *self == WUPE21_A::_01
156    }
157    #[doc = "Checks if the value of the field is `_10`"]
158    #[inline(always)]
159    pub fn is_10(&self) -> bool {
160        *self == WUPE21_A::_10
161    }
162    #[doc = "Checks if the value of the field is `_11`"]
163    #[inline(always)]
164    pub fn is_11(&self) -> bool {
165        *self == WUPE21_A::_11
166    }
167}
168#[doc = "Write proxy for field `WUPE21`"]
169pub struct WUPE21_W<'a> {
170    w: &'a mut W,
171}
172impl<'a> WUPE21_W<'a> {
173    #[doc = r"Writes `variant` to the field"]
174    #[inline(always)]
175    pub fn variant(self, variant: WUPE21_A) -> &'a mut W {
176        {
177            self.bits(variant.into())
178        }
179    }
180    #[doc = "External input pin disabled as wakeup input"]
181    #[inline(always)]
182    pub fn _00(self) -> &'a mut W {
183        self.variant(WUPE21_A::_00)
184    }
185    #[doc = "External input pin enabled with rising edge detection"]
186    #[inline(always)]
187    pub fn _01(self) -> &'a mut W {
188        self.variant(WUPE21_A::_01)
189    }
190    #[doc = "External input pin enabled with falling edge detection"]
191    #[inline(always)]
192    pub fn _10(self) -> &'a mut W {
193        self.variant(WUPE21_A::_10)
194    }
195    #[doc = "External input pin enabled with any change detection"]
196    #[inline(always)]
197    pub fn _11(self) -> &'a mut W {
198        self.variant(WUPE21_A::_11)
199    }
200    #[doc = r"Writes raw bits to the field"]
201    #[inline(always)]
202    pub fn bits(self, value: u8) -> &'a mut W {
203        self.w.bits = (self.w.bits & !(0x03 << 2)) | (((value as u8) & 0x03) << 2);
204        self.w
205    }
206}
207#[doc = "Wakeup Pin Enable For LLWU_P22\n\nValue on reset: 0"]
208#[derive(Clone, Copy, Debug, PartialEq)]
209pub enum WUPE22_A {
210    #[doc = "0: External input pin disabled as wakeup input"]
211    _00,
212    #[doc = "1: External input pin enabled with rising edge detection"]
213    _01,
214    #[doc = "2: External input pin enabled with falling edge detection"]
215    _10,
216    #[doc = "3: External input pin enabled with any change detection"]
217    _11,
218}
219impl From<WUPE22_A> for u8 {
220    #[inline(always)]
221    fn from(variant: WUPE22_A) -> Self {
222        match variant {
223            WUPE22_A::_00 => 0,
224            WUPE22_A::_01 => 1,
225            WUPE22_A::_10 => 2,
226            WUPE22_A::_11 => 3,
227        }
228    }
229}
230#[doc = "Reader of field `WUPE22`"]
231pub type WUPE22_R = crate::R<u8, WUPE22_A>;
232impl WUPE22_R {
233    #[doc = r"Get enumerated values variant"]
234    #[inline(always)]
235    pub fn variant(&self) -> WUPE22_A {
236        match self.bits {
237            0 => WUPE22_A::_00,
238            1 => WUPE22_A::_01,
239            2 => WUPE22_A::_10,
240            3 => WUPE22_A::_11,
241            _ => unreachable!(),
242        }
243    }
244    #[doc = "Checks if the value of the field is `_00`"]
245    #[inline(always)]
246    pub fn is_00(&self) -> bool {
247        *self == WUPE22_A::_00
248    }
249    #[doc = "Checks if the value of the field is `_01`"]
250    #[inline(always)]
251    pub fn is_01(&self) -> bool {
252        *self == WUPE22_A::_01
253    }
254    #[doc = "Checks if the value of the field is `_10`"]
255    #[inline(always)]
256    pub fn is_10(&self) -> bool {
257        *self == WUPE22_A::_10
258    }
259    #[doc = "Checks if the value of the field is `_11`"]
260    #[inline(always)]
261    pub fn is_11(&self) -> bool {
262        *self == WUPE22_A::_11
263    }
264}
265#[doc = "Write proxy for field `WUPE22`"]
266pub struct WUPE22_W<'a> {
267    w: &'a mut W,
268}
269impl<'a> WUPE22_W<'a> {
270    #[doc = r"Writes `variant` to the field"]
271    #[inline(always)]
272    pub fn variant(self, variant: WUPE22_A) -> &'a mut W {
273        {
274            self.bits(variant.into())
275        }
276    }
277    #[doc = "External input pin disabled as wakeup input"]
278    #[inline(always)]
279    pub fn _00(self) -> &'a mut W {
280        self.variant(WUPE22_A::_00)
281    }
282    #[doc = "External input pin enabled with rising edge detection"]
283    #[inline(always)]
284    pub fn _01(self) -> &'a mut W {
285        self.variant(WUPE22_A::_01)
286    }
287    #[doc = "External input pin enabled with falling edge detection"]
288    #[inline(always)]
289    pub fn _10(self) -> &'a mut W {
290        self.variant(WUPE22_A::_10)
291    }
292    #[doc = "External input pin enabled with any change detection"]
293    #[inline(always)]
294    pub fn _11(self) -> &'a mut W {
295        self.variant(WUPE22_A::_11)
296    }
297    #[doc = r"Writes raw bits to the field"]
298    #[inline(always)]
299    pub fn bits(self, value: u8) -> &'a mut W {
300        self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u8) & 0x03) << 4);
301        self.w
302    }
303}
304#[doc = "Wakeup Pin Enable For LLWU_P23\n\nValue on reset: 0"]
305#[derive(Clone, Copy, Debug, PartialEq)]
306pub enum WUPE23_A {
307    #[doc = "0: External input pin disabled as wakeup input"]
308    _00,
309    #[doc = "1: External input pin enabled with rising edge detection"]
310    _01,
311    #[doc = "2: External input pin enabled with falling edge detection"]
312    _10,
313    #[doc = "3: External input pin enabled with any change detection"]
314    _11,
315}
316impl From<WUPE23_A> for u8 {
317    #[inline(always)]
318    fn from(variant: WUPE23_A) -> Self {
319        match variant {
320            WUPE23_A::_00 => 0,
321            WUPE23_A::_01 => 1,
322            WUPE23_A::_10 => 2,
323            WUPE23_A::_11 => 3,
324        }
325    }
326}
327#[doc = "Reader of field `WUPE23`"]
328pub type WUPE23_R = crate::R<u8, WUPE23_A>;
329impl WUPE23_R {
330    #[doc = r"Get enumerated values variant"]
331    #[inline(always)]
332    pub fn variant(&self) -> WUPE23_A {
333        match self.bits {
334            0 => WUPE23_A::_00,
335            1 => WUPE23_A::_01,
336            2 => WUPE23_A::_10,
337            3 => WUPE23_A::_11,
338            _ => unreachable!(),
339        }
340    }
341    #[doc = "Checks if the value of the field is `_00`"]
342    #[inline(always)]
343    pub fn is_00(&self) -> bool {
344        *self == WUPE23_A::_00
345    }
346    #[doc = "Checks if the value of the field is `_01`"]
347    #[inline(always)]
348    pub fn is_01(&self) -> bool {
349        *self == WUPE23_A::_01
350    }
351    #[doc = "Checks if the value of the field is `_10`"]
352    #[inline(always)]
353    pub fn is_10(&self) -> bool {
354        *self == WUPE23_A::_10
355    }
356    #[doc = "Checks if the value of the field is `_11`"]
357    #[inline(always)]
358    pub fn is_11(&self) -> bool {
359        *self == WUPE23_A::_11
360    }
361}
362#[doc = "Write proxy for field `WUPE23`"]
363pub struct WUPE23_W<'a> {
364    w: &'a mut W,
365}
366impl<'a> WUPE23_W<'a> {
367    #[doc = r"Writes `variant` to the field"]
368    #[inline(always)]
369    pub fn variant(self, variant: WUPE23_A) -> &'a mut W {
370        {
371            self.bits(variant.into())
372        }
373    }
374    #[doc = "External input pin disabled as wakeup input"]
375    #[inline(always)]
376    pub fn _00(self) -> &'a mut W {
377        self.variant(WUPE23_A::_00)
378    }
379    #[doc = "External input pin enabled with rising edge detection"]
380    #[inline(always)]
381    pub fn _01(self) -> &'a mut W {
382        self.variant(WUPE23_A::_01)
383    }
384    #[doc = "External input pin enabled with falling edge detection"]
385    #[inline(always)]
386    pub fn _10(self) -> &'a mut W {
387        self.variant(WUPE23_A::_10)
388    }
389    #[doc = "External input pin enabled with any change detection"]
390    #[inline(always)]
391    pub fn _11(self) -> &'a mut W {
392        self.variant(WUPE23_A::_11)
393    }
394    #[doc = r"Writes raw bits to the field"]
395    #[inline(always)]
396    pub fn bits(self, value: u8) -> &'a mut W {
397        self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u8) & 0x03) << 6);
398        self.w
399    }
400}
401impl R {
402    #[doc = "Bits 0:1 - Wakeup Pin Enable For LLWU_P20"]
403    #[inline(always)]
404    pub fn wupe20(&self) -> WUPE20_R {
405        WUPE20_R::new((self.bits & 0x03) as u8)
406    }
407    #[doc = "Bits 2:3 - Wakeup Pin Enable For LLWU_P21"]
408    #[inline(always)]
409    pub fn wupe21(&self) -> WUPE21_R {
410        WUPE21_R::new(((self.bits >> 2) & 0x03) as u8)
411    }
412    #[doc = "Bits 4:5 - Wakeup Pin Enable For LLWU_P22"]
413    #[inline(always)]
414    pub fn wupe22(&self) -> WUPE22_R {
415        WUPE22_R::new(((self.bits >> 4) & 0x03) as u8)
416    }
417    #[doc = "Bits 6:7 - Wakeup Pin Enable For LLWU_P23"]
418    #[inline(always)]
419    pub fn wupe23(&self) -> WUPE23_R {
420        WUPE23_R::new(((self.bits >> 6) & 0x03) as u8)
421    }
422}
423impl W {
424    #[doc = "Bits 0:1 - Wakeup Pin Enable For LLWU_P20"]
425    #[inline(always)]
426    pub fn wupe20(&mut self) -> WUPE20_W {
427        WUPE20_W { w: self }
428    }
429    #[doc = "Bits 2:3 - Wakeup Pin Enable For LLWU_P21"]
430    #[inline(always)]
431    pub fn wupe21(&mut self) -> WUPE21_W {
432        WUPE21_W { w: self }
433    }
434    #[doc = "Bits 4:5 - Wakeup Pin Enable For LLWU_P22"]
435    #[inline(always)]
436    pub fn wupe22(&mut self) -> WUPE22_W {
437        WUPE22_W { w: self }
438    }
439    #[doc = "Bits 6:7 - Wakeup Pin Enable For LLWU_P23"]
440    #[inline(always)]
441    pub fn wupe23(&mut self) -> WUPE23_W {
442        WUPE23_W { w: self }
443    }
444}