efm32gg11b_pac/efm32gg11b840/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, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
53#[doc = "Field `DTPRSSEL` reader - DTI PRS Source Channel Select"]
54pub type DTPRSSEL_R = crate::FieldReader<u8, DTPRSSEL_A>;
55#[doc = "DTI PRS Source Channel Select\n\nValue on reset: 0"]
56#[derive(Clone, Copy, Debug, PartialEq, Eq)]
57#[repr(u8)]
58pub enum DTPRSSEL_A {
59    #[doc = "0: PRS Channel 0 selected as input"]
60    PRSCH0 = 0,
61    #[doc = "1: PRS Channel 1 selected as input"]
62    PRSCH1 = 1,
63    #[doc = "2: PRS Channel 2 selected as input"]
64    PRSCH2 = 2,
65    #[doc = "3: PRS Channel 3 selected as input"]
66    PRSCH3 = 3,
67    #[doc = "4: PRS Channel 4 selected as input"]
68    PRSCH4 = 4,
69    #[doc = "5: PRS Channel 5 selected as input"]
70    PRSCH5 = 5,
71    #[doc = "6: PRS Channel 6 selected as input"]
72    PRSCH6 = 6,
73    #[doc = "7: PRS Channel 7 selected as input"]
74    PRSCH7 = 7,
75    #[doc = "8: PRS Channel 8 selected as input"]
76    PRSCH8 = 8,
77    #[doc = "9: PRS Channel 9 selected as input"]
78    PRSCH9 = 9,
79    #[doc = "10: PRS Channel 10 selected as input"]
80    PRSCH10 = 10,
81    #[doc = "11: PRS Channel 11 selected as input"]
82    PRSCH11 = 11,
83    #[doc = "12: PRS Channel 12 selected as input"]
84    PRSCH12 = 12,
85    #[doc = "13: PRS Channel 13 selected as input"]
86    PRSCH13 = 13,
87    #[doc = "14: PRS Channel 14 selected as input"]
88    PRSCH14 = 14,
89    #[doc = "15: PRS Channel 15 selected as input"]
90    PRSCH15 = 15,
91    #[doc = "16: PRS Channel 16 selected as input"]
92    PRSCH16 = 16,
93    #[doc = "17: PRS Channel 17 selected as input"]
94    PRSCH17 = 17,
95    #[doc = "18: PRS Channel 18 selected as input"]
96    PRSCH18 = 18,
97    #[doc = "19: PRS Channel 19 selected as input"]
98    PRSCH19 = 19,
99    #[doc = "20: PRS Channel 20 selected as input"]
100    PRSCH20 = 20,
101    #[doc = "21: PRS Channel 21 selected as input"]
102    PRSCH21 = 21,
103    #[doc = "22: PRS Channel 22 selected as input"]
104    PRSCH22 = 22,
105    #[doc = "23: PRS Channel 23 selected as input"]
106    PRSCH23 = 23,
107}
108impl From<DTPRSSEL_A> for u8 {
109    #[inline(always)]
110    fn from(variant: DTPRSSEL_A) -> Self {
111        variant as _
112    }
113}
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, const O: u8> =
269    crate::FieldWriter<'a, u32, DTCTRL_SPEC, u8, DTPRSSEL_A, 5, O>;
270impl<'a, const O: u8> DTPRSSEL_W<'a, O> {
271    #[doc = "PRS Channel 0 selected as input"]
272    #[inline(always)]
273    pub fn prsch0(self) -> &'a mut W {
274        self.variant(DTPRSSEL_A::PRSCH0)
275    }
276    #[doc = "PRS Channel 1 selected as input"]
277    #[inline(always)]
278    pub fn prsch1(self) -> &'a mut W {
279        self.variant(DTPRSSEL_A::PRSCH1)
280    }
281    #[doc = "PRS Channel 2 selected as input"]
282    #[inline(always)]
283    pub fn prsch2(self) -> &'a mut W {
284        self.variant(DTPRSSEL_A::PRSCH2)
285    }
286    #[doc = "PRS Channel 3 selected as input"]
287    #[inline(always)]
288    pub fn prsch3(self) -> &'a mut W {
289        self.variant(DTPRSSEL_A::PRSCH3)
290    }
291    #[doc = "PRS Channel 4 selected as input"]
292    #[inline(always)]
293    pub fn prsch4(self) -> &'a mut W {
294        self.variant(DTPRSSEL_A::PRSCH4)
295    }
296    #[doc = "PRS Channel 5 selected as input"]
297    #[inline(always)]
298    pub fn prsch5(self) -> &'a mut W {
299        self.variant(DTPRSSEL_A::PRSCH5)
300    }
301    #[doc = "PRS Channel 6 selected as input"]
302    #[inline(always)]
303    pub fn prsch6(self) -> &'a mut W {
304        self.variant(DTPRSSEL_A::PRSCH6)
305    }
306    #[doc = "PRS Channel 7 selected as input"]
307    #[inline(always)]
308    pub fn prsch7(self) -> &'a mut W {
309        self.variant(DTPRSSEL_A::PRSCH7)
310    }
311    #[doc = "PRS Channel 8 selected as input"]
312    #[inline(always)]
313    pub fn prsch8(self) -> &'a mut W {
314        self.variant(DTPRSSEL_A::PRSCH8)
315    }
316    #[doc = "PRS Channel 9 selected as input"]
317    #[inline(always)]
318    pub fn prsch9(self) -> &'a mut W {
319        self.variant(DTPRSSEL_A::PRSCH9)
320    }
321    #[doc = "PRS Channel 10 selected as input"]
322    #[inline(always)]
323    pub fn prsch10(self) -> &'a mut W {
324        self.variant(DTPRSSEL_A::PRSCH10)
325    }
326    #[doc = "PRS Channel 11 selected as input"]
327    #[inline(always)]
328    pub fn prsch11(self) -> &'a mut W {
329        self.variant(DTPRSSEL_A::PRSCH11)
330    }
331    #[doc = "PRS Channel 12 selected as input"]
332    #[inline(always)]
333    pub fn prsch12(self) -> &'a mut W {
334        self.variant(DTPRSSEL_A::PRSCH12)
335    }
336    #[doc = "PRS Channel 13 selected as input"]
337    #[inline(always)]
338    pub fn prsch13(self) -> &'a mut W {
339        self.variant(DTPRSSEL_A::PRSCH13)
340    }
341    #[doc = "PRS Channel 14 selected as input"]
342    #[inline(always)]
343    pub fn prsch14(self) -> &'a mut W {
344        self.variant(DTPRSSEL_A::PRSCH14)
345    }
346    #[doc = "PRS Channel 15 selected as input"]
347    #[inline(always)]
348    pub fn prsch15(self) -> &'a mut W {
349        self.variant(DTPRSSEL_A::PRSCH15)
350    }
351    #[doc = "PRS Channel 16 selected as input"]
352    #[inline(always)]
353    pub fn prsch16(self) -> &'a mut W {
354        self.variant(DTPRSSEL_A::PRSCH16)
355    }
356    #[doc = "PRS Channel 17 selected as input"]
357    #[inline(always)]
358    pub fn prsch17(self) -> &'a mut W {
359        self.variant(DTPRSSEL_A::PRSCH17)
360    }
361    #[doc = "PRS Channel 18 selected as input"]
362    #[inline(always)]
363    pub fn prsch18(self) -> &'a mut W {
364        self.variant(DTPRSSEL_A::PRSCH18)
365    }
366    #[doc = "PRS Channel 19 selected as input"]
367    #[inline(always)]
368    pub fn prsch19(self) -> &'a mut W {
369        self.variant(DTPRSSEL_A::PRSCH19)
370    }
371    #[doc = "PRS Channel 20 selected as input"]
372    #[inline(always)]
373    pub fn prsch20(self) -> &'a mut W {
374        self.variant(DTPRSSEL_A::PRSCH20)
375    }
376    #[doc = "PRS Channel 21 selected as input"]
377    #[inline(always)]
378    pub fn prsch21(self) -> &'a mut W {
379        self.variant(DTPRSSEL_A::PRSCH21)
380    }
381    #[doc = "PRS Channel 22 selected as input"]
382    #[inline(always)]
383    pub fn prsch22(self) -> &'a mut W {
384        self.variant(DTPRSSEL_A::PRSCH22)
385    }
386    #[doc = "PRS Channel 23 selected as input"]
387    #[inline(always)]
388    pub fn prsch23(self) -> &'a mut W {
389        self.variant(DTPRSSEL_A::PRSCH23)
390    }
391}
392#[doc = "Field `DTAR` reader - DTI Always Run"]
393pub type DTAR_R = crate::BitReader<bool>;
394#[doc = "Field `DTAR` writer - DTI Always Run"]
395pub type DTAR_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
396#[doc = "Field `DTFATS` reader - DTI Fault Action on Timer Stop"]
397pub type DTFATS_R = crate::BitReader<bool>;
398#[doc = "Field `DTFATS` writer - DTI Fault Action on Timer Stop"]
399pub type DTFATS_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
400#[doc = "Field `DTPRSEN` reader - DTI PRS Source Enable"]
401pub type DTPRSEN_R = crate::BitReader<bool>;
402#[doc = "Field `DTPRSEN` writer - DTI PRS Source Enable"]
403pub type DTPRSEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
404impl R {
405    #[doc = "Bit 0 - DTI Enable"]
406    #[inline(always)]
407    pub fn dten(&self) -> DTEN_R {
408        DTEN_R::new((self.bits & 1) != 0)
409    }
410    #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
411    #[inline(always)]
412    pub fn dtdas(&self) -> DTDAS_R {
413        DTDAS_R::new(((self.bits >> 1) & 1) != 0)
414    }
415    #[doc = "Bit 2 - DTI Inactive Polarity"]
416    #[inline(always)]
417    pub fn dtipol(&self) -> DTIPOL_R {
418        DTIPOL_R::new(((self.bits >> 2) & 1) != 0)
419    }
420    #[doc = "Bit 3 - DTI Complementary Output Invert"]
421    #[inline(always)]
422    pub fn dtcinv(&self) -> DTCINV_R {
423        DTCINV_R::new(((self.bits >> 3) & 1) != 0)
424    }
425    #[doc = "Bits 4:8 - DTI PRS Source Channel Select"]
426    #[inline(always)]
427    pub fn dtprssel(&self) -> DTPRSSEL_R {
428        DTPRSSEL_R::new(((self.bits >> 4) & 0x1f) as u8)
429    }
430    #[doc = "Bit 9 - DTI Always Run"]
431    #[inline(always)]
432    pub fn dtar(&self) -> DTAR_R {
433        DTAR_R::new(((self.bits >> 9) & 1) != 0)
434    }
435    #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
436    #[inline(always)]
437    pub fn dtfats(&self) -> DTFATS_R {
438        DTFATS_R::new(((self.bits >> 10) & 1) != 0)
439    }
440    #[doc = "Bit 24 - DTI PRS Source Enable"]
441    #[inline(always)]
442    pub fn dtprsen(&self) -> DTPRSEN_R {
443        DTPRSEN_R::new(((self.bits >> 24) & 1) != 0)
444    }
445}
446impl W {
447    #[doc = "Bit 0 - DTI Enable"]
448    #[inline(always)]
449    #[must_use]
450    pub fn dten(&mut self) -> DTEN_W<0> {
451        DTEN_W::new(self)
452    }
453    #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
454    #[inline(always)]
455    #[must_use]
456    pub fn dtdas(&mut self) -> DTDAS_W<1> {
457        DTDAS_W::new(self)
458    }
459    #[doc = "Bit 2 - DTI Inactive Polarity"]
460    #[inline(always)]
461    #[must_use]
462    pub fn dtipol(&mut self) -> DTIPOL_W<2> {
463        DTIPOL_W::new(self)
464    }
465    #[doc = "Bit 3 - DTI Complementary Output Invert"]
466    #[inline(always)]
467    #[must_use]
468    pub fn dtcinv(&mut self) -> DTCINV_W<3> {
469        DTCINV_W::new(self)
470    }
471    #[doc = "Bits 4:8 - DTI PRS Source Channel Select"]
472    #[inline(always)]
473    #[must_use]
474    pub fn dtprssel(&mut self) -> DTPRSSEL_W<4> {
475        DTPRSSEL_W::new(self)
476    }
477    #[doc = "Bit 9 - DTI Always Run"]
478    #[inline(always)]
479    #[must_use]
480    pub fn dtar(&mut self) -> DTAR_W<9> {
481        DTAR_W::new(self)
482    }
483    #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
484    #[inline(always)]
485    #[must_use]
486    pub fn dtfats(&mut self) -> DTFATS_W<10> {
487        DTFATS_W::new(self)
488    }
489    #[doc = "Bit 24 - DTI PRS Source Enable"]
490    #[inline(always)]
491    #[must_use]
492    pub fn dtprsen(&mut self) -> DTPRSEN_W<24> {
493        DTPRSEN_W::new(self)
494    }
495    #[doc = "Writes raw bits to the register."]
496    #[inline(always)]
497    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
498        self.0.bits(bits);
499        self
500    }
501}
502#[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"]
503pub struct DTCTRL_SPEC;
504impl crate::RegisterSpec for DTCTRL_SPEC {
505    type Ux = u32;
506}
507#[doc = "`read()` method returns [dtctrl::R](R) reader structure"]
508impl crate::Readable for DTCTRL_SPEC {
509    type Reader = R;
510}
511#[doc = "`write(|w| ..)` method takes [dtctrl::W](W) writer structure"]
512impl crate::Writable for DTCTRL_SPEC {
513    type Writer = W;
514    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
515    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
516}
517#[doc = "`reset()` method sets DTCTRL to value 0"]
518impl crate::Resettable for DTCTRL_SPEC {
519    const RESET_VALUE: Self::Ux = 0;
520}