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