efm32gg11b820_pac/csen/
prssel.rs

1#[doc = "Register `PRSSEL` reader"]
2pub struct R(crate::R<PRSSEL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PRSSEL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PRSSEL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PRSSEL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `PRSSEL` writer"]
17pub struct W(crate::W<PRSSEL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<PRSSEL_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<PRSSEL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<PRSSEL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "PRS Channel Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum PRSSEL_A {
41    #[doc = "0: PRS Channel 0 selected as the start trigger"]
42    PRSCH0 = 0,
43    #[doc = "1: PRS Channel 1 selected as the start trigger"]
44    PRSCH1 = 1,
45    #[doc = "2: PRS Channel 2 selected as the start trigger"]
46    PRSCH2 = 2,
47    #[doc = "3: PRS Channel 3 selected as the start trigger"]
48    PRSCH3 = 3,
49    #[doc = "4: PRS Channel 4 selected as the start trigger"]
50    PRSCH4 = 4,
51    #[doc = "5: PRS Channel 5 selected as the start trigger"]
52    PRSCH5 = 5,
53    #[doc = "6: PRS Channel 6 selected as the start trigger"]
54    PRSCH6 = 6,
55    #[doc = "7: PRS Channel 7 selected as the start trigger"]
56    PRSCH7 = 7,
57    #[doc = "8: PRS Channel 8 selected as the start trigger"]
58    PRSCH8 = 8,
59    #[doc = "9: PRS Channel 9 selected as the start trigger"]
60    PRSCH9 = 9,
61    #[doc = "10: PRS Channel 10 selected as the start trigger"]
62    PRSCH10 = 10,
63    #[doc = "11: PRS Channel 11 selected as the start trigger"]
64    PRSCH11 = 11,
65    #[doc = "12: PRS Channel 12 selected as the start trigger"]
66    PRSCH12 = 12,
67    #[doc = "13: PRS Channel 13 selected as the start trigger"]
68    PRSCH13 = 13,
69    #[doc = "14: PRS Channel 14 selected as the start trigger"]
70    PRSCH14 = 14,
71    #[doc = "15: PRS Channel 15 selected as the start trigger"]
72    PRSCH15 = 15,
73    #[doc = "16: PRS Channel 16 selected as the start trigger"]
74    PRSCH16 = 16,
75    #[doc = "17: PRS Channel 17 selected as the start trigger"]
76    PRSCH17 = 17,
77    #[doc = "18: PRS Channel 18 selected as the start trigger"]
78    PRSCH18 = 18,
79    #[doc = "19: PRS Channel 19 selected as the start trigger"]
80    PRSCH19 = 19,
81    #[doc = "20: PRS Channel 20 selected as the start trigger"]
82    PRSCH20 = 20,
83    #[doc = "21: PRS Channel 21 selected as the start trigger"]
84    PRSCH21 = 21,
85    #[doc = "22: PRS Channel 22 selected as the start trigger"]
86    PRSCH22 = 22,
87    #[doc = "23: PRS Channel 23 selected as the start trigger"]
88    PRSCH23 = 23,
89}
90impl From<PRSSEL_A> for u8 {
91    #[inline(always)]
92    fn from(variant: PRSSEL_A) -> Self {
93        variant as _
94    }
95}
96#[doc = "Field `PRSSEL` reader - PRS Channel Select"]
97pub type PRSSEL_R = crate::FieldReader<u8, PRSSEL_A>;
98impl PRSSEL_R {
99    #[doc = "Get enumerated values variant"]
100    #[inline(always)]
101    pub fn variant(&self) -> Option<PRSSEL_A> {
102        match self.bits {
103            0 => Some(PRSSEL_A::PRSCH0),
104            1 => Some(PRSSEL_A::PRSCH1),
105            2 => Some(PRSSEL_A::PRSCH2),
106            3 => Some(PRSSEL_A::PRSCH3),
107            4 => Some(PRSSEL_A::PRSCH4),
108            5 => Some(PRSSEL_A::PRSCH5),
109            6 => Some(PRSSEL_A::PRSCH6),
110            7 => Some(PRSSEL_A::PRSCH7),
111            8 => Some(PRSSEL_A::PRSCH8),
112            9 => Some(PRSSEL_A::PRSCH9),
113            10 => Some(PRSSEL_A::PRSCH10),
114            11 => Some(PRSSEL_A::PRSCH11),
115            12 => Some(PRSSEL_A::PRSCH12),
116            13 => Some(PRSSEL_A::PRSCH13),
117            14 => Some(PRSSEL_A::PRSCH14),
118            15 => Some(PRSSEL_A::PRSCH15),
119            16 => Some(PRSSEL_A::PRSCH16),
120            17 => Some(PRSSEL_A::PRSCH17),
121            18 => Some(PRSSEL_A::PRSCH18),
122            19 => Some(PRSSEL_A::PRSCH19),
123            20 => Some(PRSSEL_A::PRSCH20),
124            21 => Some(PRSSEL_A::PRSCH21),
125            22 => Some(PRSSEL_A::PRSCH22),
126            23 => Some(PRSSEL_A::PRSCH23),
127            _ => None,
128        }
129    }
130    #[doc = "Checks if the value of the field is `PRSCH0`"]
131    #[inline(always)]
132    pub fn is_prsch0(&self) -> bool {
133        *self == PRSSEL_A::PRSCH0
134    }
135    #[doc = "Checks if the value of the field is `PRSCH1`"]
136    #[inline(always)]
137    pub fn is_prsch1(&self) -> bool {
138        *self == PRSSEL_A::PRSCH1
139    }
140    #[doc = "Checks if the value of the field is `PRSCH2`"]
141    #[inline(always)]
142    pub fn is_prsch2(&self) -> bool {
143        *self == PRSSEL_A::PRSCH2
144    }
145    #[doc = "Checks if the value of the field is `PRSCH3`"]
146    #[inline(always)]
147    pub fn is_prsch3(&self) -> bool {
148        *self == PRSSEL_A::PRSCH3
149    }
150    #[doc = "Checks if the value of the field is `PRSCH4`"]
151    #[inline(always)]
152    pub fn is_prsch4(&self) -> bool {
153        *self == PRSSEL_A::PRSCH4
154    }
155    #[doc = "Checks if the value of the field is `PRSCH5`"]
156    #[inline(always)]
157    pub fn is_prsch5(&self) -> bool {
158        *self == PRSSEL_A::PRSCH5
159    }
160    #[doc = "Checks if the value of the field is `PRSCH6`"]
161    #[inline(always)]
162    pub fn is_prsch6(&self) -> bool {
163        *self == PRSSEL_A::PRSCH6
164    }
165    #[doc = "Checks if the value of the field is `PRSCH7`"]
166    #[inline(always)]
167    pub fn is_prsch7(&self) -> bool {
168        *self == PRSSEL_A::PRSCH7
169    }
170    #[doc = "Checks if the value of the field is `PRSCH8`"]
171    #[inline(always)]
172    pub fn is_prsch8(&self) -> bool {
173        *self == PRSSEL_A::PRSCH8
174    }
175    #[doc = "Checks if the value of the field is `PRSCH9`"]
176    #[inline(always)]
177    pub fn is_prsch9(&self) -> bool {
178        *self == PRSSEL_A::PRSCH9
179    }
180    #[doc = "Checks if the value of the field is `PRSCH10`"]
181    #[inline(always)]
182    pub fn is_prsch10(&self) -> bool {
183        *self == PRSSEL_A::PRSCH10
184    }
185    #[doc = "Checks if the value of the field is `PRSCH11`"]
186    #[inline(always)]
187    pub fn is_prsch11(&self) -> bool {
188        *self == PRSSEL_A::PRSCH11
189    }
190    #[doc = "Checks if the value of the field is `PRSCH12`"]
191    #[inline(always)]
192    pub fn is_prsch12(&self) -> bool {
193        *self == PRSSEL_A::PRSCH12
194    }
195    #[doc = "Checks if the value of the field is `PRSCH13`"]
196    #[inline(always)]
197    pub fn is_prsch13(&self) -> bool {
198        *self == PRSSEL_A::PRSCH13
199    }
200    #[doc = "Checks if the value of the field is `PRSCH14`"]
201    #[inline(always)]
202    pub fn is_prsch14(&self) -> bool {
203        *self == PRSSEL_A::PRSCH14
204    }
205    #[doc = "Checks if the value of the field is `PRSCH15`"]
206    #[inline(always)]
207    pub fn is_prsch15(&self) -> bool {
208        *self == PRSSEL_A::PRSCH15
209    }
210    #[doc = "Checks if the value of the field is `PRSCH16`"]
211    #[inline(always)]
212    pub fn is_prsch16(&self) -> bool {
213        *self == PRSSEL_A::PRSCH16
214    }
215    #[doc = "Checks if the value of the field is `PRSCH17`"]
216    #[inline(always)]
217    pub fn is_prsch17(&self) -> bool {
218        *self == PRSSEL_A::PRSCH17
219    }
220    #[doc = "Checks if the value of the field is `PRSCH18`"]
221    #[inline(always)]
222    pub fn is_prsch18(&self) -> bool {
223        *self == PRSSEL_A::PRSCH18
224    }
225    #[doc = "Checks if the value of the field is `PRSCH19`"]
226    #[inline(always)]
227    pub fn is_prsch19(&self) -> bool {
228        *self == PRSSEL_A::PRSCH19
229    }
230    #[doc = "Checks if the value of the field is `PRSCH20`"]
231    #[inline(always)]
232    pub fn is_prsch20(&self) -> bool {
233        *self == PRSSEL_A::PRSCH20
234    }
235    #[doc = "Checks if the value of the field is `PRSCH21`"]
236    #[inline(always)]
237    pub fn is_prsch21(&self) -> bool {
238        *self == PRSSEL_A::PRSCH21
239    }
240    #[doc = "Checks if the value of the field is `PRSCH22`"]
241    #[inline(always)]
242    pub fn is_prsch22(&self) -> bool {
243        *self == PRSSEL_A::PRSCH22
244    }
245    #[doc = "Checks if the value of the field is `PRSCH23`"]
246    #[inline(always)]
247    pub fn is_prsch23(&self) -> bool {
248        *self == PRSSEL_A::PRSCH23
249    }
250}
251#[doc = "Field `PRSSEL` writer - PRS Channel Select"]
252pub type PRSSEL_W<'a> = crate::FieldWriter<'a, u32, PRSSEL_SPEC, u8, PRSSEL_A, 5, 0>;
253impl<'a> PRSSEL_W<'a> {
254    #[doc = "PRS Channel 0 selected as the start trigger"]
255    #[inline(always)]
256    pub fn prsch0(self) -> &'a mut W {
257        self.variant(PRSSEL_A::PRSCH0)
258    }
259    #[doc = "PRS Channel 1 selected as the start trigger"]
260    #[inline(always)]
261    pub fn prsch1(self) -> &'a mut W {
262        self.variant(PRSSEL_A::PRSCH1)
263    }
264    #[doc = "PRS Channel 2 selected as the start trigger"]
265    #[inline(always)]
266    pub fn prsch2(self) -> &'a mut W {
267        self.variant(PRSSEL_A::PRSCH2)
268    }
269    #[doc = "PRS Channel 3 selected as the start trigger"]
270    #[inline(always)]
271    pub fn prsch3(self) -> &'a mut W {
272        self.variant(PRSSEL_A::PRSCH3)
273    }
274    #[doc = "PRS Channel 4 selected as the start trigger"]
275    #[inline(always)]
276    pub fn prsch4(self) -> &'a mut W {
277        self.variant(PRSSEL_A::PRSCH4)
278    }
279    #[doc = "PRS Channel 5 selected as the start trigger"]
280    #[inline(always)]
281    pub fn prsch5(self) -> &'a mut W {
282        self.variant(PRSSEL_A::PRSCH5)
283    }
284    #[doc = "PRS Channel 6 selected as the start trigger"]
285    #[inline(always)]
286    pub fn prsch6(self) -> &'a mut W {
287        self.variant(PRSSEL_A::PRSCH6)
288    }
289    #[doc = "PRS Channel 7 selected as the start trigger"]
290    #[inline(always)]
291    pub fn prsch7(self) -> &'a mut W {
292        self.variant(PRSSEL_A::PRSCH7)
293    }
294    #[doc = "PRS Channel 8 selected as the start trigger"]
295    #[inline(always)]
296    pub fn prsch8(self) -> &'a mut W {
297        self.variant(PRSSEL_A::PRSCH8)
298    }
299    #[doc = "PRS Channel 9 selected as the start trigger"]
300    #[inline(always)]
301    pub fn prsch9(self) -> &'a mut W {
302        self.variant(PRSSEL_A::PRSCH9)
303    }
304    #[doc = "PRS Channel 10 selected as the start trigger"]
305    #[inline(always)]
306    pub fn prsch10(self) -> &'a mut W {
307        self.variant(PRSSEL_A::PRSCH10)
308    }
309    #[doc = "PRS Channel 11 selected as the start trigger"]
310    #[inline(always)]
311    pub fn prsch11(self) -> &'a mut W {
312        self.variant(PRSSEL_A::PRSCH11)
313    }
314    #[doc = "PRS Channel 12 selected as the start trigger"]
315    #[inline(always)]
316    pub fn prsch12(self) -> &'a mut W {
317        self.variant(PRSSEL_A::PRSCH12)
318    }
319    #[doc = "PRS Channel 13 selected as the start trigger"]
320    #[inline(always)]
321    pub fn prsch13(self) -> &'a mut W {
322        self.variant(PRSSEL_A::PRSCH13)
323    }
324    #[doc = "PRS Channel 14 selected as the start trigger"]
325    #[inline(always)]
326    pub fn prsch14(self) -> &'a mut W {
327        self.variant(PRSSEL_A::PRSCH14)
328    }
329    #[doc = "PRS Channel 15 selected as the start trigger"]
330    #[inline(always)]
331    pub fn prsch15(self) -> &'a mut W {
332        self.variant(PRSSEL_A::PRSCH15)
333    }
334    #[doc = "PRS Channel 16 selected as the start trigger"]
335    #[inline(always)]
336    pub fn prsch16(self) -> &'a mut W {
337        self.variant(PRSSEL_A::PRSCH16)
338    }
339    #[doc = "PRS Channel 17 selected as the start trigger"]
340    #[inline(always)]
341    pub fn prsch17(self) -> &'a mut W {
342        self.variant(PRSSEL_A::PRSCH17)
343    }
344    #[doc = "PRS Channel 18 selected as the start trigger"]
345    #[inline(always)]
346    pub fn prsch18(self) -> &'a mut W {
347        self.variant(PRSSEL_A::PRSCH18)
348    }
349    #[doc = "PRS Channel 19 selected as the start trigger"]
350    #[inline(always)]
351    pub fn prsch19(self) -> &'a mut W {
352        self.variant(PRSSEL_A::PRSCH19)
353    }
354    #[doc = "PRS Channel 20 selected as the start trigger"]
355    #[inline(always)]
356    pub fn prsch20(self) -> &'a mut W {
357        self.variant(PRSSEL_A::PRSCH20)
358    }
359    #[doc = "PRS Channel 21 selected as the start trigger"]
360    #[inline(always)]
361    pub fn prsch21(self) -> &'a mut W {
362        self.variant(PRSSEL_A::PRSCH21)
363    }
364    #[doc = "PRS Channel 22 selected as the start trigger"]
365    #[inline(always)]
366    pub fn prsch22(self) -> &'a mut W {
367        self.variant(PRSSEL_A::PRSCH22)
368    }
369    #[doc = "PRS Channel 23 selected as the start trigger"]
370    #[inline(always)]
371    pub fn prsch23(self) -> &'a mut W {
372        self.variant(PRSSEL_A::PRSCH23)
373    }
374}
375impl R {
376    #[doc = "Bits 0:4 - PRS Channel Select"]
377    #[inline(always)]
378    pub fn prssel(&self) -> PRSSEL_R {
379        PRSSEL_R::new((self.bits & 0x1f) as u8)
380    }
381}
382impl W {
383    #[doc = "Bits 0:4 - PRS Channel Select"]
384    #[inline(always)]
385    pub fn prssel(&mut self) -> PRSSEL_W {
386        PRSSEL_W::new(self)
387    }
388    #[doc = "Writes raw bits to the register."]
389    #[inline(always)]
390    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
391        self.0.bits(bits);
392        self
393    }
394}
395#[doc = "PRS Select\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 [prssel](index.html) module"]
396pub struct PRSSEL_SPEC;
397impl crate::RegisterSpec for PRSSEL_SPEC {
398    type Ux = u32;
399}
400#[doc = "`read()` method returns [prssel::R](R) reader structure"]
401impl crate::Readable for PRSSEL_SPEC {
402    type Reader = R;
403}
404#[doc = "`write(|w| ..)` method takes [prssel::W](W) writer structure"]
405impl crate::Writable for PRSSEL_SPEC {
406    type Writer = W;
407}
408#[doc = "`reset()` method sets PRSSEL to value 0"]
409impl crate::Resettable for PRSSEL_SPEC {
410    #[inline(always)]
411    fn reset_value() -> Self::Ux {
412        0
413    }
414}