efm32g230_pac/timer2/
dtfc.rs

1#[doc = "Register `DTFC` reader"]
2pub struct R(crate::R<DTFC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DTFC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DTFC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DTFC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DTFC` writer"]
17pub struct W(crate::W<DTFC_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DTFC_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<DTFC_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DTFC_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "DTI PRS Fault Source 0 Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum DTPRS0FSEL_A {
41    #[doc = "0: PRS Channel 0 selected as fault source 0"]
42    PRSCH0 = 0,
43    #[doc = "1: PRS Channel 1 selected as fault source 0"]
44    PRSCH1 = 1,
45    #[doc = "2: PRS Channel 2 selected as fault source 0"]
46    PRSCH2 = 2,
47    #[doc = "3: PRS Channel 3 selected as fault source 0"]
48    PRSCH3 = 3,
49    #[doc = "4: PRS Channel 4 selected as fault source 0"]
50    PRSCH4 = 4,
51    #[doc = "5: PRS Channel 5 selected as fault source 0"]
52    PRSCH5 = 5,
53    #[doc = "6: PRS Channel 6 selected as fault source 0"]
54    PRSCH6 = 6,
55    #[doc = "7: PRS Channel 7 selected as fault source 0"]
56    PRSCH7 = 7,
57}
58impl From<DTPRS0FSEL_A> for u8 {
59    #[inline(always)]
60    fn from(variant: DTPRS0FSEL_A) -> Self {
61        variant as _
62    }
63}
64#[doc = "Field `DTPRS0FSEL` reader - DTI PRS Fault Source 0 Select"]
65pub type DTPRS0FSEL_R = crate::FieldReader<u8, DTPRS0FSEL_A>;
66impl DTPRS0FSEL_R {
67    #[doc = "Get enumerated values variant"]
68    #[inline(always)]
69    pub fn variant(&self) -> DTPRS0FSEL_A {
70        match self.bits {
71            0 => DTPRS0FSEL_A::PRSCH0,
72            1 => DTPRS0FSEL_A::PRSCH1,
73            2 => DTPRS0FSEL_A::PRSCH2,
74            3 => DTPRS0FSEL_A::PRSCH3,
75            4 => DTPRS0FSEL_A::PRSCH4,
76            5 => DTPRS0FSEL_A::PRSCH5,
77            6 => DTPRS0FSEL_A::PRSCH6,
78            7 => DTPRS0FSEL_A::PRSCH7,
79            _ => unreachable!(),
80        }
81    }
82    #[doc = "Checks if the value of the field is `PRSCH0`"]
83    #[inline(always)]
84    pub fn is_prsch0(&self) -> bool {
85        *self == DTPRS0FSEL_A::PRSCH0
86    }
87    #[doc = "Checks if the value of the field is `PRSCH1`"]
88    #[inline(always)]
89    pub fn is_prsch1(&self) -> bool {
90        *self == DTPRS0FSEL_A::PRSCH1
91    }
92    #[doc = "Checks if the value of the field is `PRSCH2`"]
93    #[inline(always)]
94    pub fn is_prsch2(&self) -> bool {
95        *self == DTPRS0FSEL_A::PRSCH2
96    }
97    #[doc = "Checks if the value of the field is `PRSCH3`"]
98    #[inline(always)]
99    pub fn is_prsch3(&self) -> bool {
100        *self == DTPRS0FSEL_A::PRSCH3
101    }
102    #[doc = "Checks if the value of the field is `PRSCH4`"]
103    #[inline(always)]
104    pub fn is_prsch4(&self) -> bool {
105        *self == DTPRS0FSEL_A::PRSCH4
106    }
107    #[doc = "Checks if the value of the field is `PRSCH5`"]
108    #[inline(always)]
109    pub fn is_prsch5(&self) -> bool {
110        *self == DTPRS0FSEL_A::PRSCH5
111    }
112    #[doc = "Checks if the value of the field is `PRSCH6`"]
113    #[inline(always)]
114    pub fn is_prsch6(&self) -> bool {
115        *self == DTPRS0FSEL_A::PRSCH6
116    }
117    #[doc = "Checks if the value of the field is `PRSCH7`"]
118    #[inline(always)]
119    pub fn is_prsch7(&self) -> bool {
120        *self == DTPRS0FSEL_A::PRSCH7
121    }
122}
123#[doc = "Field `DTPRS0FSEL` writer - DTI PRS Fault Source 0 Select"]
124pub type DTPRS0FSEL_W<'a> = crate::FieldWriterSafe<'a, u32, DTFC_SPEC, u8, DTPRS0FSEL_A, 3, 0>;
125impl<'a> DTPRS0FSEL_W<'a> {
126    #[doc = "PRS Channel 0 selected as fault source 0"]
127    #[inline(always)]
128    pub fn prsch0(self) -> &'a mut W {
129        self.variant(DTPRS0FSEL_A::PRSCH0)
130    }
131    #[doc = "PRS Channel 1 selected as fault source 0"]
132    #[inline(always)]
133    pub fn prsch1(self) -> &'a mut W {
134        self.variant(DTPRS0FSEL_A::PRSCH1)
135    }
136    #[doc = "PRS Channel 2 selected as fault source 0"]
137    #[inline(always)]
138    pub fn prsch2(self) -> &'a mut W {
139        self.variant(DTPRS0FSEL_A::PRSCH2)
140    }
141    #[doc = "PRS Channel 3 selected as fault source 0"]
142    #[inline(always)]
143    pub fn prsch3(self) -> &'a mut W {
144        self.variant(DTPRS0FSEL_A::PRSCH3)
145    }
146    #[doc = "PRS Channel 4 selected as fault source 0"]
147    #[inline(always)]
148    pub fn prsch4(self) -> &'a mut W {
149        self.variant(DTPRS0FSEL_A::PRSCH4)
150    }
151    #[doc = "PRS Channel 5 selected as fault source 0"]
152    #[inline(always)]
153    pub fn prsch5(self) -> &'a mut W {
154        self.variant(DTPRS0FSEL_A::PRSCH5)
155    }
156    #[doc = "PRS Channel 6 selected as fault source 0"]
157    #[inline(always)]
158    pub fn prsch6(self) -> &'a mut W {
159        self.variant(DTPRS0FSEL_A::PRSCH6)
160    }
161    #[doc = "PRS Channel 7 selected as fault source 0"]
162    #[inline(always)]
163    pub fn prsch7(self) -> &'a mut W {
164        self.variant(DTPRS0FSEL_A::PRSCH7)
165    }
166}
167#[doc = "DTI PRS Fault Source 1 Select\n\nValue on reset: 0"]
168#[derive(Clone, Copy, Debug, PartialEq)]
169#[repr(u8)]
170pub enum DTPRS1FSEL_A {
171    #[doc = "0: PRS Channel 0 selected as fault source 1"]
172    PRSCH0 = 0,
173    #[doc = "1: PRS Channel 1 selected as fault source 1"]
174    PRSCH1 = 1,
175    #[doc = "2: PRS Channel 2 selected as fault source 1"]
176    PRSCH2 = 2,
177    #[doc = "3: PRS Channel 3 selected as fault source 1"]
178    PRSCH3 = 3,
179    #[doc = "4: PRS Channel 4 selected as fault source 1"]
180    PRSCH4 = 4,
181    #[doc = "5: PRS Channel 5 selected as fault source 1"]
182    PRSCH5 = 5,
183    #[doc = "6: PRS Channel 6 selected as fault source 1"]
184    PRSCH6 = 6,
185    #[doc = "7: PRS Channel 7 selected as fault source 1"]
186    PRSCH7 = 7,
187}
188impl From<DTPRS1FSEL_A> for u8 {
189    #[inline(always)]
190    fn from(variant: DTPRS1FSEL_A) -> Self {
191        variant as _
192    }
193}
194#[doc = "Field `DTPRS1FSEL` reader - DTI PRS Fault Source 1 Select"]
195pub type DTPRS1FSEL_R = crate::FieldReader<u8, DTPRS1FSEL_A>;
196impl DTPRS1FSEL_R {
197    #[doc = "Get enumerated values variant"]
198    #[inline(always)]
199    pub fn variant(&self) -> DTPRS1FSEL_A {
200        match self.bits {
201            0 => DTPRS1FSEL_A::PRSCH0,
202            1 => DTPRS1FSEL_A::PRSCH1,
203            2 => DTPRS1FSEL_A::PRSCH2,
204            3 => DTPRS1FSEL_A::PRSCH3,
205            4 => DTPRS1FSEL_A::PRSCH4,
206            5 => DTPRS1FSEL_A::PRSCH5,
207            6 => DTPRS1FSEL_A::PRSCH6,
208            7 => DTPRS1FSEL_A::PRSCH7,
209            _ => unreachable!(),
210        }
211    }
212    #[doc = "Checks if the value of the field is `PRSCH0`"]
213    #[inline(always)]
214    pub fn is_prsch0(&self) -> bool {
215        *self == DTPRS1FSEL_A::PRSCH0
216    }
217    #[doc = "Checks if the value of the field is `PRSCH1`"]
218    #[inline(always)]
219    pub fn is_prsch1(&self) -> bool {
220        *self == DTPRS1FSEL_A::PRSCH1
221    }
222    #[doc = "Checks if the value of the field is `PRSCH2`"]
223    #[inline(always)]
224    pub fn is_prsch2(&self) -> bool {
225        *self == DTPRS1FSEL_A::PRSCH2
226    }
227    #[doc = "Checks if the value of the field is `PRSCH3`"]
228    #[inline(always)]
229    pub fn is_prsch3(&self) -> bool {
230        *self == DTPRS1FSEL_A::PRSCH3
231    }
232    #[doc = "Checks if the value of the field is `PRSCH4`"]
233    #[inline(always)]
234    pub fn is_prsch4(&self) -> bool {
235        *self == DTPRS1FSEL_A::PRSCH4
236    }
237    #[doc = "Checks if the value of the field is `PRSCH5`"]
238    #[inline(always)]
239    pub fn is_prsch5(&self) -> bool {
240        *self == DTPRS1FSEL_A::PRSCH5
241    }
242    #[doc = "Checks if the value of the field is `PRSCH6`"]
243    #[inline(always)]
244    pub fn is_prsch6(&self) -> bool {
245        *self == DTPRS1FSEL_A::PRSCH6
246    }
247    #[doc = "Checks if the value of the field is `PRSCH7`"]
248    #[inline(always)]
249    pub fn is_prsch7(&self) -> bool {
250        *self == DTPRS1FSEL_A::PRSCH7
251    }
252}
253#[doc = "Field `DTPRS1FSEL` writer - DTI PRS Fault Source 1 Select"]
254pub type DTPRS1FSEL_W<'a> = crate::FieldWriterSafe<'a, u32, DTFC_SPEC, u8, DTPRS1FSEL_A, 3, 8>;
255impl<'a> DTPRS1FSEL_W<'a> {
256    #[doc = "PRS Channel 0 selected as fault source 1"]
257    #[inline(always)]
258    pub fn prsch0(self) -> &'a mut W {
259        self.variant(DTPRS1FSEL_A::PRSCH0)
260    }
261    #[doc = "PRS Channel 1 selected as fault source 1"]
262    #[inline(always)]
263    pub fn prsch1(self) -> &'a mut W {
264        self.variant(DTPRS1FSEL_A::PRSCH1)
265    }
266    #[doc = "PRS Channel 2 selected as fault source 1"]
267    #[inline(always)]
268    pub fn prsch2(self) -> &'a mut W {
269        self.variant(DTPRS1FSEL_A::PRSCH2)
270    }
271    #[doc = "PRS Channel 3 selected as fault source 1"]
272    #[inline(always)]
273    pub fn prsch3(self) -> &'a mut W {
274        self.variant(DTPRS1FSEL_A::PRSCH3)
275    }
276    #[doc = "PRS Channel 4 selected as fault source 1"]
277    #[inline(always)]
278    pub fn prsch4(self) -> &'a mut W {
279        self.variant(DTPRS1FSEL_A::PRSCH4)
280    }
281    #[doc = "PRS Channel 5 selected as fault source 1"]
282    #[inline(always)]
283    pub fn prsch5(self) -> &'a mut W {
284        self.variant(DTPRS1FSEL_A::PRSCH5)
285    }
286    #[doc = "PRS Channel 6 selected as fault source 1"]
287    #[inline(always)]
288    pub fn prsch6(self) -> &'a mut W {
289        self.variant(DTPRS1FSEL_A::PRSCH6)
290    }
291    #[doc = "PRS Channel 7 selected as fault source 1"]
292    #[inline(always)]
293    pub fn prsch7(self) -> &'a mut W {
294        self.variant(DTPRS1FSEL_A::PRSCH7)
295    }
296}
297#[doc = "DTI Fault Action\n\nValue on reset: 0"]
298#[derive(Clone, Copy, Debug, PartialEq)]
299#[repr(u8)]
300pub enum DTFA_A {
301    #[doc = "0: No action on fault"]
302    NONE = 0,
303    #[doc = "1: Set outputs inactive"]
304    INACTIVE = 1,
305    #[doc = "2: Clear outputs"]
306    CLEAR = 2,
307    #[doc = "3: Tristate outputs"]
308    TRISTATE = 3,
309}
310impl From<DTFA_A> for u8 {
311    #[inline(always)]
312    fn from(variant: DTFA_A) -> Self {
313        variant as _
314    }
315}
316#[doc = "Field `DTFA` reader - DTI Fault Action"]
317pub type DTFA_R = crate::FieldReader<u8, DTFA_A>;
318impl DTFA_R {
319    #[doc = "Get enumerated values variant"]
320    #[inline(always)]
321    pub fn variant(&self) -> DTFA_A {
322        match self.bits {
323            0 => DTFA_A::NONE,
324            1 => DTFA_A::INACTIVE,
325            2 => DTFA_A::CLEAR,
326            3 => DTFA_A::TRISTATE,
327            _ => unreachable!(),
328        }
329    }
330    #[doc = "Checks if the value of the field is `NONE`"]
331    #[inline(always)]
332    pub fn is_none(&self) -> bool {
333        *self == DTFA_A::NONE
334    }
335    #[doc = "Checks if the value of the field is `INACTIVE`"]
336    #[inline(always)]
337    pub fn is_inactive(&self) -> bool {
338        *self == DTFA_A::INACTIVE
339    }
340    #[doc = "Checks if the value of the field is `CLEAR`"]
341    #[inline(always)]
342    pub fn is_clear(&self) -> bool {
343        *self == DTFA_A::CLEAR
344    }
345    #[doc = "Checks if the value of the field is `TRISTATE`"]
346    #[inline(always)]
347    pub fn is_tristate(&self) -> bool {
348        *self == DTFA_A::TRISTATE
349    }
350}
351#[doc = "Field `DTFA` writer - DTI Fault Action"]
352pub type DTFA_W<'a> = crate::FieldWriterSafe<'a, u32, DTFC_SPEC, u8, DTFA_A, 2, 16>;
353impl<'a> DTFA_W<'a> {
354    #[doc = "No action on fault"]
355    #[inline(always)]
356    pub fn none(self) -> &'a mut W {
357        self.variant(DTFA_A::NONE)
358    }
359    #[doc = "Set outputs inactive"]
360    #[inline(always)]
361    pub fn inactive(self) -> &'a mut W {
362        self.variant(DTFA_A::INACTIVE)
363    }
364    #[doc = "Clear outputs"]
365    #[inline(always)]
366    pub fn clear(self) -> &'a mut W {
367        self.variant(DTFA_A::CLEAR)
368    }
369    #[doc = "Tristate outputs"]
370    #[inline(always)]
371    pub fn tristate(self) -> &'a mut W {
372        self.variant(DTFA_A::TRISTATE)
373    }
374}
375#[doc = "Field `DTPRS0FEN` reader - DTI PRS 0 Fault Enable"]
376pub type DTPRS0FEN_R = crate::BitReader<bool>;
377#[doc = "Field `DTPRS0FEN` writer - DTI PRS 0 Fault Enable"]
378pub type DTPRS0FEN_W<'a> = crate::BitWriter<'a, u32, DTFC_SPEC, bool, 24>;
379#[doc = "Field `DTPRS1FEN` reader - DTI PRS 1 Fault Enable"]
380pub type DTPRS1FEN_R = crate::BitReader<bool>;
381#[doc = "Field `DTPRS1FEN` writer - DTI PRS 1 Fault Enable"]
382pub type DTPRS1FEN_W<'a> = crate::BitWriter<'a, u32, DTFC_SPEC, bool, 25>;
383#[doc = "Field `DTDBGFEN` reader - DTI Debugger Fault Enable"]
384pub type DTDBGFEN_R = crate::BitReader<bool>;
385#[doc = "Field `DTDBGFEN` writer - DTI Debugger Fault Enable"]
386pub type DTDBGFEN_W<'a> = crate::BitWriter<'a, u32, DTFC_SPEC, bool, 26>;
387#[doc = "Field `DTLOCKUPFEN` reader - DTI Lockup Fault Enable"]
388pub type DTLOCKUPFEN_R = crate::BitReader<bool>;
389#[doc = "Field `DTLOCKUPFEN` writer - DTI Lockup Fault Enable"]
390pub type DTLOCKUPFEN_W<'a> = crate::BitWriter<'a, u32, DTFC_SPEC, bool, 27>;
391impl R {
392    #[doc = "Bits 0:2 - DTI PRS Fault Source 0 Select"]
393    #[inline(always)]
394    pub fn dtprs0fsel(&self) -> DTPRS0FSEL_R {
395        DTPRS0FSEL_R::new((self.bits & 7) as u8)
396    }
397    #[doc = "Bits 8:10 - DTI PRS Fault Source 1 Select"]
398    #[inline(always)]
399    pub fn dtprs1fsel(&self) -> DTPRS1FSEL_R {
400        DTPRS1FSEL_R::new(((self.bits >> 8) & 7) as u8)
401    }
402    #[doc = "Bits 16:17 - DTI Fault Action"]
403    #[inline(always)]
404    pub fn dtfa(&self) -> DTFA_R {
405        DTFA_R::new(((self.bits >> 16) & 3) as u8)
406    }
407    #[doc = "Bit 24 - DTI PRS 0 Fault Enable"]
408    #[inline(always)]
409    pub fn dtprs0fen(&self) -> DTPRS0FEN_R {
410        DTPRS0FEN_R::new(((self.bits >> 24) & 1) != 0)
411    }
412    #[doc = "Bit 25 - DTI PRS 1 Fault Enable"]
413    #[inline(always)]
414    pub fn dtprs1fen(&self) -> DTPRS1FEN_R {
415        DTPRS1FEN_R::new(((self.bits >> 25) & 1) != 0)
416    }
417    #[doc = "Bit 26 - DTI Debugger Fault Enable"]
418    #[inline(always)]
419    pub fn dtdbgfen(&self) -> DTDBGFEN_R {
420        DTDBGFEN_R::new(((self.bits >> 26) & 1) != 0)
421    }
422    #[doc = "Bit 27 - DTI Lockup Fault Enable"]
423    #[inline(always)]
424    pub fn dtlockupfen(&self) -> DTLOCKUPFEN_R {
425        DTLOCKUPFEN_R::new(((self.bits >> 27) & 1) != 0)
426    }
427}
428impl W {
429    #[doc = "Bits 0:2 - DTI PRS Fault Source 0 Select"]
430    #[inline(always)]
431    pub fn dtprs0fsel(&mut self) -> DTPRS0FSEL_W {
432        DTPRS0FSEL_W::new(self)
433    }
434    #[doc = "Bits 8:10 - DTI PRS Fault Source 1 Select"]
435    #[inline(always)]
436    pub fn dtprs1fsel(&mut self) -> DTPRS1FSEL_W {
437        DTPRS1FSEL_W::new(self)
438    }
439    #[doc = "Bits 16:17 - DTI Fault Action"]
440    #[inline(always)]
441    pub fn dtfa(&mut self) -> DTFA_W {
442        DTFA_W::new(self)
443    }
444    #[doc = "Bit 24 - DTI PRS 0 Fault Enable"]
445    #[inline(always)]
446    pub fn dtprs0fen(&mut self) -> DTPRS0FEN_W {
447        DTPRS0FEN_W::new(self)
448    }
449    #[doc = "Bit 25 - DTI PRS 1 Fault Enable"]
450    #[inline(always)]
451    pub fn dtprs1fen(&mut self) -> DTPRS1FEN_W {
452        DTPRS1FEN_W::new(self)
453    }
454    #[doc = "Bit 26 - DTI Debugger Fault Enable"]
455    #[inline(always)]
456    pub fn dtdbgfen(&mut self) -> DTDBGFEN_W {
457        DTDBGFEN_W::new(self)
458    }
459    #[doc = "Bit 27 - DTI Lockup Fault Enable"]
460    #[inline(always)]
461    pub fn dtlockupfen(&mut self) -> DTLOCKUPFEN_W {
462        DTLOCKUPFEN_W::new(self)
463    }
464    #[doc = "Writes raw bits to the register."]
465    #[inline(always)]
466    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
467        self.0.bits(bits);
468        self
469    }
470}
471#[doc = "DTI Fault Configuration 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 [dtfc](index.html) module"]
472pub struct DTFC_SPEC;
473impl crate::RegisterSpec for DTFC_SPEC {
474    type Ux = u32;
475}
476#[doc = "`read()` method returns [dtfc::R](R) reader structure"]
477impl crate::Readable for DTFC_SPEC {
478    type Reader = R;
479}
480#[doc = "`write(|w| ..)` method takes [dtfc::W](W) writer structure"]
481impl crate::Writable for DTFC_SPEC {
482    type Writer = W;
483}
484#[doc = "`reset()` method sets DTFC to value 0"]
485impl crate::Resettable for DTFC_SPEC {
486    #[inline(always)]
487    fn reset_value() -> Self::Ux {
488        0
489    }
490}