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