efm32gg12b130_pac/prs/
dmareq0.rs

1#[doc = "Register `DMAREQ0` reader"]
2pub struct R(crate::R<DMAREQ0_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DMAREQ0_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DMAREQ0_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DMAREQ0_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DMAREQ0` writer"]
17pub struct W(crate::W<DMAREQ0_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DMAREQ0_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<DMAREQ0_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DMAREQ0_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "DMA Request 0 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"]
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    #[doc = "12: PRS Channel 12 selected"]
66    PRSCH12 = 12,
67    #[doc = "13: PRS Channel 13 selected"]
68    PRSCH13 = 13,
69    #[doc = "14: PRS Channel 14 selected"]
70    PRSCH14 = 14,
71    #[doc = "15: PRS Channel 15 selected"]
72    PRSCH15 = 15,
73}
74impl From<PRSSEL_A> for u8 {
75    #[inline(always)]
76    fn from(variant: PRSSEL_A) -> Self {
77        variant as _
78    }
79}
80#[doc = "Field `PRSSEL` reader - DMA Request 0 PRS Channel Select"]
81pub type PRSSEL_R = crate::FieldReader<u8, PRSSEL_A>;
82impl PRSSEL_R {
83    #[doc = "Get enumerated values variant"]
84    #[inline(always)]
85    pub fn variant(&self) -> PRSSEL_A {
86        match self.bits {
87            0 => PRSSEL_A::PRSCH0,
88            1 => PRSSEL_A::PRSCH1,
89            2 => PRSSEL_A::PRSCH2,
90            3 => PRSSEL_A::PRSCH3,
91            4 => PRSSEL_A::PRSCH4,
92            5 => PRSSEL_A::PRSCH5,
93            6 => PRSSEL_A::PRSCH6,
94            7 => PRSSEL_A::PRSCH7,
95            8 => PRSSEL_A::PRSCH8,
96            9 => PRSSEL_A::PRSCH9,
97            10 => PRSSEL_A::PRSCH10,
98            11 => PRSSEL_A::PRSCH11,
99            12 => PRSSEL_A::PRSCH12,
100            13 => PRSSEL_A::PRSCH13,
101            14 => PRSSEL_A::PRSCH14,
102            15 => PRSSEL_A::PRSCH15,
103            _ => unreachable!(),
104        }
105    }
106    #[doc = "Checks if the value of the field is `PRSCH0`"]
107    #[inline(always)]
108    pub fn is_prsch0(&self) -> bool {
109        *self == PRSSEL_A::PRSCH0
110    }
111    #[doc = "Checks if the value of the field is `PRSCH1`"]
112    #[inline(always)]
113    pub fn is_prsch1(&self) -> bool {
114        *self == PRSSEL_A::PRSCH1
115    }
116    #[doc = "Checks if the value of the field is `PRSCH2`"]
117    #[inline(always)]
118    pub fn is_prsch2(&self) -> bool {
119        *self == PRSSEL_A::PRSCH2
120    }
121    #[doc = "Checks if the value of the field is `PRSCH3`"]
122    #[inline(always)]
123    pub fn is_prsch3(&self) -> bool {
124        *self == PRSSEL_A::PRSCH3
125    }
126    #[doc = "Checks if the value of the field is `PRSCH4`"]
127    #[inline(always)]
128    pub fn is_prsch4(&self) -> bool {
129        *self == PRSSEL_A::PRSCH4
130    }
131    #[doc = "Checks if the value of the field is `PRSCH5`"]
132    #[inline(always)]
133    pub fn is_prsch5(&self) -> bool {
134        *self == PRSSEL_A::PRSCH5
135    }
136    #[doc = "Checks if the value of the field is `PRSCH6`"]
137    #[inline(always)]
138    pub fn is_prsch6(&self) -> bool {
139        *self == PRSSEL_A::PRSCH6
140    }
141    #[doc = "Checks if the value of the field is `PRSCH7`"]
142    #[inline(always)]
143    pub fn is_prsch7(&self) -> bool {
144        *self == PRSSEL_A::PRSCH7
145    }
146    #[doc = "Checks if the value of the field is `PRSCH8`"]
147    #[inline(always)]
148    pub fn is_prsch8(&self) -> bool {
149        *self == PRSSEL_A::PRSCH8
150    }
151    #[doc = "Checks if the value of the field is `PRSCH9`"]
152    #[inline(always)]
153    pub fn is_prsch9(&self) -> bool {
154        *self == PRSSEL_A::PRSCH9
155    }
156    #[doc = "Checks if the value of the field is `PRSCH10`"]
157    #[inline(always)]
158    pub fn is_prsch10(&self) -> bool {
159        *self == PRSSEL_A::PRSCH10
160    }
161    #[doc = "Checks if the value of the field is `PRSCH11`"]
162    #[inline(always)]
163    pub fn is_prsch11(&self) -> bool {
164        *self == PRSSEL_A::PRSCH11
165    }
166    #[doc = "Checks if the value of the field is `PRSCH12`"]
167    #[inline(always)]
168    pub fn is_prsch12(&self) -> bool {
169        *self == PRSSEL_A::PRSCH12
170    }
171    #[doc = "Checks if the value of the field is `PRSCH13`"]
172    #[inline(always)]
173    pub fn is_prsch13(&self) -> bool {
174        *self == PRSSEL_A::PRSCH13
175    }
176    #[doc = "Checks if the value of the field is `PRSCH14`"]
177    #[inline(always)]
178    pub fn is_prsch14(&self) -> bool {
179        *self == PRSSEL_A::PRSCH14
180    }
181    #[doc = "Checks if the value of the field is `PRSCH15`"]
182    #[inline(always)]
183    pub fn is_prsch15(&self) -> bool {
184        *self == PRSSEL_A::PRSCH15
185    }
186}
187#[doc = "Field `PRSSEL` writer - DMA Request 0 PRS Channel Select"]
188pub type PRSSEL_W<'a> = crate::FieldWriterSafe<'a, u32, DMAREQ0_SPEC, u8, PRSSEL_A, 4, 6>;
189impl<'a> PRSSEL_W<'a> {
190    #[doc = "PRS Channel 0 selected"]
191    #[inline(always)]
192    pub fn prsch0(self) -> &'a mut W {
193        self.variant(PRSSEL_A::PRSCH0)
194    }
195    #[doc = "PRS Channel 1 selected"]
196    #[inline(always)]
197    pub fn prsch1(self) -> &'a mut W {
198        self.variant(PRSSEL_A::PRSCH1)
199    }
200    #[doc = "PRS Channel 2 selected"]
201    #[inline(always)]
202    pub fn prsch2(self) -> &'a mut W {
203        self.variant(PRSSEL_A::PRSCH2)
204    }
205    #[doc = "PRS Channel 3 selected"]
206    #[inline(always)]
207    pub fn prsch3(self) -> &'a mut W {
208        self.variant(PRSSEL_A::PRSCH3)
209    }
210    #[doc = "PRS Channel 4 selected"]
211    #[inline(always)]
212    pub fn prsch4(self) -> &'a mut W {
213        self.variant(PRSSEL_A::PRSCH4)
214    }
215    #[doc = "PRS Channel 5 selected"]
216    #[inline(always)]
217    pub fn prsch5(self) -> &'a mut W {
218        self.variant(PRSSEL_A::PRSCH5)
219    }
220    #[doc = "PRS Channel 6 selected"]
221    #[inline(always)]
222    pub fn prsch6(self) -> &'a mut W {
223        self.variant(PRSSEL_A::PRSCH6)
224    }
225    #[doc = "PRS Channel 7 selected"]
226    #[inline(always)]
227    pub fn prsch7(self) -> &'a mut W {
228        self.variant(PRSSEL_A::PRSCH7)
229    }
230    #[doc = "PRS Channel 8 selected"]
231    #[inline(always)]
232    pub fn prsch8(self) -> &'a mut W {
233        self.variant(PRSSEL_A::PRSCH8)
234    }
235    #[doc = "PRS Channel 9 selected"]
236    #[inline(always)]
237    pub fn prsch9(self) -> &'a mut W {
238        self.variant(PRSSEL_A::PRSCH9)
239    }
240    #[doc = "PRS Channel 10 selected"]
241    #[inline(always)]
242    pub fn prsch10(self) -> &'a mut W {
243        self.variant(PRSSEL_A::PRSCH10)
244    }
245    #[doc = "PRS Channel 11 selected"]
246    #[inline(always)]
247    pub fn prsch11(self) -> &'a mut W {
248        self.variant(PRSSEL_A::PRSCH11)
249    }
250    #[doc = "PRS Channel 12 selected"]
251    #[inline(always)]
252    pub fn prsch12(self) -> &'a mut W {
253        self.variant(PRSSEL_A::PRSCH12)
254    }
255    #[doc = "PRS Channel 13 selected"]
256    #[inline(always)]
257    pub fn prsch13(self) -> &'a mut W {
258        self.variant(PRSSEL_A::PRSCH13)
259    }
260    #[doc = "PRS Channel 14 selected"]
261    #[inline(always)]
262    pub fn prsch14(self) -> &'a mut W {
263        self.variant(PRSSEL_A::PRSCH14)
264    }
265    #[doc = "PRS Channel 15 selected"]
266    #[inline(always)]
267    pub fn prsch15(self) -> &'a mut W {
268        self.variant(PRSSEL_A::PRSCH15)
269    }
270}
271impl R {
272    #[doc = "Bits 6:9 - DMA Request 0 PRS Channel Select"]
273    #[inline(always)]
274    pub fn prssel(&self) -> PRSSEL_R {
275        PRSSEL_R::new(((self.bits >> 6) & 0x0f) as u8)
276    }
277}
278impl W {
279    #[doc = "Bits 6:9 - DMA Request 0 PRS Channel Select"]
280    #[inline(always)]
281    pub fn prssel(&mut self) -> PRSSEL_W {
282        PRSSEL_W::new(self)
283    }
284    #[doc = "Writes raw bits to the register."]
285    #[inline(always)]
286    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
287        self.0.bits(bits);
288        self
289    }
290}
291#[doc = "DMA Request 0 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 [dmareq0](index.html) module"]
292pub struct DMAREQ0_SPEC;
293impl crate::RegisterSpec for DMAREQ0_SPEC {
294    type Ux = u32;
295}
296#[doc = "`read()` method returns [dmareq0::R](R) reader structure"]
297impl crate::Readable for DMAREQ0_SPEC {
298    type Reader = R;
299}
300#[doc = "`write(|w| ..)` method takes [dmareq0::W](W) writer structure"]
301impl crate::Writable for DMAREQ0_SPEC {
302    type Writer = W;
303}
304#[doc = "`reset()` method sets DMAREQ0 to value 0"]
305impl crate::Resettable for DMAREQ0_SPEC {
306    #[inline(always)]
307    fn reset_value() -> Self::Ux {
308        0
309    }
310}