efm32pg12_pac/prs/
dmareq0.rs

1#[doc = "Reader of register DMAREQ0"]
2pub type R = crate::R<u32, super::DMAREQ0>;
3#[doc = "Writer for register DMAREQ0"]
4pub type W = crate::W<u32, super::DMAREQ0>;
5#[doc = "Register DMAREQ0 `reset()`'s with value 0"]
6impl crate::ResetValue for super::DMAREQ0 {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "DMA Request 0 PRS Channel Select\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum PRSSEL_A {
17    #[doc = "0: PRS Channel 0 selected"]
18    PRSCH0 = 0,
19    #[doc = "1: PRS Channel 1 selected"]
20    PRSCH1 = 1,
21    #[doc = "2: PRS Channel 2 selected"]
22    PRSCH2 = 2,
23    #[doc = "3: PRS Channel 3 selected"]
24    PRSCH3 = 3,
25    #[doc = "4: PRS Channel 4 selected"]
26    PRSCH4 = 4,
27    #[doc = "5: PRS Channel 5 selected"]
28    PRSCH5 = 5,
29    #[doc = "6: PRS Channel 6 selected"]
30    PRSCH6 = 6,
31    #[doc = "7: PRS Channel 7 selected"]
32    PRSCH7 = 7,
33    #[doc = "8: PRS Channel 8 selected"]
34    PRSCH8 = 8,
35    #[doc = "9: PRS Channel 9 selected"]
36    PRSCH9 = 9,
37    #[doc = "10: PRS Channel 10 selected"]
38    PRSCH10 = 10,
39    #[doc = "11: PRS Channel 11 selected"]
40    PRSCH11 = 11,
41}
42impl From<PRSSEL_A> for u8 {
43    #[inline(always)]
44    fn from(variant: PRSSEL_A) -> Self {
45        variant as _
46    }
47}
48#[doc = "Reader of field `PRSSEL`"]
49pub type PRSSEL_R = crate::R<u8, PRSSEL_A>;
50impl PRSSEL_R {
51    #[doc = r"Get enumerated values variant"]
52    #[inline(always)]
53    pub fn variant(&self) -> crate::Variant<u8, PRSSEL_A> {
54        use crate::Variant::*;
55        match self.bits {
56            0 => Val(PRSSEL_A::PRSCH0),
57            1 => Val(PRSSEL_A::PRSCH1),
58            2 => Val(PRSSEL_A::PRSCH2),
59            3 => Val(PRSSEL_A::PRSCH3),
60            4 => Val(PRSSEL_A::PRSCH4),
61            5 => Val(PRSSEL_A::PRSCH5),
62            6 => Val(PRSSEL_A::PRSCH6),
63            7 => Val(PRSSEL_A::PRSCH7),
64            8 => Val(PRSSEL_A::PRSCH8),
65            9 => Val(PRSSEL_A::PRSCH9),
66            10 => Val(PRSSEL_A::PRSCH10),
67            11 => Val(PRSSEL_A::PRSCH11),
68            i => Res(i),
69        }
70    }
71    #[doc = "Checks if the value of the field is `PRSCH0`"]
72    #[inline(always)]
73    pub fn is_prsch0(&self) -> bool {
74        *self == PRSSEL_A::PRSCH0
75    }
76    #[doc = "Checks if the value of the field is `PRSCH1`"]
77    #[inline(always)]
78    pub fn is_prsch1(&self) -> bool {
79        *self == PRSSEL_A::PRSCH1
80    }
81    #[doc = "Checks if the value of the field is `PRSCH2`"]
82    #[inline(always)]
83    pub fn is_prsch2(&self) -> bool {
84        *self == PRSSEL_A::PRSCH2
85    }
86    #[doc = "Checks if the value of the field is `PRSCH3`"]
87    #[inline(always)]
88    pub fn is_prsch3(&self) -> bool {
89        *self == PRSSEL_A::PRSCH3
90    }
91    #[doc = "Checks if the value of the field is `PRSCH4`"]
92    #[inline(always)]
93    pub fn is_prsch4(&self) -> bool {
94        *self == PRSSEL_A::PRSCH4
95    }
96    #[doc = "Checks if the value of the field is `PRSCH5`"]
97    #[inline(always)]
98    pub fn is_prsch5(&self) -> bool {
99        *self == PRSSEL_A::PRSCH5
100    }
101    #[doc = "Checks if the value of the field is `PRSCH6`"]
102    #[inline(always)]
103    pub fn is_prsch6(&self) -> bool {
104        *self == PRSSEL_A::PRSCH6
105    }
106    #[doc = "Checks if the value of the field is `PRSCH7`"]
107    #[inline(always)]
108    pub fn is_prsch7(&self) -> bool {
109        *self == PRSSEL_A::PRSCH7
110    }
111    #[doc = "Checks if the value of the field is `PRSCH8`"]
112    #[inline(always)]
113    pub fn is_prsch8(&self) -> bool {
114        *self == PRSSEL_A::PRSCH8
115    }
116    #[doc = "Checks if the value of the field is `PRSCH9`"]
117    #[inline(always)]
118    pub fn is_prsch9(&self) -> bool {
119        *self == PRSSEL_A::PRSCH9
120    }
121    #[doc = "Checks if the value of the field is `PRSCH10`"]
122    #[inline(always)]
123    pub fn is_prsch10(&self) -> bool {
124        *self == PRSSEL_A::PRSCH10
125    }
126    #[doc = "Checks if the value of the field is `PRSCH11`"]
127    #[inline(always)]
128    pub fn is_prsch11(&self) -> bool {
129        *self == PRSSEL_A::PRSCH11
130    }
131}
132#[doc = "Write proxy for field `PRSSEL`"]
133pub struct PRSSEL_W<'a> {
134    w: &'a mut W,
135}
136impl<'a> PRSSEL_W<'a> {
137    #[doc = r"Writes `variant` to the field"]
138    #[inline(always)]
139    pub fn variant(self, variant: PRSSEL_A) -> &'a mut W {
140        unsafe { self.bits(variant.into()) }
141    }
142    #[doc = "PRS Channel 0 selected"]
143    #[inline(always)]
144    pub fn prsch0(self) -> &'a mut W {
145        self.variant(PRSSEL_A::PRSCH0)
146    }
147    #[doc = "PRS Channel 1 selected"]
148    #[inline(always)]
149    pub fn prsch1(self) -> &'a mut W {
150        self.variant(PRSSEL_A::PRSCH1)
151    }
152    #[doc = "PRS Channel 2 selected"]
153    #[inline(always)]
154    pub fn prsch2(self) -> &'a mut W {
155        self.variant(PRSSEL_A::PRSCH2)
156    }
157    #[doc = "PRS Channel 3 selected"]
158    #[inline(always)]
159    pub fn prsch3(self) -> &'a mut W {
160        self.variant(PRSSEL_A::PRSCH3)
161    }
162    #[doc = "PRS Channel 4 selected"]
163    #[inline(always)]
164    pub fn prsch4(self) -> &'a mut W {
165        self.variant(PRSSEL_A::PRSCH4)
166    }
167    #[doc = "PRS Channel 5 selected"]
168    #[inline(always)]
169    pub fn prsch5(self) -> &'a mut W {
170        self.variant(PRSSEL_A::PRSCH5)
171    }
172    #[doc = "PRS Channel 6 selected"]
173    #[inline(always)]
174    pub fn prsch6(self) -> &'a mut W {
175        self.variant(PRSSEL_A::PRSCH6)
176    }
177    #[doc = "PRS Channel 7 selected"]
178    #[inline(always)]
179    pub fn prsch7(self) -> &'a mut W {
180        self.variant(PRSSEL_A::PRSCH7)
181    }
182    #[doc = "PRS Channel 8 selected"]
183    #[inline(always)]
184    pub fn prsch8(self) -> &'a mut W {
185        self.variant(PRSSEL_A::PRSCH8)
186    }
187    #[doc = "PRS Channel 9 selected"]
188    #[inline(always)]
189    pub fn prsch9(self) -> &'a mut W {
190        self.variant(PRSSEL_A::PRSCH9)
191    }
192    #[doc = "PRS Channel 10 selected"]
193    #[inline(always)]
194    pub fn prsch10(self) -> &'a mut W {
195        self.variant(PRSSEL_A::PRSCH10)
196    }
197    #[doc = "PRS Channel 11 selected"]
198    #[inline(always)]
199    pub fn prsch11(self) -> &'a mut W {
200        self.variant(PRSSEL_A::PRSCH11)
201    }
202    #[doc = r"Writes raw bits to the field"]
203    #[inline(always)]
204    pub unsafe fn bits(self, value: u8) -> &'a mut W {
205        self.w.bits = (self.w.bits & !(0x0f << 6)) | (((value as u32) & 0x0f) << 6);
206        self.w
207    }
208}
209impl R {
210    #[doc = "Bits 6:9 - DMA Request 0 PRS Channel Select"]
211    #[inline(always)]
212    pub fn prssel(&self) -> PRSSEL_R {
213        PRSSEL_R::new(((self.bits >> 6) & 0x0f) as u8)
214    }
215}
216impl W {
217    #[doc = "Bits 6:9 - DMA Request 0 PRS Channel Select"]
218    #[inline(always)]
219    pub fn prssel(&mut self) -> PRSSEL_W {
220        PRSSEL_W { w: self }
221    }
222}