efm32gg11b310_pac/timer5/
dtctrl.rs

1#[doc = "Register `DTCTRL` reader"]
2pub struct R(crate::R<DTCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DTCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DTCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DTCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DTCTRL` writer"]
17pub struct W(crate::W<DTCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DTCTRL_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<DTCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DTCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DTEN` reader - DTI Enable"]
38pub type DTEN_R = crate::BitReader<bool>;
39#[doc = "Field `DTEN` writer - DTI Enable"]
40pub type DTEN_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 0>;
41#[doc = "Field `DTDAS` reader - DTI Automatic Start-up Functionality"]
42pub type DTDAS_R = crate::BitReader<bool>;
43#[doc = "Field `DTDAS` writer - DTI Automatic Start-up Functionality"]
44pub type DTDAS_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 1>;
45#[doc = "Field `DTIPOL` reader - DTI Inactive Polarity"]
46pub type DTIPOL_R = crate::BitReader<bool>;
47#[doc = "Field `DTIPOL` writer - DTI Inactive Polarity"]
48pub type DTIPOL_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 2>;
49#[doc = "Field `DTCINV` reader - DTI Complementary Output Invert"]
50pub type DTCINV_R = crate::BitReader<bool>;
51#[doc = "Field `DTCINV` writer - DTI Complementary Output Invert"]
52pub type DTCINV_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 3>;
53#[doc = "DTI PRS Source Channel Select\n\nValue on reset: 0"]
54#[derive(Clone, Copy, Debug, PartialEq)]
55#[repr(u8)]
56pub enum DTPRSSEL_A {
57    #[doc = "0: PRS Channel 0 selected as input"]
58    PRSCH0 = 0,
59    #[doc = "1: PRS Channel 1 selected as input"]
60    PRSCH1 = 1,
61    #[doc = "2: PRS Channel 2 selected as input"]
62    PRSCH2 = 2,
63    #[doc = "3: PRS Channel 3 selected as input"]
64    PRSCH3 = 3,
65    #[doc = "4: PRS Channel 4 selected as input"]
66    PRSCH4 = 4,
67    #[doc = "5: PRS Channel 5 selected as input"]
68    PRSCH5 = 5,
69    #[doc = "6: PRS Channel 6 selected as input"]
70    PRSCH6 = 6,
71    #[doc = "7: PRS Channel 7 selected as input"]
72    PRSCH7 = 7,
73    #[doc = "8: PRS Channel 8 selected as input"]
74    PRSCH8 = 8,
75    #[doc = "9: PRS Channel 9 selected as input"]
76    PRSCH9 = 9,
77    #[doc = "10: PRS Channel 10 selected as input"]
78    PRSCH10 = 10,
79    #[doc = "11: PRS Channel 11 selected as input"]
80    PRSCH11 = 11,
81    #[doc = "12: PRS Channel 12 selected as input"]
82    PRSCH12 = 12,
83    #[doc = "13: PRS Channel 13 selected as input"]
84    PRSCH13 = 13,
85    #[doc = "14: PRS Channel 14 selected as input"]
86    PRSCH14 = 14,
87    #[doc = "15: PRS Channel 15 selected as input"]
88    PRSCH15 = 15,
89    #[doc = "16: PRS Channel 16 selected as input"]
90    PRSCH16 = 16,
91    #[doc = "17: PRS Channel 17 selected as input"]
92    PRSCH17 = 17,
93    #[doc = "18: PRS Channel 18 selected as input"]
94    PRSCH18 = 18,
95    #[doc = "19: PRS Channel 19 selected as input"]
96    PRSCH19 = 19,
97    #[doc = "20: PRS Channel 20 selected as input"]
98    PRSCH20 = 20,
99    #[doc = "21: PRS Channel 21 selected as input"]
100    PRSCH21 = 21,
101    #[doc = "22: PRS Channel 22 selected as input"]
102    PRSCH22 = 22,
103    #[doc = "23: PRS Channel 23 selected as input"]
104    PRSCH23 = 23,
105}
106impl From<DTPRSSEL_A> for u8 {
107    #[inline(always)]
108    fn from(variant: DTPRSSEL_A) -> Self {
109        variant as _
110    }
111}
112#[doc = "Field `DTPRSSEL` reader - DTI PRS Source Channel Select"]
113pub type DTPRSSEL_R = crate::FieldReader<u8, DTPRSSEL_A>;
114impl DTPRSSEL_R {
115    #[doc = "Get enumerated values variant"]
116    #[inline(always)]
117    pub fn variant(&self) -> Option<DTPRSSEL_A> {
118        match self.bits {
119            0 => Some(DTPRSSEL_A::PRSCH0),
120            1 => Some(DTPRSSEL_A::PRSCH1),
121            2 => Some(DTPRSSEL_A::PRSCH2),
122            3 => Some(DTPRSSEL_A::PRSCH3),
123            4 => Some(DTPRSSEL_A::PRSCH4),
124            5 => Some(DTPRSSEL_A::PRSCH5),
125            6 => Some(DTPRSSEL_A::PRSCH6),
126            7 => Some(DTPRSSEL_A::PRSCH7),
127            8 => Some(DTPRSSEL_A::PRSCH8),
128            9 => Some(DTPRSSEL_A::PRSCH9),
129            10 => Some(DTPRSSEL_A::PRSCH10),
130            11 => Some(DTPRSSEL_A::PRSCH11),
131            12 => Some(DTPRSSEL_A::PRSCH12),
132            13 => Some(DTPRSSEL_A::PRSCH13),
133            14 => Some(DTPRSSEL_A::PRSCH14),
134            15 => Some(DTPRSSEL_A::PRSCH15),
135            16 => Some(DTPRSSEL_A::PRSCH16),
136            17 => Some(DTPRSSEL_A::PRSCH17),
137            18 => Some(DTPRSSEL_A::PRSCH18),
138            19 => Some(DTPRSSEL_A::PRSCH19),
139            20 => Some(DTPRSSEL_A::PRSCH20),
140            21 => Some(DTPRSSEL_A::PRSCH21),
141            22 => Some(DTPRSSEL_A::PRSCH22),
142            23 => Some(DTPRSSEL_A::PRSCH23),
143            _ => None,
144        }
145    }
146    #[doc = "Checks if the value of the field is `PRSCH0`"]
147    #[inline(always)]
148    pub fn is_prsch0(&self) -> bool {
149        *self == DTPRSSEL_A::PRSCH0
150    }
151    #[doc = "Checks if the value of the field is `PRSCH1`"]
152    #[inline(always)]
153    pub fn is_prsch1(&self) -> bool {
154        *self == DTPRSSEL_A::PRSCH1
155    }
156    #[doc = "Checks if the value of the field is `PRSCH2`"]
157    #[inline(always)]
158    pub fn is_prsch2(&self) -> bool {
159        *self == DTPRSSEL_A::PRSCH2
160    }
161    #[doc = "Checks if the value of the field is `PRSCH3`"]
162    #[inline(always)]
163    pub fn is_prsch3(&self) -> bool {
164        *self == DTPRSSEL_A::PRSCH3
165    }
166    #[doc = "Checks if the value of the field is `PRSCH4`"]
167    #[inline(always)]
168    pub fn is_prsch4(&self) -> bool {
169        *self == DTPRSSEL_A::PRSCH4
170    }
171    #[doc = "Checks if the value of the field is `PRSCH5`"]
172    #[inline(always)]
173    pub fn is_prsch5(&self) -> bool {
174        *self == DTPRSSEL_A::PRSCH5
175    }
176    #[doc = "Checks if the value of the field is `PRSCH6`"]
177    #[inline(always)]
178    pub fn is_prsch6(&self) -> bool {
179        *self == DTPRSSEL_A::PRSCH6
180    }
181    #[doc = "Checks if the value of the field is `PRSCH7`"]
182    #[inline(always)]
183    pub fn is_prsch7(&self) -> bool {
184        *self == DTPRSSEL_A::PRSCH7
185    }
186    #[doc = "Checks if the value of the field is `PRSCH8`"]
187    #[inline(always)]
188    pub fn is_prsch8(&self) -> bool {
189        *self == DTPRSSEL_A::PRSCH8
190    }
191    #[doc = "Checks if the value of the field is `PRSCH9`"]
192    #[inline(always)]
193    pub fn is_prsch9(&self) -> bool {
194        *self == DTPRSSEL_A::PRSCH9
195    }
196    #[doc = "Checks if the value of the field is `PRSCH10`"]
197    #[inline(always)]
198    pub fn is_prsch10(&self) -> bool {
199        *self == DTPRSSEL_A::PRSCH10
200    }
201    #[doc = "Checks if the value of the field is `PRSCH11`"]
202    #[inline(always)]
203    pub fn is_prsch11(&self) -> bool {
204        *self == DTPRSSEL_A::PRSCH11
205    }
206    #[doc = "Checks if the value of the field is `PRSCH12`"]
207    #[inline(always)]
208    pub fn is_prsch12(&self) -> bool {
209        *self == DTPRSSEL_A::PRSCH12
210    }
211    #[doc = "Checks if the value of the field is `PRSCH13`"]
212    #[inline(always)]
213    pub fn is_prsch13(&self) -> bool {
214        *self == DTPRSSEL_A::PRSCH13
215    }
216    #[doc = "Checks if the value of the field is `PRSCH14`"]
217    #[inline(always)]
218    pub fn is_prsch14(&self) -> bool {
219        *self == DTPRSSEL_A::PRSCH14
220    }
221    #[doc = "Checks if the value of the field is `PRSCH15`"]
222    #[inline(always)]
223    pub fn is_prsch15(&self) -> bool {
224        *self == DTPRSSEL_A::PRSCH15
225    }
226    #[doc = "Checks if the value of the field is `PRSCH16`"]
227    #[inline(always)]
228    pub fn is_prsch16(&self) -> bool {
229        *self == DTPRSSEL_A::PRSCH16
230    }
231    #[doc = "Checks if the value of the field is `PRSCH17`"]
232    #[inline(always)]
233    pub fn is_prsch17(&self) -> bool {
234        *self == DTPRSSEL_A::PRSCH17
235    }
236    #[doc = "Checks if the value of the field is `PRSCH18`"]
237    #[inline(always)]
238    pub fn is_prsch18(&self) -> bool {
239        *self == DTPRSSEL_A::PRSCH18
240    }
241    #[doc = "Checks if the value of the field is `PRSCH19`"]
242    #[inline(always)]
243    pub fn is_prsch19(&self) -> bool {
244        *self == DTPRSSEL_A::PRSCH19
245    }
246    #[doc = "Checks if the value of the field is `PRSCH20`"]
247    #[inline(always)]
248    pub fn is_prsch20(&self) -> bool {
249        *self == DTPRSSEL_A::PRSCH20
250    }
251    #[doc = "Checks if the value of the field is `PRSCH21`"]
252    #[inline(always)]
253    pub fn is_prsch21(&self) -> bool {
254        *self == DTPRSSEL_A::PRSCH21
255    }
256    #[doc = "Checks if the value of the field is `PRSCH22`"]
257    #[inline(always)]
258    pub fn is_prsch22(&self) -> bool {
259        *self == DTPRSSEL_A::PRSCH22
260    }
261    #[doc = "Checks if the value of the field is `PRSCH23`"]
262    #[inline(always)]
263    pub fn is_prsch23(&self) -> bool {
264        *self == DTPRSSEL_A::PRSCH23
265    }
266}
267#[doc = "Field `DTPRSSEL` writer - DTI PRS Source Channel Select"]
268pub type DTPRSSEL_W<'a> = crate::FieldWriter<'a, u32, DTCTRL_SPEC, u8, DTPRSSEL_A, 5, 4>;
269impl<'a> DTPRSSEL_W<'a> {
270    #[doc = "PRS Channel 0 selected as input"]
271    #[inline(always)]
272    pub fn prsch0(self) -> &'a mut W {
273        self.variant(DTPRSSEL_A::PRSCH0)
274    }
275    #[doc = "PRS Channel 1 selected as input"]
276    #[inline(always)]
277    pub fn prsch1(self) -> &'a mut W {
278        self.variant(DTPRSSEL_A::PRSCH1)
279    }
280    #[doc = "PRS Channel 2 selected as input"]
281    #[inline(always)]
282    pub fn prsch2(self) -> &'a mut W {
283        self.variant(DTPRSSEL_A::PRSCH2)
284    }
285    #[doc = "PRS Channel 3 selected as input"]
286    #[inline(always)]
287    pub fn prsch3(self) -> &'a mut W {
288        self.variant(DTPRSSEL_A::PRSCH3)
289    }
290    #[doc = "PRS Channel 4 selected as input"]
291    #[inline(always)]
292    pub fn prsch4(self) -> &'a mut W {
293        self.variant(DTPRSSEL_A::PRSCH4)
294    }
295    #[doc = "PRS Channel 5 selected as input"]
296    #[inline(always)]
297    pub fn prsch5(self) -> &'a mut W {
298        self.variant(DTPRSSEL_A::PRSCH5)
299    }
300    #[doc = "PRS Channel 6 selected as input"]
301    #[inline(always)]
302    pub fn prsch6(self) -> &'a mut W {
303        self.variant(DTPRSSEL_A::PRSCH6)
304    }
305    #[doc = "PRS Channel 7 selected as input"]
306    #[inline(always)]
307    pub fn prsch7(self) -> &'a mut W {
308        self.variant(DTPRSSEL_A::PRSCH7)
309    }
310    #[doc = "PRS Channel 8 selected as input"]
311    #[inline(always)]
312    pub fn prsch8(self) -> &'a mut W {
313        self.variant(DTPRSSEL_A::PRSCH8)
314    }
315    #[doc = "PRS Channel 9 selected as input"]
316    #[inline(always)]
317    pub fn prsch9(self) -> &'a mut W {
318        self.variant(DTPRSSEL_A::PRSCH9)
319    }
320    #[doc = "PRS Channel 10 selected as input"]
321    #[inline(always)]
322    pub fn prsch10(self) -> &'a mut W {
323        self.variant(DTPRSSEL_A::PRSCH10)
324    }
325    #[doc = "PRS Channel 11 selected as input"]
326    #[inline(always)]
327    pub fn prsch11(self) -> &'a mut W {
328        self.variant(DTPRSSEL_A::PRSCH11)
329    }
330    #[doc = "PRS Channel 12 selected as input"]
331    #[inline(always)]
332    pub fn prsch12(self) -> &'a mut W {
333        self.variant(DTPRSSEL_A::PRSCH12)
334    }
335    #[doc = "PRS Channel 13 selected as input"]
336    #[inline(always)]
337    pub fn prsch13(self) -> &'a mut W {
338        self.variant(DTPRSSEL_A::PRSCH13)
339    }
340    #[doc = "PRS Channel 14 selected as input"]
341    #[inline(always)]
342    pub fn prsch14(self) -> &'a mut W {
343        self.variant(DTPRSSEL_A::PRSCH14)
344    }
345    #[doc = "PRS Channel 15 selected as input"]
346    #[inline(always)]
347    pub fn prsch15(self) -> &'a mut W {
348        self.variant(DTPRSSEL_A::PRSCH15)
349    }
350    #[doc = "PRS Channel 16 selected as input"]
351    #[inline(always)]
352    pub fn prsch16(self) -> &'a mut W {
353        self.variant(DTPRSSEL_A::PRSCH16)
354    }
355    #[doc = "PRS Channel 17 selected as input"]
356    #[inline(always)]
357    pub fn prsch17(self) -> &'a mut W {
358        self.variant(DTPRSSEL_A::PRSCH17)
359    }
360    #[doc = "PRS Channel 18 selected as input"]
361    #[inline(always)]
362    pub fn prsch18(self) -> &'a mut W {
363        self.variant(DTPRSSEL_A::PRSCH18)
364    }
365    #[doc = "PRS Channel 19 selected as input"]
366    #[inline(always)]
367    pub fn prsch19(self) -> &'a mut W {
368        self.variant(DTPRSSEL_A::PRSCH19)
369    }
370    #[doc = "PRS Channel 20 selected as input"]
371    #[inline(always)]
372    pub fn prsch20(self) -> &'a mut W {
373        self.variant(DTPRSSEL_A::PRSCH20)
374    }
375    #[doc = "PRS Channel 21 selected as input"]
376    #[inline(always)]
377    pub fn prsch21(self) -> &'a mut W {
378        self.variant(DTPRSSEL_A::PRSCH21)
379    }
380    #[doc = "PRS Channel 22 selected as input"]
381    #[inline(always)]
382    pub fn prsch22(self) -> &'a mut W {
383        self.variant(DTPRSSEL_A::PRSCH22)
384    }
385    #[doc = "PRS Channel 23 selected as input"]
386    #[inline(always)]
387    pub fn prsch23(self) -> &'a mut W {
388        self.variant(DTPRSSEL_A::PRSCH23)
389    }
390}
391#[doc = "Field `DTAR` reader - DTI Always Run"]
392pub type DTAR_R = crate::BitReader<bool>;
393#[doc = "Field `DTAR` writer - DTI Always Run"]
394pub type DTAR_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 9>;
395#[doc = "Field `DTFATS` reader - DTI Fault Action on Timer Stop"]
396pub type DTFATS_R = crate::BitReader<bool>;
397#[doc = "Field `DTFATS` writer - DTI Fault Action on Timer Stop"]
398pub type DTFATS_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 10>;
399#[doc = "Field `DTPRSEN` reader - DTI PRS Source Enable"]
400pub type DTPRSEN_R = crate::BitReader<bool>;
401#[doc = "Field `DTPRSEN` writer - DTI PRS Source Enable"]
402pub type DTPRSEN_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 24>;
403impl R {
404    #[doc = "Bit 0 - DTI Enable"]
405    #[inline(always)]
406    pub fn dten(&self) -> DTEN_R {
407        DTEN_R::new((self.bits & 1) != 0)
408    }
409    #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
410    #[inline(always)]
411    pub fn dtdas(&self) -> DTDAS_R {
412        DTDAS_R::new(((self.bits >> 1) & 1) != 0)
413    }
414    #[doc = "Bit 2 - DTI Inactive Polarity"]
415    #[inline(always)]
416    pub fn dtipol(&self) -> DTIPOL_R {
417        DTIPOL_R::new(((self.bits >> 2) & 1) != 0)
418    }
419    #[doc = "Bit 3 - DTI Complementary Output Invert"]
420    #[inline(always)]
421    pub fn dtcinv(&self) -> DTCINV_R {
422        DTCINV_R::new(((self.bits >> 3) & 1) != 0)
423    }
424    #[doc = "Bits 4:8 - DTI PRS Source Channel Select"]
425    #[inline(always)]
426    pub fn dtprssel(&self) -> DTPRSSEL_R {
427        DTPRSSEL_R::new(((self.bits >> 4) & 0x1f) as u8)
428    }
429    #[doc = "Bit 9 - DTI Always Run"]
430    #[inline(always)]
431    pub fn dtar(&self) -> DTAR_R {
432        DTAR_R::new(((self.bits >> 9) & 1) != 0)
433    }
434    #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
435    #[inline(always)]
436    pub fn dtfats(&self) -> DTFATS_R {
437        DTFATS_R::new(((self.bits >> 10) & 1) != 0)
438    }
439    #[doc = "Bit 24 - DTI PRS Source Enable"]
440    #[inline(always)]
441    pub fn dtprsen(&self) -> DTPRSEN_R {
442        DTPRSEN_R::new(((self.bits >> 24) & 1) != 0)
443    }
444}
445impl W {
446    #[doc = "Bit 0 - DTI Enable"]
447    #[inline(always)]
448    pub fn dten(&mut self) -> DTEN_W {
449        DTEN_W::new(self)
450    }
451    #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
452    #[inline(always)]
453    pub fn dtdas(&mut self) -> DTDAS_W {
454        DTDAS_W::new(self)
455    }
456    #[doc = "Bit 2 - DTI Inactive Polarity"]
457    #[inline(always)]
458    pub fn dtipol(&mut self) -> DTIPOL_W {
459        DTIPOL_W::new(self)
460    }
461    #[doc = "Bit 3 - DTI Complementary Output Invert"]
462    #[inline(always)]
463    pub fn dtcinv(&mut self) -> DTCINV_W {
464        DTCINV_W::new(self)
465    }
466    #[doc = "Bits 4:8 - DTI PRS Source Channel Select"]
467    #[inline(always)]
468    pub fn dtprssel(&mut self) -> DTPRSSEL_W {
469        DTPRSSEL_W::new(self)
470    }
471    #[doc = "Bit 9 - DTI Always Run"]
472    #[inline(always)]
473    pub fn dtar(&mut self) -> DTAR_W {
474        DTAR_W::new(self)
475    }
476    #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
477    #[inline(always)]
478    pub fn dtfats(&mut self) -> DTFATS_W {
479        DTFATS_W::new(self)
480    }
481    #[doc = "Bit 24 - DTI PRS Source Enable"]
482    #[inline(always)]
483    pub fn dtprsen(&mut self) -> DTPRSEN_W {
484        DTPRSEN_W::new(self)
485    }
486    #[doc = "Writes raw bits to the register."]
487    #[inline(always)]
488    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
489        self.0.bits(bits);
490        self
491    }
492}
493#[doc = "DTI Control 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 [dtctrl](index.html) module"]
494pub struct DTCTRL_SPEC;
495impl crate::RegisterSpec for DTCTRL_SPEC {
496    type Ux = u32;
497}
498#[doc = "`read()` method returns [dtctrl::R](R) reader structure"]
499impl crate::Readable for DTCTRL_SPEC {
500    type Reader = R;
501}
502#[doc = "`write(|w| ..)` method takes [dtctrl::W](W) writer structure"]
503impl crate::Writable for DTCTRL_SPEC {
504    type Writer = W;
505}
506#[doc = "`reset()` method sets DTCTRL to value 0"]
507impl crate::Resettable for DTCTRL_SPEC {
508    #[inline(always)]
509    fn reset_value() -> Self::Ux {
510        0
511    }
512}