efm32gg_pac/efm32gg995/pcnt2/
input.rs

1#[doc = "Register `INPUT` reader"]
2pub struct R(crate::R<INPUT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<INPUT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<INPUT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<INPUT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `INPUT` writer"]
17pub struct W(crate::W<INPUT_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<INPUT_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<INPUT_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<INPUT_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `S0PRSSEL` reader - S0IN PRS Channel Select"]
38pub type S0PRSSEL_R = crate::FieldReader<u8, S0PRSSEL_A>;
39#[doc = "S0IN PRS Channel Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum S0PRSSEL_A {
43    #[doc = "0: PRS Channel 0 selected."]
44    PRSCH0 = 0,
45    #[doc = "1: PRS Channel 1 selected."]
46    PRSCH1 = 1,
47    #[doc = "2: PRS Channel 2 selected."]
48    PRSCH2 = 2,
49    #[doc = "3: PRS Channel 3 selected."]
50    PRSCH3 = 3,
51    #[doc = "4: PRS Channel 4 selected."]
52    PRSCH4 = 4,
53    #[doc = "5: PRS Channel 5 selected."]
54    PRSCH5 = 5,
55    #[doc = "6: PRS Channel 6 selected."]
56    PRSCH6 = 6,
57    #[doc = "7: PRS Channel 7 selected."]
58    PRSCH7 = 7,
59    #[doc = "8: PRS Channel 8 selected."]
60    PRSCH8 = 8,
61    #[doc = "9: PRS Channel 9 selected."]
62    PRSCH9 = 9,
63    #[doc = "10: PRS Channel 10 selected."]
64    PRSCH10 = 10,
65    #[doc = "11: PRS Channel 11 selected."]
66    PRSCH11 = 11,
67}
68impl From<S0PRSSEL_A> for u8 {
69    #[inline(always)]
70    fn from(variant: S0PRSSEL_A) -> Self {
71        variant as _
72    }
73}
74impl S0PRSSEL_R {
75    #[doc = "Get enumerated values variant"]
76    #[inline(always)]
77    pub fn variant(&self) -> Option<S0PRSSEL_A> {
78        match self.bits {
79            0 => Some(S0PRSSEL_A::PRSCH0),
80            1 => Some(S0PRSSEL_A::PRSCH1),
81            2 => Some(S0PRSSEL_A::PRSCH2),
82            3 => Some(S0PRSSEL_A::PRSCH3),
83            4 => Some(S0PRSSEL_A::PRSCH4),
84            5 => Some(S0PRSSEL_A::PRSCH5),
85            6 => Some(S0PRSSEL_A::PRSCH6),
86            7 => Some(S0PRSSEL_A::PRSCH7),
87            8 => Some(S0PRSSEL_A::PRSCH8),
88            9 => Some(S0PRSSEL_A::PRSCH9),
89            10 => Some(S0PRSSEL_A::PRSCH10),
90            11 => Some(S0PRSSEL_A::PRSCH11),
91            _ => None,
92        }
93    }
94    #[doc = "Checks if the value of the field is `PRSCH0`"]
95    #[inline(always)]
96    pub fn is_prsch0(&self) -> bool {
97        *self == S0PRSSEL_A::PRSCH0
98    }
99    #[doc = "Checks if the value of the field is `PRSCH1`"]
100    #[inline(always)]
101    pub fn is_prsch1(&self) -> bool {
102        *self == S0PRSSEL_A::PRSCH1
103    }
104    #[doc = "Checks if the value of the field is `PRSCH2`"]
105    #[inline(always)]
106    pub fn is_prsch2(&self) -> bool {
107        *self == S0PRSSEL_A::PRSCH2
108    }
109    #[doc = "Checks if the value of the field is `PRSCH3`"]
110    #[inline(always)]
111    pub fn is_prsch3(&self) -> bool {
112        *self == S0PRSSEL_A::PRSCH3
113    }
114    #[doc = "Checks if the value of the field is `PRSCH4`"]
115    #[inline(always)]
116    pub fn is_prsch4(&self) -> bool {
117        *self == S0PRSSEL_A::PRSCH4
118    }
119    #[doc = "Checks if the value of the field is `PRSCH5`"]
120    #[inline(always)]
121    pub fn is_prsch5(&self) -> bool {
122        *self == S0PRSSEL_A::PRSCH5
123    }
124    #[doc = "Checks if the value of the field is `PRSCH6`"]
125    #[inline(always)]
126    pub fn is_prsch6(&self) -> bool {
127        *self == S0PRSSEL_A::PRSCH6
128    }
129    #[doc = "Checks if the value of the field is `PRSCH7`"]
130    #[inline(always)]
131    pub fn is_prsch7(&self) -> bool {
132        *self == S0PRSSEL_A::PRSCH7
133    }
134    #[doc = "Checks if the value of the field is `PRSCH8`"]
135    #[inline(always)]
136    pub fn is_prsch8(&self) -> bool {
137        *self == S0PRSSEL_A::PRSCH8
138    }
139    #[doc = "Checks if the value of the field is `PRSCH9`"]
140    #[inline(always)]
141    pub fn is_prsch9(&self) -> bool {
142        *self == S0PRSSEL_A::PRSCH9
143    }
144    #[doc = "Checks if the value of the field is `PRSCH10`"]
145    #[inline(always)]
146    pub fn is_prsch10(&self) -> bool {
147        *self == S0PRSSEL_A::PRSCH10
148    }
149    #[doc = "Checks if the value of the field is `PRSCH11`"]
150    #[inline(always)]
151    pub fn is_prsch11(&self) -> bool {
152        *self == S0PRSSEL_A::PRSCH11
153    }
154}
155#[doc = "Field `S0PRSSEL` writer - S0IN PRS Channel Select"]
156pub type S0PRSSEL_W<'a, const O: u8> =
157    crate::FieldWriter<'a, u32, INPUT_SPEC, u8, S0PRSSEL_A, 4, O>;
158impl<'a, const O: u8> S0PRSSEL_W<'a, O> {
159    #[doc = "PRS Channel 0 selected."]
160    #[inline(always)]
161    pub fn prsch0(self) -> &'a mut W {
162        self.variant(S0PRSSEL_A::PRSCH0)
163    }
164    #[doc = "PRS Channel 1 selected."]
165    #[inline(always)]
166    pub fn prsch1(self) -> &'a mut W {
167        self.variant(S0PRSSEL_A::PRSCH1)
168    }
169    #[doc = "PRS Channel 2 selected."]
170    #[inline(always)]
171    pub fn prsch2(self) -> &'a mut W {
172        self.variant(S0PRSSEL_A::PRSCH2)
173    }
174    #[doc = "PRS Channel 3 selected."]
175    #[inline(always)]
176    pub fn prsch3(self) -> &'a mut W {
177        self.variant(S0PRSSEL_A::PRSCH3)
178    }
179    #[doc = "PRS Channel 4 selected."]
180    #[inline(always)]
181    pub fn prsch4(self) -> &'a mut W {
182        self.variant(S0PRSSEL_A::PRSCH4)
183    }
184    #[doc = "PRS Channel 5 selected."]
185    #[inline(always)]
186    pub fn prsch5(self) -> &'a mut W {
187        self.variant(S0PRSSEL_A::PRSCH5)
188    }
189    #[doc = "PRS Channel 6 selected."]
190    #[inline(always)]
191    pub fn prsch6(self) -> &'a mut W {
192        self.variant(S0PRSSEL_A::PRSCH6)
193    }
194    #[doc = "PRS Channel 7 selected."]
195    #[inline(always)]
196    pub fn prsch7(self) -> &'a mut W {
197        self.variant(S0PRSSEL_A::PRSCH7)
198    }
199    #[doc = "PRS Channel 8 selected."]
200    #[inline(always)]
201    pub fn prsch8(self) -> &'a mut W {
202        self.variant(S0PRSSEL_A::PRSCH8)
203    }
204    #[doc = "PRS Channel 9 selected."]
205    #[inline(always)]
206    pub fn prsch9(self) -> &'a mut W {
207        self.variant(S0PRSSEL_A::PRSCH9)
208    }
209    #[doc = "PRS Channel 10 selected."]
210    #[inline(always)]
211    pub fn prsch10(self) -> &'a mut W {
212        self.variant(S0PRSSEL_A::PRSCH10)
213    }
214    #[doc = "PRS Channel 11 selected."]
215    #[inline(always)]
216    pub fn prsch11(self) -> &'a mut W {
217        self.variant(S0PRSSEL_A::PRSCH11)
218    }
219}
220#[doc = "Field `S0PRSEN` reader - S0IN PRS Enable"]
221pub type S0PRSEN_R = crate::BitReader<bool>;
222#[doc = "Field `S0PRSEN` writer - S0IN PRS Enable"]
223pub type S0PRSEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, INPUT_SPEC, bool, O>;
224#[doc = "Field `S1PRSSEL` reader - S1IN PRS Channel Select"]
225pub type S1PRSSEL_R = crate::FieldReader<u8, S1PRSSEL_A>;
226#[doc = "S1IN PRS Channel Select\n\nValue on reset: 0"]
227#[derive(Clone, Copy, Debug, PartialEq, Eq)]
228#[repr(u8)]
229pub enum S1PRSSEL_A {
230    #[doc = "0: PRS Channel 0 selected."]
231    PRSCH0 = 0,
232    #[doc = "1: PRS Channel 1 selected."]
233    PRSCH1 = 1,
234    #[doc = "2: PRS Channel 2 selected."]
235    PRSCH2 = 2,
236    #[doc = "3: PRS Channel 3 selected."]
237    PRSCH3 = 3,
238    #[doc = "4: PRS Channel 4 selected."]
239    PRSCH4 = 4,
240    #[doc = "5: PRS Channel 5 selected."]
241    PRSCH5 = 5,
242    #[doc = "6: PRS Channel 6 selected."]
243    PRSCH6 = 6,
244    #[doc = "7: PRS Channel 7 selected."]
245    PRSCH7 = 7,
246    #[doc = "8: PRS Channel 8 selected."]
247    PRSCH8 = 8,
248    #[doc = "9: PRS Channel 9 selected."]
249    PRSCH9 = 9,
250    #[doc = "10: PRS Channel 10 selected."]
251    PRSCH10 = 10,
252    #[doc = "11: PRS Channel 11 selected."]
253    PRSCH11 = 11,
254}
255impl From<S1PRSSEL_A> for u8 {
256    #[inline(always)]
257    fn from(variant: S1PRSSEL_A) -> Self {
258        variant as _
259    }
260}
261impl S1PRSSEL_R {
262    #[doc = "Get enumerated values variant"]
263    #[inline(always)]
264    pub fn variant(&self) -> Option<S1PRSSEL_A> {
265        match self.bits {
266            0 => Some(S1PRSSEL_A::PRSCH0),
267            1 => Some(S1PRSSEL_A::PRSCH1),
268            2 => Some(S1PRSSEL_A::PRSCH2),
269            3 => Some(S1PRSSEL_A::PRSCH3),
270            4 => Some(S1PRSSEL_A::PRSCH4),
271            5 => Some(S1PRSSEL_A::PRSCH5),
272            6 => Some(S1PRSSEL_A::PRSCH6),
273            7 => Some(S1PRSSEL_A::PRSCH7),
274            8 => Some(S1PRSSEL_A::PRSCH8),
275            9 => Some(S1PRSSEL_A::PRSCH9),
276            10 => Some(S1PRSSEL_A::PRSCH10),
277            11 => Some(S1PRSSEL_A::PRSCH11),
278            _ => None,
279        }
280    }
281    #[doc = "Checks if the value of the field is `PRSCH0`"]
282    #[inline(always)]
283    pub fn is_prsch0(&self) -> bool {
284        *self == S1PRSSEL_A::PRSCH0
285    }
286    #[doc = "Checks if the value of the field is `PRSCH1`"]
287    #[inline(always)]
288    pub fn is_prsch1(&self) -> bool {
289        *self == S1PRSSEL_A::PRSCH1
290    }
291    #[doc = "Checks if the value of the field is `PRSCH2`"]
292    #[inline(always)]
293    pub fn is_prsch2(&self) -> bool {
294        *self == S1PRSSEL_A::PRSCH2
295    }
296    #[doc = "Checks if the value of the field is `PRSCH3`"]
297    #[inline(always)]
298    pub fn is_prsch3(&self) -> bool {
299        *self == S1PRSSEL_A::PRSCH3
300    }
301    #[doc = "Checks if the value of the field is `PRSCH4`"]
302    #[inline(always)]
303    pub fn is_prsch4(&self) -> bool {
304        *self == S1PRSSEL_A::PRSCH4
305    }
306    #[doc = "Checks if the value of the field is `PRSCH5`"]
307    #[inline(always)]
308    pub fn is_prsch5(&self) -> bool {
309        *self == S1PRSSEL_A::PRSCH5
310    }
311    #[doc = "Checks if the value of the field is `PRSCH6`"]
312    #[inline(always)]
313    pub fn is_prsch6(&self) -> bool {
314        *self == S1PRSSEL_A::PRSCH6
315    }
316    #[doc = "Checks if the value of the field is `PRSCH7`"]
317    #[inline(always)]
318    pub fn is_prsch7(&self) -> bool {
319        *self == S1PRSSEL_A::PRSCH7
320    }
321    #[doc = "Checks if the value of the field is `PRSCH8`"]
322    #[inline(always)]
323    pub fn is_prsch8(&self) -> bool {
324        *self == S1PRSSEL_A::PRSCH8
325    }
326    #[doc = "Checks if the value of the field is `PRSCH9`"]
327    #[inline(always)]
328    pub fn is_prsch9(&self) -> bool {
329        *self == S1PRSSEL_A::PRSCH9
330    }
331    #[doc = "Checks if the value of the field is `PRSCH10`"]
332    #[inline(always)]
333    pub fn is_prsch10(&self) -> bool {
334        *self == S1PRSSEL_A::PRSCH10
335    }
336    #[doc = "Checks if the value of the field is `PRSCH11`"]
337    #[inline(always)]
338    pub fn is_prsch11(&self) -> bool {
339        *self == S1PRSSEL_A::PRSCH11
340    }
341}
342#[doc = "Field `S1PRSSEL` writer - S1IN PRS Channel Select"]
343pub type S1PRSSEL_W<'a, const O: u8> =
344    crate::FieldWriter<'a, u32, INPUT_SPEC, u8, S1PRSSEL_A, 4, O>;
345impl<'a, const O: u8> S1PRSSEL_W<'a, O> {
346    #[doc = "PRS Channel 0 selected."]
347    #[inline(always)]
348    pub fn prsch0(self) -> &'a mut W {
349        self.variant(S1PRSSEL_A::PRSCH0)
350    }
351    #[doc = "PRS Channel 1 selected."]
352    #[inline(always)]
353    pub fn prsch1(self) -> &'a mut W {
354        self.variant(S1PRSSEL_A::PRSCH1)
355    }
356    #[doc = "PRS Channel 2 selected."]
357    #[inline(always)]
358    pub fn prsch2(self) -> &'a mut W {
359        self.variant(S1PRSSEL_A::PRSCH2)
360    }
361    #[doc = "PRS Channel 3 selected."]
362    #[inline(always)]
363    pub fn prsch3(self) -> &'a mut W {
364        self.variant(S1PRSSEL_A::PRSCH3)
365    }
366    #[doc = "PRS Channel 4 selected."]
367    #[inline(always)]
368    pub fn prsch4(self) -> &'a mut W {
369        self.variant(S1PRSSEL_A::PRSCH4)
370    }
371    #[doc = "PRS Channel 5 selected."]
372    #[inline(always)]
373    pub fn prsch5(self) -> &'a mut W {
374        self.variant(S1PRSSEL_A::PRSCH5)
375    }
376    #[doc = "PRS Channel 6 selected."]
377    #[inline(always)]
378    pub fn prsch6(self) -> &'a mut W {
379        self.variant(S1PRSSEL_A::PRSCH6)
380    }
381    #[doc = "PRS Channel 7 selected."]
382    #[inline(always)]
383    pub fn prsch7(self) -> &'a mut W {
384        self.variant(S1PRSSEL_A::PRSCH7)
385    }
386    #[doc = "PRS Channel 8 selected."]
387    #[inline(always)]
388    pub fn prsch8(self) -> &'a mut W {
389        self.variant(S1PRSSEL_A::PRSCH8)
390    }
391    #[doc = "PRS Channel 9 selected."]
392    #[inline(always)]
393    pub fn prsch9(self) -> &'a mut W {
394        self.variant(S1PRSSEL_A::PRSCH9)
395    }
396    #[doc = "PRS Channel 10 selected."]
397    #[inline(always)]
398    pub fn prsch10(self) -> &'a mut W {
399        self.variant(S1PRSSEL_A::PRSCH10)
400    }
401    #[doc = "PRS Channel 11 selected."]
402    #[inline(always)]
403    pub fn prsch11(self) -> &'a mut W {
404        self.variant(S1PRSSEL_A::PRSCH11)
405    }
406}
407#[doc = "Field `S1PRSEN` reader - S1IN PRS Enable"]
408pub type S1PRSEN_R = crate::BitReader<bool>;
409#[doc = "Field `S1PRSEN` writer - S1IN PRS Enable"]
410pub type S1PRSEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, INPUT_SPEC, bool, O>;
411impl R {
412    #[doc = "Bits 0:3 - S0IN PRS Channel Select"]
413    #[inline(always)]
414    pub fn s0prssel(&self) -> S0PRSSEL_R {
415        S0PRSSEL_R::new((self.bits & 0x0f) as u8)
416    }
417    #[doc = "Bit 4 - S0IN PRS Enable"]
418    #[inline(always)]
419    pub fn s0prsen(&self) -> S0PRSEN_R {
420        S0PRSEN_R::new(((self.bits >> 4) & 1) != 0)
421    }
422    #[doc = "Bits 6:9 - S1IN PRS Channel Select"]
423    #[inline(always)]
424    pub fn s1prssel(&self) -> S1PRSSEL_R {
425        S1PRSSEL_R::new(((self.bits >> 6) & 0x0f) as u8)
426    }
427    #[doc = "Bit 10 - S1IN PRS Enable"]
428    #[inline(always)]
429    pub fn s1prsen(&self) -> S1PRSEN_R {
430        S1PRSEN_R::new(((self.bits >> 10) & 1) != 0)
431    }
432}
433impl W {
434    #[doc = "Bits 0:3 - S0IN PRS Channel Select"]
435    #[inline(always)]
436    #[must_use]
437    pub fn s0prssel(&mut self) -> S0PRSSEL_W<0> {
438        S0PRSSEL_W::new(self)
439    }
440    #[doc = "Bit 4 - S0IN PRS Enable"]
441    #[inline(always)]
442    #[must_use]
443    pub fn s0prsen(&mut self) -> S0PRSEN_W<4> {
444        S0PRSEN_W::new(self)
445    }
446    #[doc = "Bits 6:9 - S1IN PRS Channel Select"]
447    #[inline(always)]
448    #[must_use]
449    pub fn s1prssel(&mut self) -> S1PRSSEL_W<6> {
450        S1PRSSEL_W::new(self)
451    }
452    #[doc = "Bit 10 - S1IN PRS Enable"]
453    #[inline(always)]
454    #[must_use]
455    pub fn s1prsen(&mut self) -> S1PRSEN_W<10> {
456        S1PRSEN_W::new(self)
457    }
458    #[doc = "Writes raw bits to the register."]
459    #[inline(always)]
460    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
461        self.0.bits(bits);
462        self
463    }
464}
465#[doc = "PCNT Input 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 [input](index.html) module"]
466pub struct INPUT_SPEC;
467impl crate::RegisterSpec for INPUT_SPEC {
468    type Ux = u32;
469}
470#[doc = "`read()` method returns [input::R](R) reader structure"]
471impl crate::Readable for INPUT_SPEC {
472    type Reader = R;
473}
474#[doc = "`write(|w| ..)` method takes [input::W](W) writer structure"]
475impl crate::Writable for INPUT_SPEC {
476    type Writer = W;
477    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
478    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
479}
480#[doc = "`reset()` method sets INPUT to value 0"]
481impl crate::Resettable for INPUT_SPEC {
482    const RESET_VALUE: Self::Ux = 0;
483}