efm32wg230_pac/timer2/
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}
82impl From<DTPRSSEL_A> for u8 {
83 #[inline(always)]
84 fn from(variant: DTPRSSEL_A) -> Self {
85 variant as _
86 }
87}
88#[doc = "Field `DTPRSSEL` reader - DTI PRS Source Channel Select"]
89pub type DTPRSSEL_R = crate::FieldReader<u8, DTPRSSEL_A>;
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> = crate::FieldWriter<'a, u32, DTCTRL_SPEC, u8, DTPRSSEL_A, 4, 4>;
173impl<'a> DTPRSSEL_W<'a> {
174 #[doc = "PRS Channel 0 selected as input"]
175 #[inline(always)]
176 pub fn prsch0(self) -> &'a mut W {
177 self.variant(DTPRSSEL_A::PRSCH0)
178 }
179 #[doc = "PRS Channel 1 selected as input"]
180 #[inline(always)]
181 pub fn prsch1(self) -> &'a mut W {
182 self.variant(DTPRSSEL_A::PRSCH1)
183 }
184 #[doc = "PRS Channel 2 selected as input"]
185 #[inline(always)]
186 pub fn prsch2(self) -> &'a mut W {
187 self.variant(DTPRSSEL_A::PRSCH2)
188 }
189 #[doc = "PRS Channel 3 selected as input"]
190 #[inline(always)]
191 pub fn prsch3(self) -> &'a mut W {
192 self.variant(DTPRSSEL_A::PRSCH3)
193 }
194 #[doc = "PRS Channel 4 selected as input"]
195 #[inline(always)]
196 pub fn prsch4(self) -> &'a mut W {
197 self.variant(DTPRSSEL_A::PRSCH4)
198 }
199 #[doc = "PRS Channel 5 selected as input"]
200 #[inline(always)]
201 pub fn prsch5(self) -> &'a mut W {
202 self.variant(DTPRSSEL_A::PRSCH5)
203 }
204 #[doc = "PRS Channel 6 selected as input"]
205 #[inline(always)]
206 pub fn prsch6(self) -> &'a mut W {
207 self.variant(DTPRSSEL_A::PRSCH6)
208 }
209 #[doc = "PRS Channel 7 selected as input"]
210 #[inline(always)]
211 pub fn prsch7(self) -> &'a mut W {
212 self.variant(DTPRSSEL_A::PRSCH7)
213 }
214 #[doc = "PRS Channel 8 selected as input"]
215 #[inline(always)]
216 pub fn prsch8(self) -> &'a mut W {
217 self.variant(DTPRSSEL_A::PRSCH8)
218 }
219 #[doc = "PRS Channel 9 selected as input"]
220 #[inline(always)]
221 pub fn prsch9(self) -> &'a mut W {
222 self.variant(DTPRSSEL_A::PRSCH9)
223 }
224 #[doc = "PRS Channel 10 selected as input"]
225 #[inline(always)]
226 pub fn prsch10(self) -> &'a mut W {
227 self.variant(DTPRSSEL_A::PRSCH10)
228 }
229 #[doc = "PRS Channel 11 selected as input"]
230 #[inline(always)]
231 pub fn prsch11(self) -> &'a mut W {
232 self.variant(DTPRSSEL_A::PRSCH11)
233 }
234}
235#[doc = "Field `DTPRSEN` reader - DTI PRS Source Enable"]
236pub type DTPRSEN_R = crate::BitReader<bool>;
237#[doc = "Field `DTPRSEN` writer - DTI PRS Source Enable"]
238pub type DTPRSEN_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 24>;
239impl R {
240 #[doc = "Bit 0 - DTI Enable"]
241 #[inline(always)]
242 pub fn dten(&self) -> DTEN_R {
243 DTEN_R::new((self.bits & 1) != 0)
244 }
245 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
246 #[inline(always)]
247 pub fn dtdas(&self) -> DTDAS_R {
248 DTDAS_R::new(((self.bits >> 1) & 1) != 0)
249 }
250 #[doc = "Bit 2 - DTI Inactive Polarity"]
251 #[inline(always)]
252 pub fn dtipol(&self) -> DTIPOL_R {
253 DTIPOL_R::new(((self.bits >> 2) & 1) != 0)
254 }
255 #[doc = "Bit 3 - DTI Complementary Output Invert."]
256 #[inline(always)]
257 pub fn dtcinv(&self) -> DTCINV_R {
258 DTCINV_R::new(((self.bits >> 3) & 1) != 0)
259 }
260 #[doc = "Bits 4:7 - DTI PRS Source Channel Select"]
261 #[inline(always)]
262 pub fn dtprssel(&self) -> DTPRSSEL_R {
263 DTPRSSEL_R::new(((self.bits >> 4) & 0x0f) as u8)
264 }
265 #[doc = "Bit 24 - DTI PRS Source Enable"]
266 #[inline(always)]
267 pub fn dtprsen(&self) -> DTPRSEN_R {
268 DTPRSEN_R::new(((self.bits >> 24) & 1) != 0)
269 }
270}
271impl W {
272 #[doc = "Bit 0 - DTI Enable"]
273 #[inline(always)]
274 pub fn dten(&mut self) -> DTEN_W {
275 DTEN_W::new(self)
276 }
277 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
278 #[inline(always)]
279 pub fn dtdas(&mut self) -> DTDAS_W {
280 DTDAS_W::new(self)
281 }
282 #[doc = "Bit 2 - DTI Inactive Polarity"]
283 #[inline(always)]
284 pub fn dtipol(&mut self) -> DTIPOL_W {
285 DTIPOL_W::new(self)
286 }
287 #[doc = "Bit 3 - DTI Complementary Output Invert."]
288 #[inline(always)]
289 pub fn dtcinv(&mut self) -> DTCINV_W {
290 DTCINV_W::new(self)
291 }
292 #[doc = "Bits 4:7 - DTI PRS Source Channel Select"]
293 #[inline(always)]
294 pub fn dtprssel(&mut self) -> DTPRSSEL_W {
295 DTPRSSEL_W::new(self)
296 }
297 #[doc = "Bit 24 - DTI PRS Source Enable"]
298 #[inline(always)]
299 pub fn dtprsen(&mut self) -> DTPRSEN_W {
300 DTPRSEN_W::new(self)
301 }
302 #[doc = "Writes raw bits to the register."]
303 #[inline(always)]
304 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
305 self.0.bits(bits);
306 self
307 }
308}
309#[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"]
310pub struct DTCTRL_SPEC;
311impl crate::RegisterSpec for DTCTRL_SPEC {
312 type Ux = u32;
313}
314#[doc = "`read()` method returns [dtctrl::R](R) reader structure"]
315impl crate::Readable for DTCTRL_SPEC {
316 type Reader = R;
317}
318#[doc = "`write(|w| ..)` method takes [dtctrl::W](W) writer structure"]
319impl crate::Writable for DTCTRL_SPEC {
320 type Writer = W;
321}
322#[doc = "`reset()` method sets DTCTRL to value 0"]
323impl crate::Resettable for DTCTRL_SPEC {
324 #[inline(always)]
325 fn reset_value() -> Self::Ux {
326 0
327 }
328}