atsaml21j18bu/wdt/
config.rs

1#[doc = "Register `CONFIG` reader"]
2pub struct R(crate::R<CONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CONFIG` writer"]
17pub struct W(crate::W<CONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CONFIG_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<CONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `PER` reader - Time-Out Period"]
38pub type PER_R = crate::FieldReader<u8, PERSELECT_A>;
39#[doc = "Time-Out Period\n\nValue on reset: 11"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum PERSELECT_A {
43    #[doc = "0: 8 clock cycles"]
44    CYC8 = 0,
45    #[doc = "1: 16 clock cycles"]
46    CYC16 = 1,
47    #[doc = "2: 32 clock cycles"]
48    CYC32 = 2,
49    #[doc = "3: 64 clock cycles"]
50    CYC64 = 3,
51    #[doc = "4: 128 clock cycles"]
52    CYC128 = 4,
53    #[doc = "5: 256 clock cycles"]
54    CYC256 = 5,
55    #[doc = "6: 512 clock cycles"]
56    CYC512 = 6,
57    #[doc = "7: 1024 clock cycles"]
58    CYC1024 = 7,
59    #[doc = "8: 2048 clock cycles"]
60    CYC2048 = 8,
61    #[doc = "9: 4096 clock cycles"]
62    CYC4096 = 9,
63    #[doc = "10: 8192 clock cycles"]
64    CYC8192 = 10,
65    #[doc = "11: 16384 clock cycles"]
66    CYC16384 = 11,
67}
68impl From<PERSELECT_A> for u8 {
69    #[inline(always)]
70    fn from(variant: PERSELECT_A) -> Self {
71        variant as _
72    }
73}
74impl PER_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub fn variant(&self) -> Option<PERSELECT_A> {
78        match self.bits {
79            0 => Some(PERSELECT_A::CYC8),
80            1 => Some(PERSELECT_A::CYC16),
81            2 => Some(PERSELECT_A::CYC32),
82            3 => Some(PERSELECT_A::CYC64),
83            4 => Some(PERSELECT_A::CYC128),
84            5 => Some(PERSELECT_A::CYC256),
85            6 => Some(PERSELECT_A::CYC512),
86            7 => Some(PERSELECT_A::CYC1024),
87            8 => Some(PERSELECT_A::CYC2048),
88            9 => Some(PERSELECT_A::CYC4096),
89            10 => Some(PERSELECT_A::CYC8192),
90            11 => Some(PERSELECT_A::CYC16384),
91            _ => None,
92        }
93    }
94    #[doc = "Checks if the value of the field is `CYC8`"]
95    #[inline(always)]
96    pub fn is_cyc8(&self) -> bool {
97        *self == PERSELECT_A::CYC8
98    }
99    #[doc = "Checks if the value of the field is `CYC16`"]
100    #[inline(always)]
101    pub fn is_cyc16(&self) -> bool {
102        *self == PERSELECT_A::CYC16
103    }
104    #[doc = "Checks if the value of the field is `CYC32`"]
105    #[inline(always)]
106    pub fn is_cyc32(&self) -> bool {
107        *self == PERSELECT_A::CYC32
108    }
109    #[doc = "Checks if the value of the field is `CYC64`"]
110    #[inline(always)]
111    pub fn is_cyc64(&self) -> bool {
112        *self == PERSELECT_A::CYC64
113    }
114    #[doc = "Checks if the value of the field is `CYC128`"]
115    #[inline(always)]
116    pub fn is_cyc128(&self) -> bool {
117        *self == PERSELECT_A::CYC128
118    }
119    #[doc = "Checks if the value of the field is `CYC256`"]
120    #[inline(always)]
121    pub fn is_cyc256(&self) -> bool {
122        *self == PERSELECT_A::CYC256
123    }
124    #[doc = "Checks if the value of the field is `CYC512`"]
125    #[inline(always)]
126    pub fn is_cyc512(&self) -> bool {
127        *self == PERSELECT_A::CYC512
128    }
129    #[doc = "Checks if the value of the field is `CYC1024`"]
130    #[inline(always)]
131    pub fn is_cyc1024(&self) -> bool {
132        *self == PERSELECT_A::CYC1024
133    }
134    #[doc = "Checks if the value of the field is `CYC2048`"]
135    #[inline(always)]
136    pub fn is_cyc2048(&self) -> bool {
137        *self == PERSELECT_A::CYC2048
138    }
139    #[doc = "Checks if the value of the field is `CYC4096`"]
140    #[inline(always)]
141    pub fn is_cyc4096(&self) -> bool {
142        *self == PERSELECT_A::CYC4096
143    }
144    #[doc = "Checks if the value of the field is `CYC8192`"]
145    #[inline(always)]
146    pub fn is_cyc8192(&self) -> bool {
147        *self == PERSELECT_A::CYC8192
148    }
149    #[doc = "Checks if the value of the field is `CYC16384`"]
150    #[inline(always)]
151    pub fn is_cyc16384(&self) -> bool {
152        *self == PERSELECT_A::CYC16384
153    }
154}
155#[doc = "Field `PER` writer - Time-Out Period"]
156pub type PER_W<'a, const O: u8> = crate::FieldWriter<'a, u8, CONFIG_SPEC, u8, PERSELECT_A, 4, O>;
157impl<'a, const O: u8> PER_W<'a, O> {
158    #[doc = "8 clock cycles"]
159    #[inline(always)]
160    pub fn cyc8(self) -> &'a mut W {
161        self.variant(PERSELECT_A::CYC8)
162    }
163    #[doc = "16 clock cycles"]
164    #[inline(always)]
165    pub fn cyc16(self) -> &'a mut W {
166        self.variant(PERSELECT_A::CYC16)
167    }
168    #[doc = "32 clock cycles"]
169    #[inline(always)]
170    pub fn cyc32(self) -> &'a mut W {
171        self.variant(PERSELECT_A::CYC32)
172    }
173    #[doc = "64 clock cycles"]
174    #[inline(always)]
175    pub fn cyc64(self) -> &'a mut W {
176        self.variant(PERSELECT_A::CYC64)
177    }
178    #[doc = "128 clock cycles"]
179    #[inline(always)]
180    pub fn cyc128(self) -> &'a mut W {
181        self.variant(PERSELECT_A::CYC128)
182    }
183    #[doc = "256 clock cycles"]
184    #[inline(always)]
185    pub fn cyc256(self) -> &'a mut W {
186        self.variant(PERSELECT_A::CYC256)
187    }
188    #[doc = "512 clock cycles"]
189    #[inline(always)]
190    pub fn cyc512(self) -> &'a mut W {
191        self.variant(PERSELECT_A::CYC512)
192    }
193    #[doc = "1024 clock cycles"]
194    #[inline(always)]
195    pub fn cyc1024(self) -> &'a mut W {
196        self.variant(PERSELECT_A::CYC1024)
197    }
198    #[doc = "2048 clock cycles"]
199    #[inline(always)]
200    pub fn cyc2048(self) -> &'a mut W {
201        self.variant(PERSELECT_A::CYC2048)
202    }
203    #[doc = "4096 clock cycles"]
204    #[inline(always)]
205    pub fn cyc4096(self) -> &'a mut W {
206        self.variant(PERSELECT_A::CYC4096)
207    }
208    #[doc = "8192 clock cycles"]
209    #[inline(always)]
210    pub fn cyc8192(self) -> &'a mut W {
211        self.variant(PERSELECT_A::CYC8192)
212    }
213    #[doc = "16384 clock cycles"]
214    #[inline(always)]
215    pub fn cyc16384(self) -> &'a mut W {
216        self.variant(PERSELECT_A::CYC16384)
217    }
218}
219#[doc = "Field `WINDOW` reader - Window Mode Time-Out Period"]
220pub type WINDOW_R = crate::FieldReader<u8, WINDOWSELECT_A>;
221#[doc = "Window Mode Time-Out Period\n\nValue on reset: 11"]
222#[derive(Clone, Copy, Debug, PartialEq, Eq)]
223#[repr(u8)]
224pub enum WINDOWSELECT_A {
225    #[doc = "0: 8 clock cycles"]
226    CYC8 = 0,
227    #[doc = "1: 16 clock cycles"]
228    CYC16 = 1,
229    #[doc = "2: 32 clock cycles"]
230    CYC32 = 2,
231    #[doc = "3: 64 clock cycles"]
232    CYC64 = 3,
233    #[doc = "4: 128 clock cycles"]
234    CYC128 = 4,
235    #[doc = "5: 256 clock cycles"]
236    CYC256 = 5,
237    #[doc = "6: 512 clock cycles"]
238    CYC512 = 6,
239    #[doc = "7: 1024 clock cycles"]
240    CYC1024 = 7,
241    #[doc = "8: 2048 clock cycles"]
242    CYC2048 = 8,
243    #[doc = "9: 4096 clock cycles"]
244    CYC4096 = 9,
245    #[doc = "10: 8192 clock cycles"]
246    CYC8192 = 10,
247    #[doc = "11: 16384 clock cycles"]
248    CYC16384 = 11,
249}
250impl From<WINDOWSELECT_A> for u8 {
251    #[inline(always)]
252    fn from(variant: WINDOWSELECT_A) -> Self {
253        variant as _
254    }
255}
256impl WINDOW_R {
257    #[doc = "Get enumerated values variant"]
258    #[inline(always)]
259    pub fn variant(&self) -> Option<WINDOWSELECT_A> {
260        match self.bits {
261            0 => Some(WINDOWSELECT_A::CYC8),
262            1 => Some(WINDOWSELECT_A::CYC16),
263            2 => Some(WINDOWSELECT_A::CYC32),
264            3 => Some(WINDOWSELECT_A::CYC64),
265            4 => Some(WINDOWSELECT_A::CYC128),
266            5 => Some(WINDOWSELECT_A::CYC256),
267            6 => Some(WINDOWSELECT_A::CYC512),
268            7 => Some(WINDOWSELECT_A::CYC1024),
269            8 => Some(WINDOWSELECT_A::CYC2048),
270            9 => Some(WINDOWSELECT_A::CYC4096),
271            10 => Some(WINDOWSELECT_A::CYC8192),
272            11 => Some(WINDOWSELECT_A::CYC16384),
273            _ => None,
274        }
275    }
276    #[doc = "Checks if the value of the field is `CYC8`"]
277    #[inline(always)]
278    pub fn is_cyc8(&self) -> bool {
279        *self == WINDOWSELECT_A::CYC8
280    }
281    #[doc = "Checks if the value of the field is `CYC16`"]
282    #[inline(always)]
283    pub fn is_cyc16(&self) -> bool {
284        *self == WINDOWSELECT_A::CYC16
285    }
286    #[doc = "Checks if the value of the field is `CYC32`"]
287    #[inline(always)]
288    pub fn is_cyc32(&self) -> bool {
289        *self == WINDOWSELECT_A::CYC32
290    }
291    #[doc = "Checks if the value of the field is `CYC64`"]
292    #[inline(always)]
293    pub fn is_cyc64(&self) -> bool {
294        *self == WINDOWSELECT_A::CYC64
295    }
296    #[doc = "Checks if the value of the field is `CYC128`"]
297    #[inline(always)]
298    pub fn is_cyc128(&self) -> bool {
299        *self == WINDOWSELECT_A::CYC128
300    }
301    #[doc = "Checks if the value of the field is `CYC256`"]
302    #[inline(always)]
303    pub fn is_cyc256(&self) -> bool {
304        *self == WINDOWSELECT_A::CYC256
305    }
306    #[doc = "Checks if the value of the field is `CYC512`"]
307    #[inline(always)]
308    pub fn is_cyc512(&self) -> bool {
309        *self == WINDOWSELECT_A::CYC512
310    }
311    #[doc = "Checks if the value of the field is `CYC1024`"]
312    #[inline(always)]
313    pub fn is_cyc1024(&self) -> bool {
314        *self == WINDOWSELECT_A::CYC1024
315    }
316    #[doc = "Checks if the value of the field is `CYC2048`"]
317    #[inline(always)]
318    pub fn is_cyc2048(&self) -> bool {
319        *self == WINDOWSELECT_A::CYC2048
320    }
321    #[doc = "Checks if the value of the field is `CYC4096`"]
322    #[inline(always)]
323    pub fn is_cyc4096(&self) -> bool {
324        *self == WINDOWSELECT_A::CYC4096
325    }
326    #[doc = "Checks if the value of the field is `CYC8192`"]
327    #[inline(always)]
328    pub fn is_cyc8192(&self) -> bool {
329        *self == WINDOWSELECT_A::CYC8192
330    }
331    #[doc = "Checks if the value of the field is `CYC16384`"]
332    #[inline(always)]
333    pub fn is_cyc16384(&self) -> bool {
334        *self == WINDOWSELECT_A::CYC16384
335    }
336}
337#[doc = "Field `WINDOW` writer - Window Mode Time-Out Period"]
338pub type WINDOW_W<'a, const O: u8> =
339    crate::FieldWriter<'a, u8, CONFIG_SPEC, u8, WINDOWSELECT_A, 4, O>;
340impl<'a, const O: u8> WINDOW_W<'a, O> {
341    #[doc = "8 clock cycles"]
342    #[inline(always)]
343    pub fn cyc8(self) -> &'a mut W {
344        self.variant(WINDOWSELECT_A::CYC8)
345    }
346    #[doc = "16 clock cycles"]
347    #[inline(always)]
348    pub fn cyc16(self) -> &'a mut W {
349        self.variant(WINDOWSELECT_A::CYC16)
350    }
351    #[doc = "32 clock cycles"]
352    #[inline(always)]
353    pub fn cyc32(self) -> &'a mut W {
354        self.variant(WINDOWSELECT_A::CYC32)
355    }
356    #[doc = "64 clock cycles"]
357    #[inline(always)]
358    pub fn cyc64(self) -> &'a mut W {
359        self.variant(WINDOWSELECT_A::CYC64)
360    }
361    #[doc = "128 clock cycles"]
362    #[inline(always)]
363    pub fn cyc128(self) -> &'a mut W {
364        self.variant(WINDOWSELECT_A::CYC128)
365    }
366    #[doc = "256 clock cycles"]
367    #[inline(always)]
368    pub fn cyc256(self) -> &'a mut W {
369        self.variant(WINDOWSELECT_A::CYC256)
370    }
371    #[doc = "512 clock cycles"]
372    #[inline(always)]
373    pub fn cyc512(self) -> &'a mut W {
374        self.variant(WINDOWSELECT_A::CYC512)
375    }
376    #[doc = "1024 clock cycles"]
377    #[inline(always)]
378    pub fn cyc1024(self) -> &'a mut W {
379        self.variant(WINDOWSELECT_A::CYC1024)
380    }
381    #[doc = "2048 clock cycles"]
382    #[inline(always)]
383    pub fn cyc2048(self) -> &'a mut W {
384        self.variant(WINDOWSELECT_A::CYC2048)
385    }
386    #[doc = "4096 clock cycles"]
387    #[inline(always)]
388    pub fn cyc4096(self) -> &'a mut W {
389        self.variant(WINDOWSELECT_A::CYC4096)
390    }
391    #[doc = "8192 clock cycles"]
392    #[inline(always)]
393    pub fn cyc8192(self) -> &'a mut W {
394        self.variant(WINDOWSELECT_A::CYC8192)
395    }
396    #[doc = "16384 clock cycles"]
397    #[inline(always)]
398    pub fn cyc16384(self) -> &'a mut W {
399        self.variant(WINDOWSELECT_A::CYC16384)
400    }
401}
402impl R {
403    #[doc = "Bits 0:3 - Time-Out Period"]
404    #[inline(always)]
405    pub fn per(&self) -> PER_R {
406        PER_R::new(self.bits & 0x0f)
407    }
408    #[doc = "Bits 4:7 - Window Mode Time-Out Period"]
409    #[inline(always)]
410    pub fn window(&self) -> WINDOW_R {
411        WINDOW_R::new((self.bits >> 4) & 0x0f)
412    }
413}
414impl W {
415    #[doc = "Bits 0:3 - Time-Out Period"]
416    #[inline(always)]
417    #[must_use]
418    pub fn per(&mut self) -> PER_W<0> {
419        PER_W::new(self)
420    }
421    #[doc = "Bits 4:7 - Window Mode Time-Out Period"]
422    #[inline(always)]
423    #[must_use]
424    pub fn window(&mut self) -> WINDOW_W<4> {
425        WINDOW_W::new(self)
426    }
427    #[doc = "Writes raw bits to the register."]
428    #[inline(always)]
429    pub unsafe fn bits(&mut self, bits: u8) -> &mut Self {
430        self.0.bits(bits);
431        self
432    }
433}
434#[doc = "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 [config](index.html) module"]
435pub struct CONFIG_SPEC;
436impl crate::RegisterSpec for CONFIG_SPEC {
437    type Ux = u8;
438}
439#[doc = "`read()` method returns [config::R](R) reader structure"]
440impl crate::Readable for CONFIG_SPEC {
441    type Reader = R;
442}
443#[doc = "`write(|w| ..)` method takes [config::W](W) writer structure"]
444impl crate::Writable for CONFIG_SPEC {
445    type Writer = W;
446    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
447    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
448}
449#[doc = "`reset()` method sets CONFIG to value 0xbb"]
450impl crate::Resettable for CONFIG_SPEC {
451    const RESET_VALUE: Self::Ux = 0xbb;
452}