atsaml21e18a/rstc/
wkdbconf.rs1#[doc = "Register `WKDBCONF` reader"]
2pub struct R(crate::R<WKDBCONF_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<WKDBCONF_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<WKDBCONF_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<WKDBCONF_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `WKDBCONF` writer"]
17pub struct W(crate::W<WKDBCONF_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<WKDBCONF_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<WKDBCONF_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<WKDBCONF_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `WKDBCNT` reader - Wakeup Debounce Counter"]
38pub type WKDBCNT_R = crate::FieldReader<u8, WKDBCNTSELECT_A>;
39#[doc = "Wakeup Debounce Counter\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum WKDBCNTSELECT_A {
43 #[doc = "0: No debouncing.Input pin is low or high level sensitive depending on its WKPOLx bit."]
44 OFF = 0,
45 #[doc = "1: Input pin shall be active for at least two 32kHz clock period."]
46 _2CK32 = 1,
47 #[doc = "2: Input pin shall be active for at least three 32kHz clock period."]
48 _3CK32 = 2,
49 #[doc = "3: Input pin shall be active for at least 32 32kHz clock period."]
50 _32CK32 = 3,
51 #[doc = "4: Input pin shall be active for at least 512 32kHz clock period."]
52 _512CK32 = 4,
53 #[doc = "5: Input pin shall be active for at least 4096 32kHz clock period."]
54 _4096CK32 = 5,
55 #[doc = "6: Input pin shall be active for at least 32768 32kHz clock period."]
56 _32768CK32 = 6,
57}
58impl From<WKDBCNTSELECT_A> for u8 {
59 #[inline(always)]
60 fn from(variant: WKDBCNTSELECT_A) -> Self {
61 variant as _
62 }
63}
64impl WKDBCNT_R {
65 #[doc = "Get enumerated values variant"]
66 #[inline(always)]
67 pub fn variant(&self) -> Option<WKDBCNTSELECT_A> {
68 match self.bits {
69 0 => Some(WKDBCNTSELECT_A::OFF),
70 1 => Some(WKDBCNTSELECT_A::_2CK32),
71 2 => Some(WKDBCNTSELECT_A::_3CK32),
72 3 => Some(WKDBCNTSELECT_A::_32CK32),
73 4 => Some(WKDBCNTSELECT_A::_512CK32),
74 5 => Some(WKDBCNTSELECT_A::_4096CK32),
75 6 => Some(WKDBCNTSELECT_A::_32768CK32),
76 _ => None,
77 }
78 }
79 #[doc = "Checks if the value of the field is `OFF`"]
80 #[inline(always)]
81 pub fn is_off(&self) -> bool {
82 *self == WKDBCNTSELECT_A::OFF
83 }
84 #[doc = "Checks if the value of the field is `_2CK32`"]
85 #[inline(always)]
86 pub fn is_2ck32(&self) -> bool {
87 *self == WKDBCNTSELECT_A::_2CK32
88 }
89 #[doc = "Checks if the value of the field is `_3CK32`"]
90 #[inline(always)]
91 pub fn is_3ck32(&self) -> bool {
92 *self == WKDBCNTSELECT_A::_3CK32
93 }
94 #[doc = "Checks if the value of the field is `_32CK32`"]
95 #[inline(always)]
96 pub fn is_32ck32(&self) -> bool {
97 *self == WKDBCNTSELECT_A::_32CK32
98 }
99 #[doc = "Checks if the value of the field is `_512CK32`"]
100 #[inline(always)]
101 pub fn is_512ck32(&self) -> bool {
102 *self == WKDBCNTSELECT_A::_512CK32
103 }
104 #[doc = "Checks if the value of the field is `_4096CK32`"]
105 #[inline(always)]
106 pub fn is_4096ck32(&self) -> bool {
107 *self == WKDBCNTSELECT_A::_4096CK32
108 }
109 #[doc = "Checks if the value of the field is `_32768CK32`"]
110 #[inline(always)]
111 pub fn is_32768ck32(&self) -> bool {
112 *self == WKDBCNTSELECT_A::_32768CK32
113 }
114}
115#[doc = "Field `WKDBCNT` writer - Wakeup Debounce Counter"]
116pub type WKDBCNT_W<'a, const O: u8> =
117 crate::FieldWriter<'a, u8, WKDBCONF_SPEC, u8, WKDBCNTSELECT_A, 5, O>;
118impl<'a, const O: u8> WKDBCNT_W<'a, O> {
119 #[doc = "No debouncing.Input pin is low or high level sensitive depending on its WKPOLx bit."]
120 #[inline(always)]
121 pub fn off(self) -> &'a mut W {
122 self.variant(WKDBCNTSELECT_A::OFF)
123 }
124 #[doc = "Input pin shall be active for at least two 32kHz clock period."]
125 #[inline(always)]
126 pub fn _2ck32(self) -> &'a mut W {
127 self.variant(WKDBCNTSELECT_A::_2CK32)
128 }
129 #[doc = "Input pin shall be active for at least three 32kHz clock period."]
130 #[inline(always)]
131 pub fn _3ck32(self) -> &'a mut W {
132 self.variant(WKDBCNTSELECT_A::_3CK32)
133 }
134 #[doc = "Input pin shall be active for at least 32 32kHz clock period."]
135 #[inline(always)]
136 pub fn _32ck32(self) -> &'a mut W {
137 self.variant(WKDBCNTSELECT_A::_32CK32)
138 }
139 #[doc = "Input pin shall be active for at least 512 32kHz clock period."]
140 #[inline(always)]
141 pub fn _512ck32(self) -> &'a mut W {
142 self.variant(WKDBCNTSELECT_A::_512CK32)
143 }
144 #[doc = "Input pin shall be active for at least 4096 32kHz clock period."]
145 #[inline(always)]
146 pub fn _4096ck32(self) -> &'a mut W {
147 self.variant(WKDBCNTSELECT_A::_4096CK32)
148 }
149 #[doc = "Input pin shall be active for at least 32768 32kHz clock period."]
150 #[inline(always)]
151 pub fn _32768ck32(self) -> &'a mut W {
152 self.variant(WKDBCNTSELECT_A::_32768CK32)
153 }
154}
155impl R {
156 #[doc = "Bits 0:4 - Wakeup Debounce Counter"]
157 #[inline(always)]
158 pub fn wkdbcnt(&self) -> WKDBCNT_R {
159 WKDBCNT_R::new(self.bits & 0x1f)
160 }
161}
162impl W {
163 #[doc = "Bits 0:4 - Wakeup Debounce Counter"]
164 #[inline(always)]
165 #[must_use]
166 pub fn wkdbcnt(&mut self) -> WKDBCNT_W<0> {
167 WKDBCNT_W::new(self)
168 }
169 #[doc = "Writes raw bits to the register."]
170 #[inline(always)]
171 pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
172 self.0.bits(bits);
173 self
174 }
175}
176#[doc = "Wakeup Debounce Configuration\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 [wkdbconf](index.html) module"]
177pub struct WKDBCONF_SPEC;
178impl crate::RegisterSpec for WKDBCONF_SPEC {
179 type Ux = u8;
180}
181#[doc = "`read()` method returns [wkdbconf::R](R) reader structure"]
182impl crate::Readable for WKDBCONF_SPEC {
183 type Reader = R;
184}
185#[doc = "`write(|w| ..)` method takes [wkdbconf::W](W) writer structure"]
186impl crate::Writable for WKDBCONF_SPEC {
187 type Writer = W;
188 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
189 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
190}
191#[doc = "`reset()` method sets WKDBCONF to value 0"]
192impl crate::Resettable for WKDBCONF_SPEC {
193 const RESET_VALUE: Self::Ux = 0;
194}