efm32g230_pac/timer1/
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 `DTPRSEN` reader - DTI PRS Source Enable"]
184pub type DTPRSEN_R = crate::BitReader<bool>;
185#[doc = "Field `DTPRSEN` writer - DTI PRS Source Enable"]
186pub type DTPRSEN_W<'a> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, 24>;
187impl R {
188 #[doc = "Bit 0 - DTI Enable"]
189 #[inline(always)]
190 pub fn dten(&self) -> DTEN_R {
191 DTEN_R::new((self.bits & 1) != 0)
192 }
193 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
194 #[inline(always)]
195 pub fn dtdas(&self) -> DTDAS_R {
196 DTDAS_R::new(((self.bits >> 1) & 1) != 0)
197 }
198 #[doc = "Bit 2 - DTI Inactive Polarity"]
199 #[inline(always)]
200 pub fn dtipol(&self) -> DTIPOL_R {
201 DTIPOL_R::new(((self.bits >> 2) & 1) != 0)
202 }
203 #[doc = "Bit 3 - DTI Complementary Output Invert."]
204 #[inline(always)]
205 pub fn dtcinv(&self) -> DTCINV_R {
206 DTCINV_R::new(((self.bits >> 3) & 1) != 0)
207 }
208 #[doc = "Bits 4:6 - DTI PRS Source Channel Select"]
209 #[inline(always)]
210 pub fn dtprssel(&self) -> DTPRSSEL_R {
211 DTPRSSEL_R::new(((self.bits >> 4) & 7) as u8)
212 }
213 #[doc = "Bit 24 - DTI PRS Source Enable"]
214 #[inline(always)]
215 pub fn dtprsen(&self) -> DTPRSEN_R {
216 DTPRSEN_R::new(((self.bits >> 24) & 1) != 0)
217 }
218}
219impl W {
220 #[doc = "Bit 0 - DTI Enable"]
221 #[inline(always)]
222 pub fn dten(&mut self) -> DTEN_W {
223 DTEN_W::new(self)
224 }
225 #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
226 #[inline(always)]
227 pub fn dtdas(&mut self) -> DTDAS_W {
228 DTDAS_W::new(self)
229 }
230 #[doc = "Bit 2 - DTI Inactive Polarity"]
231 #[inline(always)]
232 pub fn dtipol(&mut self) -> DTIPOL_W {
233 DTIPOL_W::new(self)
234 }
235 #[doc = "Bit 3 - DTI Complementary Output Invert."]
236 #[inline(always)]
237 pub fn dtcinv(&mut self) -> DTCINV_W {
238 DTCINV_W::new(self)
239 }
240 #[doc = "Bits 4:6 - DTI PRS Source Channel Select"]
241 #[inline(always)]
242 pub fn dtprssel(&mut self) -> DTPRSSEL_W {
243 DTPRSSEL_W::new(self)
244 }
245 #[doc = "Bit 24 - DTI PRS Source Enable"]
246 #[inline(always)]
247 pub fn dtprsen(&mut self) -> DTPRSEN_W {
248 DTPRSEN_W::new(self)
249 }
250 #[doc = "Writes raw bits to the register."]
251 #[inline(always)]
252 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
253 self.0.bits(bits);
254 self
255 }
256}
257#[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"]
258pub struct DTCTRL_SPEC;
259impl crate::RegisterSpec for DTCTRL_SPEC {
260 type Ux = u32;
261}
262#[doc = "`read()` method returns [dtctrl::R](R) reader structure"]
263impl crate::Readable for DTCTRL_SPEC {
264 type Reader = R;
265}
266#[doc = "`write(|w| ..)` method takes [dtctrl::W](W) writer structure"]
267impl crate::Writable for DTCTRL_SPEC {
268 type Writer = W;
269}
270#[doc = "`reset()` method sets DTCTRL to value 0"]
271impl crate::Resettable for DTCTRL_SPEC {
272 #[inline(always)]
273 fn reset_value() -> Self::Ux {
274 0
275 }
276}