Skip to main content

atsamv71n21/supc/
supc_wumr.rs

1#[doc = "Register `SUPC_WUMR` reader"]
2pub struct R(crate::R<SUPC_WUMR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SUPC_WUMR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SUPC_WUMR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SUPC_WUMR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SUPC_WUMR` writer"]
17pub struct W(crate::W<SUPC_WUMR_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SUPC_WUMR_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<SUPC_WUMR_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SUPC_WUMR_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Supply Monitor Wakeup Enable\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum SMEN_A {
40    #[doc = "0: The supply monitor detection has no wakeup effect."]
41    NOT_ENABLE = 0,
42    #[doc = "1: The supply monitor detection forces the wakeup of the core power supply."]
43    ENABLE = 1,
44}
45impl From<SMEN_A> for bool {
46    #[inline(always)]
47    fn from(variant: SMEN_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `SMEN` reader - Supply Monitor Wakeup Enable"]
52pub struct SMEN_R(crate::FieldReader<bool, SMEN_A>);
53impl SMEN_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        SMEN_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> SMEN_A {
61        match self.bits {
62            false => SMEN_A::NOT_ENABLE,
63            true => SMEN_A::ENABLE,
64        }
65    }
66    #[doc = "Checks if the value of the field is `NOT_ENABLE`"]
67    #[inline(always)]
68    pub fn is_not_enable(&self) -> bool {
69        **self == SMEN_A::NOT_ENABLE
70    }
71    #[doc = "Checks if the value of the field is `ENABLE`"]
72    #[inline(always)]
73    pub fn is_enable(&self) -> bool {
74        **self == SMEN_A::ENABLE
75    }
76}
77impl core::ops::Deref for SMEN_R {
78    type Target = crate::FieldReader<bool, SMEN_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Field `SMEN` writer - Supply Monitor Wakeup Enable"]
85pub struct SMEN_W<'a> {
86    w: &'a mut W,
87}
88impl<'a> SMEN_W<'a> {
89    #[doc = r"Writes `variant` to the field"]
90    #[inline(always)]
91    pub fn variant(self, variant: SMEN_A) -> &'a mut W {
92        self.bit(variant.into())
93    }
94    #[doc = "The supply monitor detection has no wakeup effect."]
95    #[inline(always)]
96    pub fn not_enable(self) -> &'a mut W {
97        self.variant(SMEN_A::NOT_ENABLE)
98    }
99    #[doc = "The supply monitor detection forces the wakeup of the core power supply."]
100    #[inline(always)]
101    pub fn enable(self) -> &'a mut W {
102        self.variant(SMEN_A::ENABLE)
103    }
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
118        self.w
119    }
120}
121#[doc = "Real-time Timer Wakeup Enable\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum RTTEN_A {
124    #[doc = "0: The RTT alarm signal has no wakeup effect."]
125    NOT_ENABLE = 0,
126    #[doc = "1: The RTT alarm signal forces the wakeup of the core power supply."]
127    ENABLE = 1,
128}
129impl From<RTTEN_A> for bool {
130    #[inline(always)]
131    fn from(variant: RTTEN_A) -> Self {
132        variant as u8 != 0
133    }
134}
135#[doc = "Field `RTTEN` reader - Real-time Timer Wakeup Enable"]
136pub struct RTTEN_R(crate::FieldReader<bool, RTTEN_A>);
137impl RTTEN_R {
138    #[inline(always)]
139    pub(crate) fn new(bits: bool) -> Self {
140        RTTEN_R(crate::FieldReader::new(bits))
141    }
142    #[doc = r"Get enumerated values variant"]
143    #[inline(always)]
144    pub fn variant(&self) -> RTTEN_A {
145        match self.bits {
146            false => RTTEN_A::NOT_ENABLE,
147            true => RTTEN_A::ENABLE,
148        }
149    }
150    #[doc = "Checks if the value of the field is `NOT_ENABLE`"]
151    #[inline(always)]
152    pub fn is_not_enable(&self) -> bool {
153        **self == RTTEN_A::NOT_ENABLE
154    }
155    #[doc = "Checks if the value of the field is `ENABLE`"]
156    #[inline(always)]
157    pub fn is_enable(&self) -> bool {
158        **self == RTTEN_A::ENABLE
159    }
160}
161impl core::ops::Deref for RTTEN_R {
162    type Target = crate::FieldReader<bool, RTTEN_A>;
163    #[inline(always)]
164    fn deref(&self) -> &Self::Target {
165        &self.0
166    }
167}
168#[doc = "Field `RTTEN` writer - Real-time Timer Wakeup Enable"]
169pub struct RTTEN_W<'a> {
170    w: &'a mut W,
171}
172impl<'a> RTTEN_W<'a> {
173    #[doc = r"Writes `variant` to the field"]
174    #[inline(always)]
175    pub fn variant(self, variant: RTTEN_A) -> &'a mut W {
176        self.bit(variant.into())
177    }
178    #[doc = "The RTT alarm signal has no wakeup effect."]
179    #[inline(always)]
180    pub fn not_enable(self) -> &'a mut W {
181        self.variant(RTTEN_A::NOT_ENABLE)
182    }
183    #[doc = "The RTT alarm signal forces the wakeup of the core power supply."]
184    #[inline(always)]
185    pub fn enable(self) -> &'a mut W {
186        self.variant(RTTEN_A::ENABLE)
187    }
188    #[doc = r"Sets the field bit"]
189    #[inline(always)]
190    pub fn set_bit(self) -> &'a mut W {
191        self.bit(true)
192    }
193    #[doc = r"Clears the field bit"]
194    #[inline(always)]
195    pub fn clear_bit(self) -> &'a mut W {
196        self.bit(false)
197    }
198    #[doc = r"Writes raw bits to the field"]
199    #[inline(always)]
200    pub fn bit(self, value: bool) -> &'a mut W {
201        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
202        self.w
203    }
204}
205#[doc = "Real-time Clock Wakeup Enable\n\nValue on reset: 0"]
206#[derive(Clone, Copy, Debug, PartialEq)]
207pub enum RTCEN_A {
208    #[doc = "0: The RTC alarm signal has no wakeup effect."]
209    NOT_ENABLE = 0,
210    #[doc = "1: The RTC alarm signal forces the wakeup of the core power supply."]
211    ENABLE = 1,
212}
213impl From<RTCEN_A> for bool {
214    #[inline(always)]
215    fn from(variant: RTCEN_A) -> Self {
216        variant as u8 != 0
217    }
218}
219#[doc = "Field `RTCEN` reader - Real-time Clock Wakeup Enable"]
220pub struct RTCEN_R(crate::FieldReader<bool, RTCEN_A>);
221impl RTCEN_R {
222    #[inline(always)]
223    pub(crate) fn new(bits: bool) -> Self {
224        RTCEN_R(crate::FieldReader::new(bits))
225    }
226    #[doc = r"Get enumerated values variant"]
227    #[inline(always)]
228    pub fn variant(&self) -> RTCEN_A {
229        match self.bits {
230            false => RTCEN_A::NOT_ENABLE,
231            true => RTCEN_A::ENABLE,
232        }
233    }
234    #[doc = "Checks if the value of the field is `NOT_ENABLE`"]
235    #[inline(always)]
236    pub fn is_not_enable(&self) -> bool {
237        **self == RTCEN_A::NOT_ENABLE
238    }
239    #[doc = "Checks if the value of the field is `ENABLE`"]
240    #[inline(always)]
241    pub fn is_enable(&self) -> bool {
242        **self == RTCEN_A::ENABLE
243    }
244}
245impl core::ops::Deref for RTCEN_R {
246    type Target = crate::FieldReader<bool, RTCEN_A>;
247    #[inline(always)]
248    fn deref(&self) -> &Self::Target {
249        &self.0
250    }
251}
252#[doc = "Field `RTCEN` writer - Real-time Clock Wakeup Enable"]
253pub struct RTCEN_W<'a> {
254    w: &'a mut W,
255}
256impl<'a> RTCEN_W<'a> {
257    #[doc = r"Writes `variant` to the field"]
258    #[inline(always)]
259    pub fn variant(self, variant: RTCEN_A) -> &'a mut W {
260        self.bit(variant.into())
261    }
262    #[doc = "The RTC alarm signal has no wakeup effect."]
263    #[inline(always)]
264    pub fn not_enable(self) -> &'a mut W {
265        self.variant(RTCEN_A::NOT_ENABLE)
266    }
267    #[doc = "The RTC alarm signal forces the wakeup of the core power supply."]
268    #[inline(always)]
269    pub fn enable(self) -> &'a mut W {
270        self.variant(RTCEN_A::ENABLE)
271    }
272    #[doc = r"Sets the field bit"]
273    #[inline(always)]
274    pub fn set_bit(self) -> &'a mut W {
275        self.bit(true)
276    }
277    #[doc = r"Clears the field bit"]
278    #[inline(always)]
279    pub fn clear_bit(self) -> &'a mut W {
280        self.bit(false)
281    }
282    #[doc = r"Writes raw bits to the field"]
283    #[inline(always)]
284    pub fn bit(self, value: bool) -> &'a mut W {
285        self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
286        self.w
287    }
288}
289#[doc = "Low-power Debouncer Enable WKUP0\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291pub enum LPDBCEN0_A {
292    #[doc = "0: The WKUP0 input pin is not connected to the low-power debouncer."]
293    NOT_ENABLE = 0,
294    #[doc = "1: The WKUP0 input pin is connected to the low-power debouncer and forces a system wakeup."]
295    ENABLE = 1,
296}
297impl From<LPDBCEN0_A> for bool {
298    #[inline(always)]
299    fn from(variant: LPDBCEN0_A) -> Self {
300        variant as u8 != 0
301    }
302}
303#[doc = "Field `LPDBCEN0` reader - Low-power Debouncer Enable WKUP0"]
304pub struct LPDBCEN0_R(crate::FieldReader<bool, LPDBCEN0_A>);
305impl LPDBCEN0_R {
306    #[inline(always)]
307    pub(crate) fn new(bits: bool) -> Self {
308        LPDBCEN0_R(crate::FieldReader::new(bits))
309    }
310    #[doc = r"Get enumerated values variant"]
311    #[inline(always)]
312    pub fn variant(&self) -> LPDBCEN0_A {
313        match self.bits {
314            false => LPDBCEN0_A::NOT_ENABLE,
315            true => LPDBCEN0_A::ENABLE,
316        }
317    }
318    #[doc = "Checks if the value of the field is `NOT_ENABLE`"]
319    #[inline(always)]
320    pub fn is_not_enable(&self) -> bool {
321        **self == LPDBCEN0_A::NOT_ENABLE
322    }
323    #[doc = "Checks if the value of the field is `ENABLE`"]
324    #[inline(always)]
325    pub fn is_enable(&self) -> bool {
326        **self == LPDBCEN0_A::ENABLE
327    }
328}
329impl core::ops::Deref for LPDBCEN0_R {
330    type Target = crate::FieldReader<bool, LPDBCEN0_A>;
331    #[inline(always)]
332    fn deref(&self) -> &Self::Target {
333        &self.0
334    }
335}
336#[doc = "Field `LPDBCEN0` writer - Low-power Debouncer Enable WKUP0"]
337pub struct LPDBCEN0_W<'a> {
338    w: &'a mut W,
339}
340impl<'a> LPDBCEN0_W<'a> {
341    #[doc = r"Writes `variant` to the field"]
342    #[inline(always)]
343    pub fn variant(self, variant: LPDBCEN0_A) -> &'a mut W {
344        self.bit(variant.into())
345    }
346    #[doc = "The WKUP0 input pin is not connected to the low-power debouncer."]
347    #[inline(always)]
348    pub fn not_enable(self) -> &'a mut W {
349        self.variant(LPDBCEN0_A::NOT_ENABLE)
350    }
351    #[doc = "The WKUP0 input pin is connected to the low-power debouncer and forces a system wakeup."]
352    #[inline(always)]
353    pub fn enable(self) -> &'a mut W {
354        self.variant(LPDBCEN0_A::ENABLE)
355    }
356    #[doc = r"Sets the field bit"]
357    #[inline(always)]
358    pub fn set_bit(self) -> &'a mut W {
359        self.bit(true)
360    }
361    #[doc = r"Clears the field bit"]
362    #[inline(always)]
363    pub fn clear_bit(self) -> &'a mut W {
364        self.bit(false)
365    }
366    #[doc = r"Writes raw bits to the field"]
367    #[inline(always)]
368    pub fn bit(self, value: bool) -> &'a mut W {
369        self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
370        self.w
371    }
372}
373#[doc = "Low-power Debouncer Enable WKUP1\n\nValue on reset: 0"]
374#[derive(Clone, Copy, Debug, PartialEq)]
375pub enum LPDBCEN1_A {
376    #[doc = "0: The WKUP1 input pin is not connected to the low-power debouncer."]
377    NOT_ENABLE = 0,
378    #[doc = "1: The WKUP1 input pin is connected to the low-power debouncer and forces a system wakeup."]
379    ENABLE = 1,
380}
381impl From<LPDBCEN1_A> for bool {
382    #[inline(always)]
383    fn from(variant: LPDBCEN1_A) -> Self {
384        variant as u8 != 0
385    }
386}
387#[doc = "Field `LPDBCEN1` reader - Low-power Debouncer Enable WKUP1"]
388pub struct LPDBCEN1_R(crate::FieldReader<bool, LPDBCEN1_A>);
389impl LPDBCEN1_R {
390    #[inline(always)]
391    pub(crate) fn new(bits: bool) -> Self {
392        LPDBCEN1_R(crate::FieldReader::new(bits))
393    }
394    #[doc = r"Get enumerated values variant"]
395    #[inline(always)]
396    pub fn variant(&self) -> LPDBCEN1_A {
397        match self.bits {
398            false => LPDBCEN1_A::NOT_ENABLE,
399            true => LPDBCEN1_A::ENABLE,
400        }
401    }
402    #[doc = "Checks if the value of the field is `NOT_ENABLE`"]
403    #[inline(always)]
404    pub fn is_not_enable(&self) -> bool {
405        **self == LPDBCEN1_A::NOT_ENABLE
406    }
407    #[doc = "Checks if the value of the field is `ENABLE`"]
408    #[inline(always)]
409    pub fn is_enable(&self) -> bool {
410        **self == LPDBCEN1_A::ENABLE
411    }
412}
413impl core::ops::Deref for LPDBCEN1_R {
414    type Target = crate::FieldReader<bool, LPDBCEN1_A>;
415    #[inline(always)]
416    fn deref(&self) -> &Self::Target {
417        &self.0
418    }
419}
420#[doc = "Field `LPDBCEN1` writer - Low-power Debouncer Enable WKUP1"]
421pub struct LPDBCEN1_W<'a> {
422    w: &'a mut W,
423}
424impl<'a> LPDBCEN1_W<'a> {
425    #[doc = r"Writes `variant` to the field"]
426    #[inline(always)]
427    pub fn variant(self, variant: LPDBCEN1_A) -> &'a mut W {
428        self.bit(variant.into())
429    }
430    #[doc = "The WKUP1 input pin is not connected to the low-power debouncer."]
431    #[inline(always)]
432    pub fn not_enable(self) -> &'a mut W {
433        self.variant(LPDBCEN1_A::NOT_ENABLE)
434    }
435    #[doc = "The WKUP1 input pin is connected to the low-power debouncer and forces a system wakeup."]
436    #[inline(always)]
437    pub fn enable(self) -> &'a mut W {
438        self.variant(LPDBCEN1_A::ENABLE)
439    }
440    #[doc = r"Sets the field bit"]
441    #[inline(always)]
442    pub fn set_bit(self) -> &'a mut W {
443        self.bit(true)
444    }
445    #[doc = r"Clears the field bit"]
446    #[inline(always)]
447    pub fn clear_bit(self) -> &'a mut W {
448        self.bit(false)
449    }
450    #[doc = r"Writes raw bits to the field"]
451    #[inline(always)]
452    pub fn bit(self, value: bool) -> &'a mut W {
453        self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
454        self.w
455    }
456}
457#[doc = "Low-power Debouncer Clear\n\nValue on reset: 0"]
458#[derive(Clone, Copy, Debug, PartialEq)]
459pub enum LPDBCCLR_A {
460    #[doc = "0: A low-power debounce event does not create an immediate clear on the first half of GPBR registers."]
461    NOT_ENABLE = 0,
462    #[doc = "1: A low-power debounce event on WKUP0 or WKUP1 generates an immediate clear on the first half of GPBR registers."]
463    ENABLE = 1,
464}
465impl From<LPDBCCLR_A> for bool {
466    #[inline(always)]
467    fn from(variant: LPDBCCLR_A) -> Self {
468        variant as u8 != 0
469    }
470}
471#[doc = "Field `LPDBCCLR` reader - Low-power Debouncer Clear"]
472pub struct LPDBCCLR_R(crate::FieldReader<bool, LPDBCCLR_A>);
473impl LPDBCCLR_R {
474    #[inline(always)]
475    pub(crate) fn new(bits: bool) -> Self {
476        LPDBCCLR_R(crate::FieldReader::new(bits))
477    }
478    #[doc = r"Get enumerated values variant"]
479    #[inline(always)]
480    pub fn variant(&self) -> LPDBCCLR_A {
481        match self.bits {
482            false => LPDBCCLR_A::NOT_ENABLE,
483            true => LPDBCCLR_A::ENABLE,
484        }
485    }
486    #[doc = "Checks if the value of the field is `NOT_ENABLE`"]
487    #[inline(always)]
488    pub fn is_not_enable(&self) -> bool {
489        **self == LPDBCCLR_A::NOT_ENABLE
490    }
491    #[doc = "Checks if the value of the field is `ENABLE`"]
492    #[inline(always)]
493    pub fn is_enable(&self) -> bool {
494        **self == LPDBCCLR_A::ENABLE
495    }
496}
497impl core::ops::Deref for LPDBCCLR_R {
498    type Target = crate::FieldReader<bool, LPDBCCLR_A>;
499    #[inline(always)]
500    fn deref(&self) -> &Self::Target {
501        &self.0
502    }
503}
504#[doc = "Field `LPDBCCLR` writer - Low-power Debouncer Clear"]
505pub struct LPDBCCLR_W<'a> {
506    w: &'a mut W,
507}
508impl<'a> LPDBCCLR_W<'a> {
509    #[doc = r"Writes `variant` to the field"]
510    #[inline(always)]
511    pub fn variant(self, variant: LPDBCCLR_A) -> &'a mut W {
512        self.bit(variant.into())
513    }
514    #[doc = "A low-power debounce event does not create an immediate clear on the first half of GPBR registers."]
515    #[inline(always)]
516    pub fn not_enable(self) -> &'a mut W {
517        self.variant(LPDBCCLR_A::NOT_ENABLE)
518    }
519    #[doc = "A low-power debounce event on WKUP0 or WKUP1 generates an immediate clear on the first half of GPBR registers."]
520    #[inline(always)]
521    pub fn enable(self) -> &'a mut W {
522        self.variant(LPDBCCLR_A::ENABLE)
523    }
524    #[doc = r"Sets the field bit"]
525    #[inline(always)]
526    pub fn set_bit(self) -> &'a mut W {
527        self.bit(true)
528    }
529    #[doc = r"Clears the field bit"]
530    #[inline(always)]
531    pub fn clear_bit(self) -> &'a mut W {
532        self.bit(false)
533    }
534    #[doc = r"Writes raw bits to the field"]
535    #[inline(always)]
536    pub fn bit(self, value: bool) -> &'a mut W {
537        self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
538        self.w
539    }
540}
541#[doc = "Wakeup Inputs Debouncer Period\n\nValue on reset: 0"]
542#[derive(Clone, Copy, Debug, PartialEq)]
543#[repr(u8)]
544pub enum WKUPDBC_A {
545    #[doc = "0: Immediate, no debouncing, detected active at least on one Slow Clock edge."]
546    IMMEDIATE = 0,
547    #[doc = "1: WKUPx shall be in its active state for at least 3 SLCK periods"]
548    _3_SLCK = 1,
549    #[doc = "2: WKUPx shall be in its active state for at least 32 SLCK periods"]
550    _32_SLCK = 2,
551    #[doc = "3: WKUPx shall be in its active state for at least 512 SLCK periods"]
552    _512_SLCK = 3,
553    #[doc = "4: WKUPx shall be in its active state for at least 4,096 SLCK periods"]
554    _4096_SLCK = 4,
555    #[doc = "5: WKUPx shall be in its active state for at least 32,768 SLCK periods"]
556    _32768_SLCK = 5,
557}
558impl From<WKUPDBC_A> for u8 {
559    #[inline(always)]
560    fn from(variant: WKUPDBC_A) -> Self {
561        variant as _
562    }
563}
564#[doc = "Field `WKUPDBC` reader - Wakeup Inputs Debouncer Period"]
565pub struct WKUPDBC_R(crate::FieldReader<u8, WKUPDBC_A>);
566impl WKUPDBC_R {
567    #[inline(always)]
568    pub(crate) fn new(bits: u8) -> Self {
569        WKUPDBC_R(crate::FieldReader::new(bits))
570    }
571    #[doc = r"Get enumerated values variant"]
572    #[inline(always)]
573    pub fn variant(&self) -> Option<WKUPDBC_A> {
574        match self.bits {
575            0 => Some(WKUPDBC_A::IMMEDIATE),
576            1 => Some(WKUPDBC_A::_3_SLCK),
577            2 => Some(WKUPDBC_A::_32_SLCK),
578            3 => Some(WKUPDBC_A::_512_SLCK),
579            4 => Some(WKUPDBC_A::_4096_SLCK),
580            5 => Some(WKUPDBC_A::_32768_SLCK),
581            _ => None,
582        }
583    }
584    #[doc = "Checks if the value of the field is `IMMEDIATE`"]
585    #[inline(always)]
586    pub fn is_immediate(&self) -> bool {
587        **self == WKUPDBC_A::IMMEDIATE
588    }
589    #[doc = "Checks if the value of the field is `_3_SLCK`"]
590    #[inline(always)]
591    pub fn is_3_slck(&self) -> bool {
592        **self == WKUPDBC_A::_3_SLCK
593    }
594    #[doc = "Checks if the value of the field is `_32_SLCK`"]
595    #[inline(always)]
596    pub fn is_32_slck(&self) -> bool {
597        **self == WKUPDBC_A::_32_SLCK
598    }
599    #[doc = "Checks if the value of the field is `_512_SLCK`"]
600    #[inline(always)]
601    pub fn is_512_slck(&self) -> bool {
602        **self == WKUPDBC_A::_512_SLCK
603    }
604    #[doc = "Checks if the value of the field is `_4096_SLCK`"]
605    #[inline(always)]
606    pub fn is_4096_slck(&self) -> bool {
607        **self == WKUPDBC_A::_4096_SLCK
608    }
609    #[doc = "Checks if the value of the field is `_32768_SLCK`"]
610    #[inline(always)]
611    pub fn is_32768_slck(&self) -> bool {
612        **self == WKUPDBC_A::_32768_SLCK
613    }
614}
615impl core::ops::Deref for WKUPDBC_R {
616    type Target = crate::FieldReader<u8, WKUPDBC_A>;
617    #[inline(always)]
618    fn deref(&self) -> &Self::Target {
619        &self.0
620    }
621}
622#[doc = "Field `WKUPDBC` writer - Wakeup Inputs Debouncer Period"]
623pub struct WKUPDBC_W<'a> {
624    w: &'a mut W,
625}
626impl<'a> WKUPDBC_W<'a> {
627    #[doc = r"Writes `variant` to the field"]
628    #[inline(always)]
629    pub fn variant(self, variant: WKUPDBC_A) -> &'a mut W {
630        unsafe { self.bits(variant.into()) }
631    }
632    #[doc = "Immediate, no debouncing, detected active at least on one Slow Clock edge."]
633    #[inline(always)]
634    pub fn immediate(self) -> &'a mut W {
635        self.variant(WKUPDBC_A::IMMEDIATE)
636    }
637    #[doc = "WKUPx shall be in its active state for at least 3 SLCK periods"]
638    #[inline(always)]
639    pub fn _3_slck(self) -> &'a mut W {
640        self.variant(WKUPDBC_A::_3_SLCK)
641    }
642    #[doc = "WKUPx shall be in its active state for at least 32 SLCK periods"]
643    #[inline(always)]
644    pub fn _32_slck(self) -> &'a mut W {
645        self.variant(WKUPDBC_A::_32_SLCK)
646    }
647    #[doc = "WKUPx shall be in its active state for at least 512 SLCK periods"]
648    #[inline(always)]
649    pub fn _512_slck(self) -> &'a mut W {
650        self.variant(WKUPDBC_A::_512_SLCK)
651    }
652    #[doc = "WKUPx shall be in its active state for at least 4,096 SLCK periods"]
653    #[inline(always)]
654    pub fn _4096_slck(self) -> &'a mut W {
655        self.variant(WKUPDBC_A::_4096_SLCK)
656    }
657    #[doc = "WKUPx shall be in its active state for at least 32,768 SLCK periods"]
658    #[inline(always)]
659    pub fn _32768_slck(self) -> &'a mut W {
660        self.variant(WKUPDBC_A::_32768_SLCK)
661    }
662    #[doc = r"Writes raw bits to the field"]
663    #[inline(always)]
664    pub unsafe fn bits(self, value: u8) -> &'a mut W {
665        self.w.bits = (self.w.bits & !(0x07 << 12)) | ((value as u32 & 0x07) << 12);
666        self.w
667    }
668}
669#[doc = "Low-power Debouncer Period\n\nValue on reset: 0"]
670#[derive(Clone, Copy, Debug, PartialEq)]
671#[repr(u8)]
672pub enum LPDBC_A {
673    #[doc = "0: Disables the low-power debouncers."]
674    DISABLE = 0,
675    #[doc = "1: WKUP0/1 in active state for at least 2 RTCOUTx clock periods"]
676    _2_RTCOUT = 1,
677    #[doc = "2: WKUP0/1 in active state for at least 3 RTCOUTx clock periods"]
678    _3_RTCOUT = 2,
679    #[doc = "3: WKUP0/1 in active state for at least 4 RTCOUTx clock periods"]
680    _4_RTCOUT = 3,
681    #[doc = "4: WKUP0/1 in active state for at least 5 RTCOUTx clock periods"]
682    _5_RTCOUT = 4,
683    #[doc = "5: WKUP0/1 in active state for at least 6 RTCOUTx clock periods"]
684    _6_RTCOUT = 5,
685    #[doc = "6: WKUP0/1 in active state for at least 7 RTCOUTx clock periods"]
686    _7_RTCOUT = 6,
687    #[doc = "7: WKUP0/1 in active state for at least 8 RTCOUTx clock periods"]
688    _8_RTCOUT = 7,
689}
690impl From<LPDBC_A> for u8 {
691    #[inline(always)]
692    fn from(variant: LPDBC_A) -> Self {
693        variant as _
694    }
695}
696#[doc = "Field `LPDBC` reader - Low-power Debouncer Period"]
697pub struct LPDBC_R(crate::FieldReader<u8, LPDBC_A>);
698impl LPDBC_R {
699    #[inline(always)]
700    pub(crate) fn new(bits: u8) -> Self {
701        LPDBC_R(crate::FieldReader::new(bits))
702    }
703    #[doc = r"Get enumerated values variant"]
704    #[inline(always)]
705    pub fn variant(&self) -> LPDBC_A {
706        match self.bits {
707            0 => LPDBC_A::DISABLE,
708            1 => LPDBC_A::_2_RTCOUT,
709            2 => LPDBC_A::_3_RTCOUT,
710            3 => LPDBC_A::_4_RTCOUT,
711            4 => LPDBC_A::_5_RTCOUT,
712            5 => LPDBC_A::_6_RTCOUT,
713            6 => LPDBC_A::_7_RTCOUT,
714            7 => LPDBC_A::_8_RTCOUT,
715            _ => unreachable!(),
716        }
717    }
718    #[doc = "Checks if the value of the field is `DISABLE`"]
719    #[inline(always)]
720    pub fn is_disable(&self) -> bool {
721        **self == LPDBC_A::DISABLE
722    }
723    #[doc = "Checks if the value of the field is `_2_RTCOUT`"]
724    #[inline(always)]
725    pub fn is_2_rtcout(&self) -> bool {
726        **self == LPDBC_A::_2_RTCOUT
727    }
728    #[doc = "Checks if the value of the field is `_3_RTCOUT`"]
729    #[inline(always)]
730    pub fn is_3_rtcout(&self) -> bool {
731        **self == LPDBC_A::_3_RTCOUT
732    }
733    #[doc = "Checks if the value of the field is `_4_RTCOUT`"]
734    #[inline(always)]
735    pub fn is_4_rtcout(&self) -> bool {
736        **self == LPDBC_A::_4_RTCOUT
737    }
738    #[doc = "Checks if the value of the field is `_5_RTCOUT`"]
739    #[inline(always)]
740    pub fn is_5_rtcout(&self) -> bool {
741        **self == LPDBC_A::_5_RTCOUT
742    }
743    #[doc = "Checks if the value of the field is `_6_RTCOUT`"]
744    #[inline(always)]
745    pub fn is_6_rtcout(&self) -> bool {
746        **self == LPDBC_A::_6_RTCOUT
747    }
748    #[doc = "Checks if the value of the field is `_7_RTCOUT`"]
749    #[inline(always)]
750    pub fn is_7_rtcout(&self) -> bool {
751        **self == LPDBC_A::_7_RTCOUT
752    }
753    #[doc = "Checks if the value of the field is `_8_RTCOUT`"]
754    #[inline(always)]
755    pub fn is_8_rtcout(&self) -> bool {
756        **self == LPDBC_A::_8_RTCOUT
757    }
758}
759impl core::ops::Deref for LPDBC_R {
760    type Target = crate::FieldReader<u8, LPDBC_A>;
761    #[inline(always)]
762    fn deref(&self) -> &Self::Target {
763        &self.0
764    }
765}
766#[doc = "Field `LPDBC` writer - Low-power Debouncer Period"]
767pub struct LPDBC_W<'a> {
768    w: &'a mut W,
769}
770impl<'a> LPDBC_W<'a> {
771    #[doc = r"Writes `variant` to the field"]
772    #[inline(always)]
773    pub fn variant(self, variant: LPDBC_A) -> &'a mut W {
774        self.bits(variant.into())
775    }
776    #[doc = "Disables the low-power debouncers."]
777    #[inline(always)]
778    pub fn disable(self) -> &'a mut W {
779        self.variant(LPDBC_A::DISABLE)
780    }
781    #[doc = "WKUP0/1 in active state for at least 2 RTCOUTx clock periods"]
782    #[inline(always)]
783    pub fn _2_rtcout(self) -> &'a mut W {
784        self.variant(LPDBC_A::_2_RTCOUT)
785    }
786    #[doc = "WKUP0/1 in active state for at least 3 RTCOUTx clock periods"]
787    #[inline(always)]
788    pub fn _3_rtcout(self) -> &'a mut W {
789        self.variant(LPDBC_A::_3_RTCOUT)
790    }
791    #[doc = "WKUP0/1 in active state for at least 4 RTCOUTx clock periods"]
792    #[inline(always)]
793    pub fn _4_rtcout(self) -> &'a mut W {
794        self.variant(LPDBC_A::_4_RTCOUT)
795    }
796    #[doc = "WKUP0/1 in active state for at least 5 RTCOUTx clock periods"]
797    #[inline(always)]
798    pub fn _5_rtcout(self) -> &'a mut W {
799        self.variant(LPDBC_A::_5_RTCOUT)
800    }
801    #[doc = "WKUP0/1 in active state for at least 6 RTCOUTx clock periods"]
802    #[inline(always)]
803    pub fn _6_rtcout(self) -> &'a mut W {
804        self.variant(LPDBC_A::_6_RTCOUT)
805    }
806    #[doc = "WKUP0/1 in active state for at least 7 RTCOUTx clock periods"]
807    #[inline(always)]
808    pub fn _7_rtcout(self) -> &'a mut W {
809        self.variant(LPDBC_A::_7_RTCOUT)
810    }
811    #[doc = "WKUP0/1 in active state for at least 8 RTCOUTx clock periods"]
812    #[inline(always)]
813    pub fn _8_rtcout(self) -> &'a mut W {
814        self.variant(LPDBC_A::_8_RTCOUT)
815    }
816    #[doc = r"Writes raw bits to the field"]
817    #[inline(always)]
818    pub fn bits(self, value: u8) -> &'a mut W {
819        self.w.bits = (self.w.bits & !(0x07 << 16)) | ((value as u32 & 0x07) << 16);
820        self.w
821    }
822}
823impl R {
824    #[doc = "Bit 1 - Supply Monitor Wakeup Enable"]
825    #[inline(always)]
826    pub fn smen(&self) -> SMEN_R {
827        SMEN_R::new(((self.bits >> 1) & 0x01) != 0)
828    }
829    #[doc = "Bit 2 - Real-time Timer Wakeup Enable"]
830    #[inline(always)]
831    pub fn rtten(&self) -> RTTEN_R {
832        RTTEN_R::new(((self.bits >> 2) & 0x01) != 0)
833    }
834    #[doc = "Bit 3 - Real-time Clock Wakeup Enable"]
835    #[inline(always)]
836    pub fn rtcen(&self) -> RTCEN_R {
837        RTCEN_R::new(((self.bits >> 3) & 0x01) != 0)
838    }
839    #[doc = "Bit 5 - Low-power Debouncer Enable WKUP0"]
840    #[inline(always)]
841    pub fn lpdbcen0(&self) -> LPDBCEN0_R {
842        LPDBCEN0_R::new(((self.bits >> 5) & 0x01) != 0)
843    }
844    #[doc = "Bit 6 - Low-power Debouncer Enable WKUP1"]
845    #[inline(always)]
846    pub fn lpdbcen1(&self) -> LPDBCEN1_R {
847        LPDBCEN1_R::new(((self.bits >> 6) & 0x01) != 0)
848    }
849    #[doc = "Bit 7 - Low-power Debouncer Clear"]
850    #[inline(always)]
851    pub fn lpdbcclr(&self) -> LPDBCCLR_R {
852        LPDBCCLR_R::new(((self.bits >> 7) & 0x01) != 0)
853    }
854    #[doc = "Bits 12:14 - Wakeup Inputs Debouncer Period"]
855    #[inline(always)]
856    pub fn wkupdbc(&self) -> WKUPDBC_R {
857        WKUPDBC_R::new(((self.bits >> 12) & 0x07) as u8)
858    }
859    #[doc = "Bits 16:18 - Low-power Debouncer Period"]
860    #[inline(always)]
861    pub fn lpdbc(&self) -> LPDBC_R {
862        LPDBC_R::new(((self.bits >> 16) & 0x07) as u8)
863    }
864}
865impl W {
866    #[doc = "Bit 1 - Supply Monitor Wakeup Enable"]
867    #[inline(always)]
868    pub fn smen(&mut self) -> SMEN_W {
869        SMEN_W { w: self }
870    }
871    #[doc = "Bit 2 - Real-time Timer Wakeup Enable"]
872    #[inline(always)]
873    pub fn rtten(&mut self) -> RTTEN_W {
874        RTTEN_W { w: self }
875    }
876    #[doc = "Bit 3 - Real-time Clock Wakeup Enable"]
877    #[inline(always)]
878    pub fn rtcen(&mut self) -> RTCEN_W {
879        RTCEN_W { w: self }
880    }
881    #[doc = "Bit 5 - Low-power Debouncer Enable WKUP0"]
882    #[inline(always)]
883    pub fn lpdbcen0(&mut self) -> LPDBCEN0_W {
884        LPDBCEN0_W { w: self }
885    }
886    #[doc = "Bit 6 - Low-power Debouncer Enable WKUP1"]
887    #[inline(always)]
888    pub fn lpdbcen1(&mut self) -> LPDBCEN1_W {
889        LPDBCEN1_W { w: self }
890    }
891    #[doc = "Bit 7 - Low-power Debouncer Clear"]
892    #[inline(always)]
893    pub fn lpdbcclr(&mut self) -> LPDBCCLR_W {
894        LPDBCCLR_W { w: self }
895    }
896    #[doc = "Bits 12:14 - Wakeup Inputs Debouncer Period"]
897    #[inline(always)]
898    pub fn wkupdbc(&mut self) -> WKUPDBC_W {
899        WKUPDBC_W { w: self }
900    }
901    #[doc = "Bits 16:18 - Low-power Debouncer Period"]
902    #[inline(always)]
903    pub fn lpdbc(&mut self) -> LPDBC_W {
904        LPDBC_W { w: self }
905    }
906    #[doc = "Writes raw bits to the register."]
907    #[inline(always)]
908    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
909        self.0.bits(bits);
910        self
911    }
912}
913#[doc = "Supply Controller Wakeup Mode Register\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 [supc_wumr](index.html) module"]
914pub struct SUPC_WUMR_SPEC;
915impl crate::RegisterSpec for SUPC_WUMR_SPEC {
916    type Ux = u32;
917}
918#[doc = "`read()` method returns [supc_wumr::R](R) reader structure"]
919impl crate::Readable for SUPC_WUMR_SPEC {
920    type Reader = R;
921}
922#[doc = "`write(|w| ..)` method takes [supc_wumr::W](W) writer structure"]
923impl crate::Writable for SUPC_WUMR_SPEC {
924    type Writer = W;
925}
926#[doc = "`reset()` method sets SUPC_WUMR to value 0"]
927impl crate::Resettable for SUPC_WUMR_SPEC {
928    #[inline(always)]
929    fn reset_value() -> Self::Ux {
930        0
931    }
932}