efm32gg12b130_pac/wtimer0/
dtctrl.rs1#[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> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 0>;
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> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 1>;
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> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 2>;
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> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 3>;
53#[doc = "DTI PRS Source Channel Select\n\nValue on reset: 0"]
54#[derive(Clone, Copy, Debug, PartialEq)]
55#[repr(u8)]
56pub enum DTPRSSEL_A {
57 #[doc = "0: PRS Channel 0 selected as input"]
58 PRSCH0 = 0,
59 #[doc = "1: PRS Channel 1 selected as input"]
60 PRSCH1 = 1,
61 #[doc = "2: PRS Channel 2 selected as input"]
62 PRSCH2 = 2,
63 #[doc = "3: PRS Channel 3 selected as input"]
64 PRSCH3 = 3,
65 #[doc = "4: PRS Channel 4 selected as input"]
66 PRSCH4 = 4,
67 #[doc = "5: PRS Channel 5 selected as input"]
68 PRSCH5 = 5,
69 #[doc = "6: PRS Channel 6 selected as input"]
70 PRSCH6 = 6,
71 #[doc = "7: PRS Channel 7 selected as input"]
72 PRSCH7 = 7,
73 #[doc = "8: PRS Channel 8 selected as input"]
74 PRSCH8 = 8,
75 #[doc = "9: PRS Channel 9 selected as input"]
76 PRSCH9 = 9,
77 #[doc = "10: PRS Channel 10 selected as input"]
78 PRSCH10 = 10,
79 #[doc = "11: PRS Channel 11 selected as input"]
80 PRSCH11 = 11,
81 #[doc = "12: PRS Channel 12 selected as input"]
82 PRSCH12 = 12,
83 #[doc = "13: PRS Channel 13 selected as input"]
84 PRSCH13 = 13,
85 #[doc = "14: PRS Channel 14 selected as input"]
86 PRSCH14 = 14,
87 #[doc = "15: PRS Channel 15 selected as input"]
88 PRSCH15 = 15,
89}
90impl From<DTPRSSEL_A> for u8 {
91 #[inline(always)]
92 fn from(variant: DTPRSSEL_A) -> Self {
93 variant as _
94 }
95}
96#[doc = "Field `DTPRSSEL` reader - DTI PRS Source Channel Select"]
97pub type DTPRSSEL_R = crate::FieldReader<u8, DTPRSSEL_A>;
98impl DTPRSSEL_R {
99 #[doc = "Get enumerated values variant"]
100 #[inline(always)]
101 pub fn variant(&self) -> DTPRSSEL_A {
102 match self.bits {
103 0 => DTPRSSEL_A::PRSCH0,
104 1 => DTPRSSEL_A::PRSCH1,
105 2 => DTPRSSEL_A::PRSCH2,
106 3 => DTPRSSEL_A::PRSCH3,
107 4 => DTPRSSEL_A::PRSCH4,
108 5 => DTPRSSEL_A::PRSCH5,
109 6 => DTPRSSEL_A::PRSCH6,
110 7 => DTPRSSEL_A::PRSCH7,
111 8 => DTPRSSEL_A::PRSCH8,
112 9 => DTPRSSEL_A::PRSCH9,
113 10 => DTPRSSEL_A::PRSCH10,
114 11 => DTPRSSEL_A::PRSCH11,
115 12 => DTPRSSEL_A::PRSCH12,
116 13 => DTPRSSEL_A::PRSCH13,
117 14 => DTPRSSEL_A::PRSCH14,
118 15 => DTPRSSEL_A::PRSCH15,
119 _ => unreachable!(),
120 }
121 }
122 #[doc = "Checks if the value of the field is `PRSCH0`"]
123 #[inline(always)]
124 pub fn is_prsch0(&self) -> bool {
125 *self == DTPRSSEL_A::PRSCH0
126 }
127 #[doc = "Checks if the value of the field is `PRSCH1`"]
128 #[inline(always)]
129 pub fn is_prsch1(&self) -> bool {
130 *self == DTPRSSEL_A::PRSCH1
131 }
132 #[doc = "Checks if the value of the field is `PRSCH2`"]
133 #[inline(always)]
134 pub fn is_prsch2(&self) -> bool {
135 *self == DTPRSSEL_A::PRSCH2
136 }
137 #[doc = "Checks if the value of the field is `PRSCH3`"]
138 #[inline(always)]
139 pub fn is_prsch3(&self) -> bool {
140 *self == DTPRSSEL_A::PRSCH3
141 }
142 #[doc = "Checks if the value of the field is `PRSCH4`"]
143 #[inline(always)]
144 pub fn is_prsch4(&self) -> bool {
145 *self == DTPRSSEL_A::PRSCH4
146 }
147 #[doc = "Checks if the value of the field is `PRSCH5`"]
148 #[inline(always)]
149 pub fn is_prsch5(&self) -> bool {
150 *self == DTPRSSEL_A::PRSCH5
151 }
152 #[doc = "Checks if the value of the field is `PRSCH6`"]
153 #[inline(always)]
154 pub fn is_prsch6(&self) -> bool {
155 *self == DTPRSSEL_A::PRSCH6
156 }
157 #[doc = "Checks if the value of the field is `PRSCH7`"]
158 #[inline(always)]
159 pub fn is_prsch7(&self) -> bool {
160 *self == DTPRSSEL_A::PRSCH7
161 }
162 #[doc = "Checks if the value of the field is `PRSCH8`"]
163 #[inline(always)]
164 pub fn is_prsch8(&self) -> bool {
165 *self == DTPRSSEL_A::PRSCH8
166 }
167 #[doc = "Checks if the value of the field is `PRSCH9`"]
168 #[inline(always)]
169 pub fn is_prsch9(&self) -> bool {
170 *self == DTPRSSEL_A::PRSCH9
171 }
172 #[doc = "Checks if the value of the field is `PRSCH10`"]
173 #[inline(always)]
174 pub fn is_prsch10(&self) -> bool {
175 *self == DTPRSSEL_A::PRSCH10
176 }
177 #[doc = "Checks if the value of the field is `PRSCH11`"]
178 #[inline(always)]
179 pub fn is_prsch11(&self) -> bool {
180 *self == DTPRSSEL_A::PRSCH11
181 }
182 #[doc = "Checks if the value of the field is `PRSCH12`"]
183 #[inline(always)]
184 pub fn is_prsch12(&self) -> bool {
185 *self == DTPRSSEL_A::PRSCH12
186 }
187 #[doc = "Checks if the value of the field is `PRSCH13`"]
188 #[inline(always)]
189 pub fn is_prsch13(&self) -> bool {
190 *self == DTPRSSEL_A::PRSCH13
191 }
192 #[doc = "Checks if the value of the field is `PRSCH14`"]
193 #[inline(always)]
194 pub fn is_prsch14(&self) -> bool {
195 *self == DTPRSSEL_A::PRSCH14
196 }
197 #[doc = "Checks if the value of the field is `PRSCH15`"]
198 #[inline(always)]
199 pub fn is_prsch15(&self) -> bool {
200 *self == DTPRSSEL_A::PRSCH15
201 }
202}
203#[doc = "Field `DTPRSSEL` writer - DTI PRS Source Channel Select"]
204pub type DTPRSSEL_W<'a> = crate::FieldWriterSafe<'a, u32, DTCTRL_SPEC, u8, DTPRSSEL_A, 4, 4>;
205impl<'a> DTPRSSEL_W<'a> {
206 #[doc = "PRS Channel 0 selected as input"]
207 #[inline(always)]
208 pub fn prsch0(self) -> &'a mut W {
209 self.variant(DTPRSSEL_A::PRSCH0)
210 }
211 #[doc = "PRS Channel 1 selected as input"]
212 #[inline(always)]
213 pub fn prsch1(self) -> &'a mut W {
214 self.variant(DTPRSSEL_A::PRSCH1)
215 }
216 #[doc = "PRS Channel 2 selected as input"]
217 #[inline(always)]
218 pub fn prsch2(self) -> &'a mut W {
219 self.variant(DTPRSSEL_A::PRSCH2)
220 }
221 #[doc = "PRS Channel 3 selected as input"]
222 #[inline(always)]
223 pub fn prsch3(self) -> &'a mut W {
224 self.variant(DTPRSSEL_A::PRSCH3)
225 }
226 #[doc = "PRS Channel 4 selected as input"]
227 #[inline(always)]
228 pub fn prsch4(self) -> &'a mut W {
229 self.variant(DTPRSSEL_A::PRSCH4)
230 }
231 #[doc = "PRS Channel 5 selected as input"]
232 #[inline(always)]
233 pub fn prsch5(self) -> &'a mut W {
234 self.variant(DTPRSSEL_A::PRSCH5)
235 }
236 #[doc = "PRS Channel 6 selected as input"]
237 #[inline(always)]
238 pub fn prsch6(self) -> &'a mut W {
239 self.variant(DTPRSSEL_A::PRSCH6)
240 }
241 #[doc = "PRS Channel 7 selected as input"]
242 #[inline(always)]
243 pub fn prsch7(self) -> &'a mut W {
244 self.variant(DTPRSSEL_A::PRSCH7)
245 }
246 #[doc = "PRS Channel 8 selected as input"]
247 #[inline(always)]
248 pub fn prsch8(self) -> &'a mut W {
249 self.variant(DTPRSSEL_A::PRSCH8)
250 }
251 #[doc = "PRS Channel 9 selected as input"]
252 #[inline(always)]
253 pub fn prsch9(self) -> &'a mut W {
254 self.variant(DTPRSSEL_A::PRSCH9)
255 }
256 #[doc = "PRS Channel 10 selected as input"]
257 #[inline(always)]
258 pub fn prsch10(self) -> &'a mut W {
259 self.variant(DTPRSSEL_A::PRSCH10)
260 }
261 #[doc = "PRS Channel 11 selected as input"]
262 #[inline(always)]
263 pub fn prsch11(self) -> &'a mut W {
264 self.variant(DTPRSSEL_A::PRSCH11)
265 }
266 #[doc = "PRS Channel 12 selected as input"]
267 #[inline(always)]
268 pub fn prsch12(self) -> &'a mut W {
269 self.variant(DTPRSSEL_A::PRSCH12)
270 }
271 #[doc = "PRS Channel 13 selected as input"]
272 #[inline(always)]
273 pub fn prsch13(self) -> &'a mut W {
274 self.variant(DTPRSSEL_A::PRSCH13)
275 }
276 #[doc = "PRS Channel 14 selected as input"]
277 #[inline(always)]
278 pub fn prsch14(self) -> &'a mut W {
279 self.variant(DTPRSSEL_A::PRSCH14)
280 }
281 #[doc = "PRS Channel 15 selected as input"]
282 #[inline(always)]
283 pub fn prsch15(self) -> &'a mut W {
284 self.variant(DTPRSSEL_A::PRSCH15)
285 }
286}
287#[doc = "Field `DTAR` reader - DTI Always Run"]
288pub type DTAR_R = crate::BitReader<bool>;
289#[doc = "Field `DTAR` writer - DTI Always Run"]
290pub type DTAR_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 9>;
291#[doc = "Field `DTFATS` reader - DTI Fault Action on Timer Stop"]
292pub type DTFATS_R = crate::BitReader<bool>;
293#[doc = "Field `DTFATS` writer - DTI Fault Action on Timer Stop"]
294pub type DTFATS_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 10>;
295#[doc = "Field `DTPRSEN` reader - DTI PRS Source Enable"]
296pub type DTPRSEN_R = crate::BitReader<bool>;
297#[doc = "Field `DTPRSEN` writer - DTI PRS Source Enable"]
298pub type DTPRSEN_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 24>;
299impl R {
300 #[doc = "Bit 0 - DTI Enable"]
301 #[inline(always)]
302 pub fn dten(&self) -> DTEN_R {
303 DTEN_R::new((self.bits & 1) != 0)
304 }
305 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
306 #[inline(always)]
307 pub fn dtdas(&self) -> DTDAS_R {
308 DTDAS_R::new(((self.bits >> 1) & 1) != 0)
309 }
310 #[doc = "Bit 2 - DTI Inactive Polarity"]
311 #[inline(always)]
312 pub fn dtipol(&self) -> DTIPOL_R {
313 DTIPOL_R::new(((self.bits >> 2) & 1) != 0)
314 }
315 #[doc = "Bit 3 - DTI Complementary Output Invert"]
316 #[inline(always)]
317 pub fn dtcinv(&self) -> DTCINV_R {
318 DTCINV_R::new(((self.bits >> 3) & 1) != 0)
319 }
320 #[doc = "Bits 4:7 - DTI PRS Source Channel Select"]
321 #[inline(always)]
322 pub fn dtprssel(&self) -> DTPRSSEL_R {
323 DTPRSSEL_R::new(((self.bits >> 4) & 0x0f) as u8)
324 }
325 #[doc = "Bit 9 - DTI Always Run"]
326 #[inline(always)]
327 pub fn dtar(&self) -> DTAR_R {
328 DTAR_R::new(((self.bits >> 9) & 1) != 0)
329 }
330 #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
331 #[inline(always)]
332 pub fn dtfats(&self) -> DTFATS_R {
333 DTFATS_R::new(((self.bits >> 10) & 1) != 0)
334 }
335 #[doc = "Bit 24 - DTI PRS Source Enable"]
336 #[inline(always)]
337 pub fn dtprsen(&self) -> DTPRSEN_R {
338 DTPRSEN_R::new(((self.bits >> 24) & 1) != 0)
339 }
340}
341impl W {
342 #[doc = "Bit 0 - DTI Enable"]
343 #[inline(always)]
344 pub fn dten(&mut self) -> DTEN_W {
345 DTEN_W::new(self)
346 }
347 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
348 #[inline(always)]
349 pub fn dtdas(&mut self) -> DTDAS_W {
350 DTDAS_W::new(self)
351 }
352 #[doc = "Bit 2 - DTI Inactive Polarity"]
353 #[inline(always)]
354 pub fn dtipol(&mut self) -> DTIPOL_W {
355 DTIPOL_W::new(self)
356 }
357 #[doc = "Bit 3 - DTI Complementary Output Invert"]
358 #[inline(always)]
359 pub fn dtcinv(&mut self) -> DTCINV_W {
360 DTCINV_W::new(self)
361 }
362 #[doc = "Bits 4:7 - DTI PRS Source Channel Select"]
363 #[inline(always)]
364 pub fn dtprssel(&mut self) -> DTPRSSEL_W {
365 DTPRSSEL_W::new(self)
366 }
367 #[doc = "Bit 9 - DTI Always Run"]
368 #[inline(always)]
369 pub fn dtar(&mut self) -> DTAR_W {
370 DTAR_W::new(self)
371 }
372 #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
373 #[inline(always)]
374 pub fn dtfats(&mut self) -> DTFATS_W {
375 DTFATS_W::new(self)
376 }
377 #[doc = "Bit 24 - DTI PRS Source Enable"]
378 #[inline(always)]
379 pub fn dtprsen(&mut self) -> DTPRSEN_W {
380 DTPRSEN_W::new(self)
381 }
382 #[doc = "Writes raw bits to the register."]
383 #[inline(always)]
384 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
385 self.0.bits(bits);
386 self
387 }
388}
389#[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"]
390pub struct DTCTRL_SPEC;
391impl crate::RegisterSpec for DTCTRL_SPEC {
392 type Ux = u32;
393}
394#[doc = "`read()` method returns [dtctrl::R](R) reader structure"]
395impl crate::Readable for DTCTRL_SPEC {
396 type Reader = R;
397}
398#[doc = "`write(|w| ..)` method takes [dtctrl::W](W) writer structure"]
399impl crate::Writable for DTCTRL_SPEC {
400 type Writer = W;
401}
402#[doc = "`reset()` method sets DTCTRL to value 0"]
403impl crate::Resettable for DTCTRL_SPEC {
404 #[inline(always)]
405 fn reset_value() -> Self::Ux {
406 0
407 }
408}