efm32pg22_pac/efm32pg22c200/timer0_ns/
dtfcfg.rs

1#[doc = "Register `DTFCFG` reader"]
2pub struct R(crate::R<DTFCFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DTFCFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DTFCFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DTFCFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DTFCFG` writer"]
17pub struct W(crate::W<DTFCFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DTFCFG_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<DTFCFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DTFCFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DTFA` reader - DTI Fault Action"]
38pub type DTFA_R = crate::FieldReader<u8, DTFA_A>;
39#[doc = "DTI Fault Action\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum DTFA_A {
43    #[doc = "0: No action on fault"]
44    NONE = 0,
45    #[doc = "1: Set outputs inactive"]
46    INACTIVE = 1,
47    #[doc = "2: Clear outputs"]
48    CLEAR = 2,
49    #[doc = "3: Tristate outputs"]
50    TRISTATE = 3,
51}
52impl From<DTFA_A> for u8 {
53    #[inline(always)]
54    fn from(variant: DTFA_A) -> Self {
55        variant as _
56    }
57}
58impl DTFA_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> DTFA_A {
62        match self.bits {
63            0 => DTFA_A::NONE,
64            1 => DTFA_A::INACTIVE,
65            2 => DTFA_A::CLEAR,
66            3 => DTFA_A::TRISTATE,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `NONE`"]
71    #[inline(always)]
72    pub fn is_none(&self) -> bool {
73        *self == DTFA_A::NONE
74    }
75    #[doc = "Checks if the value of the field is `INACTIVE`"]
76    #[inline(always)]
77    pub fn is_inactive(&self) -> bool {
78        *self == DTFA_A::INACTIVE
79    }
80    #[doc = "Checks if the value of the field is `CLEAR`"]
81    #[inline(always)]
82    pub fn is_clear(&self) -> bool {
83        *self == DTFA_A::CLEAR
84    }
85    #[doc = "Checks if the value of the field is `TRISTATE`"]
86    #[inline(always)]
87    pub fn is_tristate(&self) -> bool {
88        *self == DTFA_A::TRISTATE
89    }
90}
91#[doc = "Field `DTFA` writer - DTI Fault Action"]
92pub type DTFA_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u32, DTFCFG_SPEC, u8, DTFA_A, 2, O>;
93impl<'a, const O: u8> DTFA_W<'a, O> {
94    #[doc = "No action on fault"]
95    #[inline(always)]
96    pub fn none(self) -> &'a mut W {
97        self.variant(DTFA_A::NONE)
98    }
99    #[doc = "Set outputs inactive"]
100    #[inline(always)]
101    pub fn inactive(self) -> &'a mut W {
102        self.variant(DTFA_A::INACTIVE)
103    }
104    #[doc = "Clear outputs"]
105    #[inline(always)]
106    pub fn clear(self) -> &'a mut W {
107        self.variant(DTFA_A::CLEAR)
108    }
109    #[doc = "Tristate outputs"]
110    #[inline(always)]
111    pub fn tristate(self) -> &'a mut W {
112        self.variant(DTFA_A::TRISTATE)
113    }
114}
115#[doc = "Field `DTPRS0FEN` reader - DTI PRS 0 Fault Enable"]
116pub type DTPRS0FEN_R = crate::BitReader<bool>;
117#[doc = "Field `DTPRS0FEN` writer - DTI PRS 0 Fault Enable"]
118pub type DTPRS0FEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTFCFG_SPEC, bool, O>;
119#[doc = "Field `DTPRS1FEN` reader - DTI PRS 1 Fault Enable"]
120pub type DTPRS1FEN_R = crate::BitReader<bool>;
121#[doc = "Field `DTPRS1FEN` writer - DTI PRS 1 Fault Enable"]
122pub type DTPRS1FEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTFCFG_SPEC, bool, O>;
123#[doc = "Field `DTDBGFEN` reader - DTI Debugger Fault Enable"]
124pub type DTDBGFEN_R = crate::BitReader<bool>;
125#[doc = "Field `DTDBGFEN` writer - DTI Debugger Fault Enable"]
126pub type DTDBGFEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTFCFG_SPEC, bool, O>;
127#[doc = "Field `DTLOCKUPFEN` reader - DTI Lockup Fault Enable"]
128pub type DTLOCKUPFEN_R = crate::BitReader<bool>;
129#[doc = "Field `DTLOCKUPFEN` writer - DTI Lockup Fault Enable"]
130pub type DTLOCKUPFEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTFCFG_SPEC, bool, O>;
131#[doc = "Field `DTEM23FEN` reader - DTI EM23 Fault Enable"]
132pub type DTEM23FEN_R = crate::BitReader<bool>;
133#[doc = "Field `DTEM23FEN` writer - DTI EM23 Fault Enable"]
134pub type DTEM23FEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTFCFG_SPEC, bool, O>;
135impl R {
136    #[doc = "Bits 16:17 - DTI Fault Action"]
137    #[inline(always)]
138    pub fn dtfa(&self) -> DTFA_R {
139        DTFA_R::new(((self.bits >> 16) & 3) as u8)
140    }
141    #[doc = "Bit 24 - DTI PRS 0 Fault Enable"]
142    #[inline(always)]
143    pub fn dtprs0fen(&self) -> DTPRS0FEN_R {
144        DTPRS0FEN_R::new(((self.bits >> 24) & 1) != 0)
145    }
146    #[doc = "Bit 25 - DTI PRS 1 Fault Enable"]
147    #[inline(always)]
148    pub fn dtprs1fen(&self) -> DTPRS1FEN_R {
149        DTPRS1FEN_R::new(((self.bits >> 25) & 1) != 0)
150    }
151    #[doc = "Bit 26 - DTI Debugger Fault Enable"]
152    #[inline(always)]
153    pub fn dtdbgfen(&self) -> DTDBGFEN_R {
154        DTDBGFEN_R::new(((self.bits >> 26) & 1) != 0)
155    }
156    #[doc = "Bit 27 - DTI Lockup Fault Enable"]
157    #[inline(always)]
158    pub fn dtlockupfen(&self) -> DTLOCKUPFEN_R {
159        DTLOCKUPFEN_R::new(((self.bits >> 27) & 1) != 0)
160    }
161    #[doc = "Bit 28 - DTI EM23 Fault Enable"]
162    #[inline(always)]
163    pub fn dtem23fen(&self) -> DTEM23FEN_R {
164        DTEM23FEN_R::new(((self.bits >> 28) & 1) != 0)
165    }
166}
167impl W {
168    #[doc = "Bits 16:17 - DTI Fault Action"]
169    #[inline(always)]
170    #[must_use]
171    pub fn dtfa(&mut self) -> DTFA_W<16> {
172        DTFA_W::new(self)
173    }
174    #[doc = "Bit 24 - DTI PRS 0 Fault Enable"]
175    #[inline(always)]
176    #[must_use]
177    pub fn dtprs0fen(&mut self) -> DTPRS0FEN_W<24> {
178        DTPRS0FEN_W::new(self)
179    }
180    #[doc = "Bit 25 - DTI PRS 1 Fault Enable"]
181    #[inline(always)]
182    #[must_use]
183    pub fn dtprs1fen(&mut self) -> DTPRS1FEN_W<25> {
184        DTPRS1FEN_W::new(self)
185    }
186    #[doc = "Bit 26 - DTI Debugger Fault Enable"]
187    #[inline(always)]
188    #[must_use]
189    pub fn dtdbgfen(&mut self) -> DTDBGFEN_W<26> {
190        DTDBGFEN_W::new(self)
191    }
192    #[doc = "Bit 27 - DTI Lockup Fault Enable"]
193    #[inline(always)]
194    #[must_use]
195    pub fn dtlockupfen(&mut self) -> DTLOCKUPFEN_W<27> {
196        DTLOCKUPFEN_W::new(self)
197    }
198    #[doc = "Bit 28 - DTI EM23 Fault Enable"]
199    #[inline(always)]
200    #[must_use]
201    pub fn dtem23fen(&mut self) -> DTEM23FEN_W<28> {
202        DTEM23FEN_W::new(self)
203    }
204    #[doc = "Writes raw bits to the register."]
205    #[inline(always)]
206    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
207        self.0.bits(bits);
208        self
209    }
210}
211#[doc = "No Description\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 [dtfcfg](index.html) module"]
212pub struct DTFCFG_SPEC;
213impl crate::RegisterSpec for DTFCFG_SPEC {
214    type Ux = u32;
215}
216#[doc = "`read()` method returns [dtfcfg::R](R) reader structure"]
217impl crate::Readable for DTFCFG_SPEC {
218    type Reader = R;
219}
220#[doc = "`write(|w| ..)` method takes [dtfcfg::W](W) writer structure"]
221impl crate::Writable for DTFCFG_SPEC {
222    type Writer = W;
223    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
224    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
225}
226#[doc = "`reset()` method sets DTFCFG to value 0"]
227impl crate::Resettable for DTFCFG_SPEC {
228    const RESET_VALUE: Self::Ux = 0;
229}