efm32gg_pac/efm32gg995/timer1/
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 `DTPRSEN` reader - DTI PRS Source Enable"]
237pub type DTPRSEN_R = crate::BitReader<bool>;
238#[doc = "Field `DTPRSEN` writer - DTI PRS Source Enable"]
239pub type DTPRSEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, DTCTRL_SPEC, bool, O>;
240impl R {
241    #[doc = "Bit 0 - DTI Enable"]
242    #[inline(always)]
243    pub fn dten(&self) -> DTEN_R {
244        DTEN_R::new((self.bits & 1) != 0)
245    }
246    #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
247    #[inline(always)]
248    pub fn dtdas(&self) -> DTDAS_R {
249        DTDAS_R::new(((self.bits >> 1) & 1) != 0)
250    }
251    #[doc = "Bit 2 - DTI Inactive Polarity"]
252    #[inline(always)]
253    pub fn dtipol(&self) -> DTIPOL_R {
254        DTIPOL_R::new(((self.bits >> 2) & 1) != 0)
255    }
256    #[doc = "Bit 3 - DTI Complementary Output Invert."]
257    #[inline(always)]
258    pub fn dtcinv(&self) -> DTCINV_R {
259        DTCINV_R::new(((self.bits >> 3) & 1) != 0)
260    }
261    #[doc = "Bits 4:7 - DTI PRS Source Channel Select"]
262    #[inline(always)]
263    pub fn dtprssel(&self) -> DTPRSSEL_R {
264        DTPRSSEL_R::new(((self.bits >> 4) & 0x0f) as u8)
265    }
266    #[doc = "Bit 24 - DTI PRS Source Enable"]
267    #[inline(always)]
268    pub fn dtprsen(&self) -> DTPRSEN_R {
269        DTPRSEN_R::new(((self.bits >> 24) & 1) != 0)
270    }
271}
272impl W {
273    #[doc = "Bit 0 - DTI Enable"]
274    #[inline(always)]
275    #[must_use]
276    pub fn dten(&mut self) -> DTEN_W<0> {
277        DTEN_W::new(self)
278    }
279    #[doc = "Bit 1 - DTI Automatic Start-up Functionality"]
280    #[inline(always)]
281    #[must_use]
282    pub fn dtdas(&mut self) -> DTDAS_W<1> {
283        DTDAS_W::new(self)
284    }
285    #[doc = "Bit 2 - DTI Inactive Polarity"]
286    #[inline(always)]
287    #[must_use]
288    pub fn dtipol(&mut self) -> DTIPOL_W<2> {
289        DTIPOL_W::new(self)
290    }
291    #[doc = "Bit 3 - DTI Complementary Output Invert."]
292    #[inline(always)]
293    #[must_use]
294    pub fn dtcinv(&mut self) -> DTCINV_W<3> {
295        DTCINV_W::new(self)
296    }
297    #[doc = "Bits 4:7 - DTI PRS Source Channel Select"]
298    #[inline(always)]
299    #[must_use]
300    pub fn dtprssel(&mut self) -> DTPRSSEL_W<4> {
301        DTPRSSEL_W::new(self)
302    }
303    #[doc = "Bit 24 - DTI PRS Source Enable"]
304    #[inline(always)]
305    #[must_use]
306    pub fn dtprsen(&mut self) -> DTPRSEN_W<24> {
307        DTPRSEN_W::new(self)
308    }
309    #[doc = "Writes raw bits to the register."]
310    #[inline(always)]
311    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
312        self.0.bits(bits);
313        self
314    }
315}
316#[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"]
317pub struct DTCTRL_SPEC;
318impl crate::RegisterSpec for DTCTRL_SPEC {
319    type Ux = u32;
320}
321#[doc = "`read()` method returns [dtctrl::R](R) reader structure"]
322impl crate::Readable for DTCTRL_SPEC {
323    type Reader = R;
324}
325#[doc = "`write(|w| ..)` method takes [dtctrl::W](W) writer structure"]
326impl crate::Writable for DTCTRL_SPEC {
327    type Writer = W;
328    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
329    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
330}
331#[doc = "`reset()` method sets DTCTRL to value 0"]
332impl crate::Resettable for DTCTRL_SPEC {
333    const RESET_VALUE: Self::Ux = 0;
334}