efm32tg11b520_pac/timer0/
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}
74impl From<DTPRSSEL_A> for u8 {
75 #[inline(always)]
76 fn from(variant: DTPRSSEL_A) -> Self {
77 variant as _
78 }
79}
80#[doc = "Field `DTPRSSEL` reader - DTI PRS Source Channel Select"]
81pub type DTPRSSEL_R = crate::FieldReader<u8, DTPRSSEL_A>;
82impl DTPRSSEL_R {
83 #[doc = "Get enumerated values variant"]
84 #[inline(always)]
85 pub fn variant(&self) -> DTPRSSEL_A {
86 match self.bits {
87 0 => DTPRSSEL_A::PRSCH0,
88 1 => DTPRSSEL_A::PRSCH1,
89 2 => DTPRSSEL_A::PRSCH2,
90 3 => DTPRSSEL_A::PRSCH3,
91 4 => DTPRSSEL_A::PRSCH4,
92 5 => DTPRSSEL_A::PRSCH5,
93 6 => DTPRSSEL_A::PRSCH6,
94 7 => DTPRSSEL_A::PRSCH7,
95 _ => unreachable!(),
96 }
97 }
98 #[doc = "Checks if the value of the field is `PRSCH0`"]
99 #[inline(always)]
100 pub fn is_prsch0(&self) -> bool {
101 *self == DTPRSSEL_A::PRSCH0
102 }
103 #[doc = "Checks if the value of the field is `PRSCH1`"]
104 #[inline(always)]
105 pub fn is_prsch1(&self) -> bool {
106 *self == DTPRSSEL_A::PRSCH1
107 }
108 #[doc = "Checks if the value of the field is `PRSCH2`"]
109 #[inline(always)]
110 pub fn is_prsch2(&self) -> bool {
111 *self == DTPRSSEL_A::PRSCH2
112 }
113 #[doc = "Checks if the value of the field is `PRSCH3`"]
114 #[inline(always)]
115 pub fn is_prsch3(&self) -> bool {
116 *self == DTPRSSEL_A::PRSCH3
117 }
118 #[doc = "Checks if the value of the field is `PRSCH4`"]
119 #[inline(always)]
120 pub fn is_prsch4(&self) -> bool {
121 *self == DTPRSSEL_A::PRSCH4
122 }
123 #[doc = "Checks if the value of the field is `PRSCH5`"]
124 #[inline(always)]
125 pub fn is_prsch5(&self) -> bool {
126 *self == DTPRSSEL_A::PRSCH5
127 }
128 #[doc = "Checks if the value of the field is `PRSCH6`"]
129 #[inline(always)]
130 pub fn is_prsch6(&self) -> bool {
131 *self == DTPRSSEL_A::PRSCH6
132 }
133 #[doc = "Checks if the value of the field is `PRSCH7`"]
134 #[inline(always)]
135 pub fn is_prsch7(&self) -> bool {
136 *self == DTPRSSEL_A::PRSCH7
137 }
138}
139#[doc = "Field `DTPRSSEL` writer - DTI PRS Source Channel Select"]
140pub type DTPRSSEL_W<'a> = crate::FieldWriterSafe<'a, u32, DTCTRL_SPEC, u8, DTPRSSEL_A, 3, 4>;
141impl<'a> DTPRSSEL_W<'a> {
142 #[doc = "PRS Channel 0 selected as input"]
143 #[inline(always)]
144 pub fn prsch0(self) -> &'a mut W {
145 self.variant(DTPRSSEL_A::PRSCH0)
146 }
147 #[doc = "PRS Channel 1 selected as input"]
148 #[inline(always)]
149 pub fn prsch1(self) -> &'a mut W {
150 self.variant(DTPRSSEL_A::PRSCH1)
151 }
152 #[doc = "PRS Channel 2 selected as input"]
153 #[inline(always)]
154 pub fn prsch2(self) -> &'a mut W {
155 self.variant(DTPRSSEL_A::PRSCH2)
156 }
157 #[doc = "PRS Channel 3 selected as input"]
158 #[inline(always)]
159 pub fn prsch3(self) -> &'a mut W {
160 self.variant(DTPRSSEL_A::PRSCH3)
161 }
162 #[doc = "PRS Channel 4 selected as input"]
163 #[inline(always)]
164 pub fn prsch4(self) -> &'a mut W {
165 self.variant(DTPRSSEL_A::PRSCH4)
166 }
167 #[doc = "PRS Channel 5 selected as input"]
168 #[inline(always)]
169 pub fn prsch5(self) -> &'a mut W {
170 self.variant(DTPRSSEL_A::PRSCH5)
171 }
172 #[doc = "PRS Channel 6 selected as input"]
173 #[inline(always)]
174 pub fn prsch6(self) -> &'a mut W {
175 self.variant(DTPRSSEL_A::PRSCH6)
176 }
177 #[doc = "PRS Channel 7 selected as input"]
178 #[inline(always)]
179 pub fn prsch7(self) -> &'a mut W {
180 self.variant(DTPRSSEL_A::PRSCH7)
181 }
182}
183#[doc = "Field `DTAR` reader - DTI Always Run"]
184pub type DTAR_R = crate::BitReader<bool>;
185#[doc = "Field `DTAR` writer - DTI Always Run"]
186pub type DTAR_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 9>;
187#[doc = "Field `DTFATS` reader - DTI Fault Action on Timer Stop"]
188pub type DTFATS_R = crate::BitReader<bool>;
189#[doc = "Field `DTFATS` writer - DTI Fault Action on Timer Stop"]
190pub type DTFATS_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 10>;
191#[doc = "Field `DTPRSEN` reader - DTI PRS Source Enable"]
192pub type DTPRSEN_R = crate::BitReader<bool>;
193#[doc = "Field `DTPRSEN` writer - DTI PRS Source Enable"]
194pub type DTPRSEN_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 24>;
195impl R {
196 #[doc = "Bit 0 - DTI Enable"]
197 #[inline(always)]
198 pub fn dten(&self) -> DTEN_R {
199 DTEN_R::new((self.bits & 1) != 0)
200 }
201 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
202 #[inline(always)]
203 pub fn dtdas(&self) -> DTDAS_R {
204 DTDAS_R::new(((self.bits >> 1) & 1) != 0)
205 }
206 #[doc = "Bit 2 - DTI Inactive Polarity"]
207 #[inline(always)]
208 pub fn dtipol(&self) -> DTIPOL_R {
209 DTIPOL_R::new(((self.bits >> 2) & 1) != 0)
210 }
211 #[doc = "Bit 3 - DTI Complementary Output Invert"]
212 #[inline(always)]
213 pub fn dtcinv(&self) -> DTCINV_R {
214 DTCINV_R::new(((self.bits >> 3) & 1) != 0)
215 }
216 #[doc = "Bits 4:6 - DTI PRS Source Channel Select"]
217 #[inline(always)]
218 pub fn dtprssel(&self) -> DTPRSSEL_R {
219 DTPRSSEL_R::new(((self.bits >> 4) & 7) as u8)
220 }
221 #[doc = "Bit 9 - DTI Always Run"]
222 #[inline(always)]
223 pub fn dtar(&self) -> DTAR_R {
224 DTAR_R::new(((self.bits >> 9) & 1) != 0)
225 }
226 #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
227 #[inline(always)]
228 pub fn dtfats(&self) -> DTFATS_R {
229 DTFATS_R::new(((self.bits >> 10) & 1) != 0)
230 }
231 #[doc = "Bit 24 - DTI PRS Source Enable"]
232 #[inline(always)]
233 pub fn dtprsen(&self) -> DTPRSEN_R {
234 DTPRSEN_R::new(((self.bits >> 24) & 1) != 0)
235 }
236}
237impl W {
238 #[doc = "Bit 0 - DTI Enable"]
239 #[inline(always)]
240 pub fn dten(&mut self) -> DTEN_W {
241 DTEN_W::new(self)
242 }
243 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
244 #[inline(always)]
245 pub fn dtdas(&mut self) -> DTDAS_W {
246 DTDAS_W::new(self)
247 }
248 #[doc = "Bit 2 - DTI Inactive Polarity"]
249 #[inline(always)]
250 pub fn dtipol(&mut self) -> DTIPOL_W {
251 DTIPOL_W::new(self)
252 }
253 #[doc = "Bit 3 - DTI Complementary Output Invert"]
254 #[inline(always)]
255 pub fn dtcinv(&mut self) -> DTCINV_W {
256 DTCINV_W::new(self)
257 }
258 #[doc = "Bits 4:6 - DTI PRS Source Channel Select"]
259 #[inline(always)]
260 pub fn dtprssel(&mut self) -> DTPRSSEL_W {
261 DTPRSSEL_W::new(self)
262 }
263 #[doc = "Bit 9 - DTI Always Run"]
264 #[inline(always)]
265 pub fn dtar(&mut self) -> DTAR_W {
266 DTAR_W::new(self)
267 }
268 #[doc = "Bit 10 - DTI Fault Action on Timer Stop"]
269 #[inline(always)]
270 pub fn dtfats(&mut self) -> DTFATS_W {
271 DTFATS_W::new(self)
272 }
273 #[doc = "Bit 24 - DTI PRS Source Enable"]
274 #[inline(always)]
275 pub fn dtprsen(&mut self) -> DTPRSEN_W {
276 DTPRSEN_W::new(self)
277 }
278 #[doc = "Writes raw bits to the register."]
279 #[inline(always)]
280 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
281 self.0.bits(bits);
282 self
283 }
284}
285#[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"]
286pub struct DTCTRL_SPEC;
287impl crate::RegisterSpec for DTCTRL_SPEC {
288 type Ux = u32;
289}
290#[doc = "`read()` method returns [dtctrl::R](R) reader structure"]
291impl crate::Readable for DTCTRL_SPEC {
292 type Reader = R;
293}
294#[doc = "`write(|w| ..)` method takes [dtctrl::W](W) writer structure"]
295impl crate::Writable for DTCTRL_SPEC {
296 type Writer = W;
297}
298#[doc = "`reset()` method sets DTCTRL to value 0"]
299impl crate::Resettable for DTCTRL_SPEC {
300 #[inline(always)]
301 fn reset_value() -> Self::Ux {
302 0
303 }
304}