efm32jg12b_pac/efm32jg12b500/wtimer1/
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}
84impl From<DTPRSSEL_A> for u8 {
85    #[inline(always)]
86    fn from(variant: DTPRSSEL_A) -> Self {
87        variant as _
88    }
89}
90impl DTPRSSEL_R {
91    #[doc = "Get enumerated values variant"]
92    #[inline(always)]
93    pub fn variant(&self) -> Option<DTPRSSEL_A> {
94        match self.bits {
95            0 => Some(DTPRSSEL_A::PRSCH0),
96            1 => Some(DTPRSSEL_A::PRSCH1),
97            2 => Some(DTPRSSEL_A::PRSCH2),
98            3 => Some(DTPRSSEL_A::PRSCH3),
99            4 => Some(DTPRSSEL_A::PRSCH4),
100            5 => Some(DTPRSSEL_A::PRSCH5),
101            6 => Some(DTPRSSEL_A::PRSCH6),
102            7 => Some(DTPRSSEL_A::PRSCH7),
103            8 => Some(DTPRSSEL_A::PRSCH8),
104            9 => Some(DTPRSSEL_A::PRSCH9),
105            10 => Some(DTPRSSEL_A::PRSCH10),
106            11 => Some(DTPRSSEL_A::PRSCH11),
107            _ => None,
108        }
109    }
110    #[doc = "Checks if the value of the field is `PRSCH0`"]
111    #[inline(always)]
112    pub fn is_prsch0(&self) -> bool {
113        *self == DTPRSSEL_A::PRSCH0
114    }
115    #[doc = "Checks if the value of the field is `PRSCH1`"]
116    #[inline(always)]
117    pub fn is_prsch1(&self) -> bool {
118        *self == DTPRSSEL_A::PRSCH1
119    }
120    #[doc = "Checks if the value of the field is `PRSCH2`"]
121    #[inline(always)]
122    pub fn is_prsch2(&self) -> bool {
123        *self == DTPRSSEL_A::PRSCH2
124    }
125    #[doc = "Checks if the value of the field is `PRSCH3`"]
126    #[inline(always)]
127    pub fn is_prsch3(&self) -> bool {
128        *self == DTPRSSEL_A::PRSCH3
129    }
130    #[doc = "Checks if the value of the field is `PRSCH4`"]
131    #[inline(always)]
132    pub fn is_prsch4(&self) -> bool {
133        *self == DTPRSSEL_A::PRSCH4
134    }
135    #[doc = "Checks if the value of the field is `PRSCH5`"]
136    #[inline(always)]
137    pub fn is_prsch5(&self) -> bool {
138        *self == DTPRSSEL_A::PRSCH5
139    }
140    #[doc = "Checks if the value of the field is `PRSCH6`"]
141    #[inline(always)]
142    pub fn is_prsch6(&self) -> bool {
143        *self == DTPRSSEL_A::PRSCH6
144    }
145    #[doc = "Checks if the value of the field is `PRSCH7`"]
146    #[inline(always)]
147    pub fn is_prsch7(&self) -> bool {
148        *self == DTPRSSEL_A::PRSCH7
149    }
150    #[doc = "Checks if the value of the field is `PRSCH8`"]
151    #[inline(always)]
152    pub fn is_prsch8(&self) -> bool {
153        *self == DTPRSSEL_A::PRSCH8
154    }
155    #[doc = "Checks if the value of the field is `PRSCH9`"]
156    #[inline(always)]
157    pub fn is_prsch9(&self) -> bool {
158        *self == DTPRSSEL_A::PRSCH9
159    }
160    #[doc = "Checks if the value of the field is `PRSCH10`"]
161    #[inline(always)]
162    pub fn is_prsch10(&self) -> bool {
163        *self == DTPRSSEL_A::PRSCH10
164    }
165    #[doc = "Checks if the value of the field is `PRSCH11`"]
166    #[inline(always)]
167    pub fn is_prsch11(&self) -> bool {
168        *self == DTPRSSEL_A::PRSCH11
169    }
170}
171#[doc = "Field `DTPRSSEL` writer - DTI PRS Source Channel Select"]
172pub type DTPRSSEL_W<'a, const O: u8> =
173    crate::FieldWriter<'a, u32, DTCTRL_SPEC, u8, DTPRSSEL_A, 4, O>;
174impl<'a, const O: u8> DTPRSSEL_W<'a, O> {
175    #[doc = "PRS Channel 0 selected as input"]
176    #[inline(always)]
177    pub fn prsch0(self) -> &'a mut W {
178        self.variant(DTPRSSEL_A::PRSCH0)
179    }
180    #[doc = "PRS Channel 1 selected as input"]
181    #[inline(always)]
182    pub fn prsch1(self) -> &'a mut W {
183        self.variant(DTPRSSEL_A::PRSCH1)
184    }
185    #[doc = "PRS Channel 2 selected as input"]
186    #[inline(always)]
187    pub fn prsch2(self) -> &'a mut W {
188        self.variant(DTPRSSEL_A::PRSCH2)
189    }
190    #[doc = "PRS Channel 3 selected as input"]
191    #[inline(always)]
192    pub fn prsch3(self) -> &'a mut W {
193        self.variant(DTPRSSEL_A::PRSCH3)
194    }
195    #[doc = "PRS Channel 4 selected as input"]
196    #[inline(always)]
197    pub fn prsch4(self) -> &'a mut W {
198        self.variant(DTPRSSEL_A::PRSCH4)
199    }
200    #[doc = "PRS Channel 5 selected as input"]
201    #[inline(always)]
202    pub fn prsch5(self) -> &'a mut W {
203        self.variant(DTPRSSEL_A::PRSCH5)
204    }
205    #[doc = "PRS Channel 6 selected as input"]
206    #[inline(always)]
207    pub fn prsch6(self) -> &'a mut W {
208        self.variant(DTPRSSEL_A::PRSCH6)
209    }
210    #[doc = "PRS Channel 7 selected as input"]
211    #[inline(always)]
212    pub fn prsch7(self) -> &'a mut W {
213        self.variant(DTPRSSEL_A::PRSCH7)
214    }
215    #[doc = "PRS Channel 8 selected as input"]
216    #[inline(always)]
217    pub fn prsch8(self) -> &'a mut W {
218        self.variant(DTPRSSEL_A::PRSCH8)
219    }
220    #[doc = "PRS Channel 9 selected as input"]
221    #[inline(always)]
222    pub fn prsch9(self) -> &'a mut W {
223        self.variant(DTPRSSEL_A::PRSCH9)
224    }
225    #[doc = "PRS Channel 10 selected as input"]
226    #[inline(always)]
227    pub fn prsch10(self) -> &'a mut W {
228        self.variant(DTPRSSEL_A::PRSCH10)
229    }
230    #[doc = "PRS Channel 11 selected as input"]
231    #[inline(always)]
232    pub fn prsch11(self) -> &'a mut W {
233        self.variant(DTPRSSEL_A::PRSCH11)
234    }
235}
236#[doc = "Field `DTAR` reader - DTI Always Run"]
237pub type DTAR_R = crate::BitReader<bool>;
238#[doc = "Field `DTAR` writer - DTI Always Run"]
239pub type DTAR_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
240#[doc = "Field `DTFATS` reader - DTI Fault Action on Timer Stop"]
241pub type DTFATS_R = crate::BitReader<bool>;
242#[doc = "Field `DTFATS` writer - DTI Fault Action on Timer Stop"]
243pub type DTFATS_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
244#[doc = "Field `DTPRSEN` reader - DTI PRS Source Enable"]
245pub type DTPRSEN_R = crate::BitReader<bool>;
246#[doc = "Field `DTPRSEN` writer - DTI PRS Source Enable"]
247pub type DTPRSEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
248impl R {
249    #[doc = "Bit 0 - DTI Enable"]
250    #[inline(always)]
251    pub fn dten(&self) -> DTEN_R {
252        DTEN_R::new((self.bits & 1) != 0)
253    }
254    #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
255    #[inline(always)]
256    pub fn dtdas(&self) -> DTDAS_R {
257        DTDAS_R::new(((self.bits >> 1) & 1) != 0)
258    }
259    #[doc = "Bit 2 - DTI Inactive Polarity"]
260    #[inline(always)]
261    pub fn dtipol(&self) -> DTIPOL_R {
262        DTIPOL_R::new(((self.bits >> 2) & 1) != 0)
263    }
264    #[doc = "Bit 3 - DTI Complementary Output Invert"]
265    #[inline(always)]
266    pub fn dtcinv(&self) -> DTCINV_R {
267        DTCINV_R::new(((self.bits >> 3) & 1) != 0)
268    }
269    #[doc = "Bits 4:7 - DTI PRS Source Channel Select"]
270    #[inline(always)]
271    pub fn dtprssel(&self) -> DTPRSSEL_R {
272        DTPRSSEL_R::new(((self.bits >> 4) & 0x0f) as u8)
273    }
274    #[doc = "Bit 9 - DTI Always Run"]
275    #[inline(always)]
276    pub fn dtar(&self) -> DTAR_R {
277        DTAR_R::new(((self.bits >> 9) & 1) != 0)
278    }
279    #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
280    #[inline(always)]
281    pub fn dtfats(&self) -> DTFATS_R {
282        DTFATS_R::new(((self.bits >> 10) & 1) != 0)
283    }
284    #[doc = "Bit 24 - DTI PRS Source Enable"]
285    #[inline(always)]
286    pub fn dtprsen(&self) -> DTPRSEN_R {
287        DTPRSEN_R::new(((self.bits >> 24) & 1) != 0)
288    }
289}
290impl W {
291    #[doc = "Bit 0 - DTI Enable"]
292    #[inline(always)]
293    #[must_use]
294    pub fn dten(&mut self) -> DTEN_W<0> {
295        DTEN_W::new(self)
296    }
297    #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
298    #[inline(always)]
299    #[must_use]
300    pub fn dtdas(&mut self) -> DTDAS_W<1> {
301        DTDAS_W::new(self)
302    }
303    #[doc = "Bit 2 - DTI Inactive Polarity"]
304    #[inline(always)]
305    #[must_use]
306    pub fn dtipol(&mut self) -> DTIPOL_W<2> {
307        DTIPOL_W::new(self)
308    }
309    #[doc = "Bit 3 - DTI Complementary Output Invert"]
310    #[inline(always)]
311    #[must_use]
312    pub fn dtcinv(&mut self) -> DTCINV_W<3> {
313        DTCINV_W::new(self)
314    }
315    #[doc = "Bits 4:7 - DTI PRS Source Channel Select"]
316    #[inline(always)]
317    #[must_use]
318    pub fn dtprssel(&mut self) -> DTPRSSEL_W<4> {
319        DTPRSSEL_W::new(self)
320    }
321    #[doc = "Bit 9 - DTI Always Run"]
322    #[inline(always)]
323    #[must_use]
324    pub fn dtar(&mut self) -> DTAR_W<9> {
325        DTAR_W::new(self)
326    }
327    #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
328    #[inline(always)]
329    #[must_use]
330    pub fn dtfats(&mut self) -> DTFATS_W<10> {
331        DTFATS_W::new(self)
332    }
333    #[doc = "Bit 24 - DTI PRS Source Enable"]
334    #[inline(always)]
335    #[must_use]
336    pub fn dtprsen(&mut self) -> DTPRSEN_W<24> {
337        DTPRSEN_W::new(self)
338    }
339    #[doc = "Writes raw bits to the register."]
340    #[inline(always)]
341    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
342        self.0.bits(bits);
343        self
344    }
345}
346#[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"]
347pub struct DTCTRL_SPEC;
348impl crate::RegisterSpec for DTCTRL_SPEC {
349    type Ux = u32;
350}
351#[doc = "`read()` method returns [dtctrl::R](R) reader structure"]
352impl crate::Readable for DTCTRL_SPEC {
353    type Reader = R;
354}
355#[doc = "`write(|w| ..)` method takes [dtctrl::W](W) writer structure"]
356impl crate::Writable for DTCTRL_SPEC {
357    type Writer = W;
358    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
359    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
360}
361#[doc = "`reset()` method sets DTCTRL to value 0"]
362impl crate::Resettable for DTCTRL_SPEC {
363    const RESET_VALUE: Self::Ux = 0;
364}