efm32pg12_pac/ldma/
ch3_reqsel.rs

1#[doc = "Reader of register CH3_REQSEL"]
2pub type R = crate::R<u32, super::CH3_REQSEL>;
3#[doc = "Writer for register CH3_REQSEL"]
4pub type W = crate::W<u32, super::CH3_REQSEL>;
5#[doc = "Register CH3_REQSEL `reset()`'s with value 0"]
6impl crate::ResetValue for super::CH3_REQSEL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `SIGSEL`"]
14pub type SIGSEL_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `SIGSEL`"]
16pub struct SIGSEL_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> SIGSEL_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u8) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
24        self.w
25    }
26}
27#[doc = "Source Select\n\nValue on reset: 0"]
28#[derive(Clone, Copy, Debug, PartialEq)]
29#[repr(u8)]
30pub enum SOURCESEL_A {
31    #[doc = "0: No source selected"]
32    NONE = 0,
33    #[doc = "1: Peripheral Reflex System"]
34    PRS = 1,
35    #[doc = "8: Analog to Digital Converter 0"]
36    ADC0 = 8,
37    #[doc = "10: Digital to Analog Converter 0"]
38    VDAC0 = 10,
39    #[doc = "12: Universal Synchronous/Asynchronous Receiver/Transmitter 0"]
40    USART0 = 12,
41    #[doc = "13: Universal Synchronous/Asynchronous Receiver/Transmitter 1"]
42    USART1 = 13,
43    #[doc = "14: Universal Synchronous/Asynchronous Receiver/Transmitter 2"]
44    USART2 = 14,
45    #[doc = "15: Universal Synchronous/Asynchronous Receiver/Transmitter 3"]
46    USART3 = 15,
47    #[doc = "16: Low Energy UART 0"]
48    LEUART0 = 16,
49    #[doc = "20: I2C 0"]
50    I2C0 = 20,
51    #[doc = "21: I2C 1"]
52    I2C1 = 21,
53    #[doc = "24: Timer 0"]
54    TIMER0 = 24,
55    #[doc = "25: Timer 1"]
56    TIMER1 = 25,
57    #[doc = "26: Wide Timer 0"]
58    WTIMER0 = 26,
59    #[doc = "27: Wide Timer 1"]
60    WTIMER1 = 27,
61    #[doc = "48: Memory System Controller"]
62    MSC = 48,
63    #[doc = "49: Advanced Encryption Standard Accelerator 0"]
64    CRYPTO0 = 49,
65    #[doc = "50: Capacitive touch sense module"]
66    CSEN = 50,
67    #[doc = "51: Low Energy Sensor Interface"]
68    LESENSE = 51,
69    #[doc = "52: Advanced Encryption Standard Accelerator 1"]
70    CRYPTO1 = 52,
71}
72impl From<SOURCESEL_A> for u8 {
73    #[inline(always)]
74    fn from(variant: SOURCESEL_A) -> Self {
75        variant as _
76    }
77}
78#[doc = "Reader of field `SOURCESEL`"]
79pub type SOURCESEL_R = crate::R<u8, SOURCESEL_A>;
80impl SOURCESEL_R {
81    #[doc = r"Get enumerated values variant"]
82    #[inline(always)]
83    pub fn variant(&self) -> crate::Variant<u8, SOURCESEL_A> {
84        use crate::Variant::*;
85        match self.bits {
86            0 => Val(SOURCESEL_A::NONE),
87            1 => Val(SOURCESEL_A::PRS),
88            8 => Val(SOURCESEL_A::ADC0),
89            10 => Val(SOURCESEL_A::VDAC0),
90            12 => Val(SOURCESEL_A::USART0),
91            13 => Val(SOURCESEL_A::USART1),
92            14 => Val(SOURCESEL_A::USART2),
93            15 => Val(SOURCESEL_A::USART3),
94            16 => Val(SOURCESEL_A::LEUART0),
95            20 => Val(SOURCESEL_A::I2C0),
96            21 => Val(SOURCESEL_A::I2C1),
97            24 => Val(SOURCESEL_A::TIMER0),
98            25 => Val(SOURCESEL_A::TIMER1),
99            26 => Val(SOURCESEL_A::WTIMER0),
100            27 => Val(SOURCESEL_A::WTIMER1),
101            48 => Val(SOURCESEL_A::MSC),
102            49 => Val(SOURCESEL_A::CRYPTO0),
103            50 => Val(SOURCESEL_A::CSEN),
104            51 => Val(SOURCESEL_A::LESENSE),
105            52 => Val(SOURCESEL_A::CRYPTO1),
106            i => Res(i),
107        }
108    }
109    #[doc = "Checks if the value of the field is `NONE`"]
110    #[inline(always)]
111    pub fn is_none(&self) -> bool {
112        *self == SOURCESEL_A::NONE
113    }
114    #[doc = "Checks if the value of the field is `PRS`"]
115    #[inline(always)]
116    pub fn is_prs(&self) -> bool {
117        *self == SOURCESEL_A::PRS
118    }
119    #[doc = "Checks if the value of the field is `ADC0`"]
120    #[inline(always)]
121    pub fn is_adc0(&self) -> bool {
122        *self == SOURCESEL_A::ADC0
123    }
124    #[doc = "Checks if the value of the field is `VDAC0`"]
125    #[inline(always)]
126    pub fn is_vdac0(&self) -> bool {
127        *self == SOURCESEL_A::VDAC0
128    }
129    #[doc = "Checks if the value of the field is `USART0`"]
130    #[inline(always)]
131    pub fn is_usart0(&self) -> bool {
132        *self == SOURCESEL_A::USART0
133    }
134    #[doc = "Checks if the value of the field is `USART1`"]
135    #[inline(always)]
136    pub fn is_usart1(&self) -> bool {
137        *self == SOURCESEL_A::USART1
138    }
139    #[doc = "Checks if the value of the field is `USART2`"]
140    #[inline(always)]
141    pub fn is_usart2(&self) -> bool {
142        *self == SOURCESEL_A::USART2
143    }
144    #[doc = "Checks if the value of the field is `USART3`"]
145    #[inline(always)]
146    pub fn is_usart3(&self) -> bool {
147        *self == SOURCESEL_A::USART3
148    }
149    #[doc = "Checks if the value of the field is `LEUART0`"]
150    #[inline(always)]
151    pub fn is_leuart0(&self) -> bool {
152        *self == SOURCESEL_A::LEUART0
153    }
154    #[doc = "Checks if the value of the field is `I2C0`"]
155    #[inline(always)]
156    pub fn is_i2c0(&self) -> bool {
157        *self == SOURCESEL_A::I2C0
158    }
159    #[doc = "Checks if the value of the field is `I2C1`"]
160    #[inline(always)]
161    pub fn is_i2c1(&self) -> bool {
162        *self == SOURCESEL_A::I2C1
163    }
164    #[doc = "Checks if the value of the field is `TIMER0`"]
165    #[inline(always)]
166    pub fn is_timer0(&self) -> bool {
167        *self == SOURCESEL_A::TIMER0
168    }
169    #[doc = "Checks if the value of the field is `TIMER1`"]
170    #[inline(always)]
171    pub fn is_timer1(&self) -> bool {
172        *self == SOURCESEL_A::TIMER1
173    }
174    #[doc = "Checks if the value of the field is `WTIMER0`"]
175    #[inline(always)]
176    pub fn is_wtimer0(&self) -> bool {
177        *self == SOURCESEL_A::WTIMER0
178    }
179    #[doc = "Checks if the value of the field is `WTIMER1`"]
180    #[inline(always)]
181    pub fn is_wtimer1(&self) -> bool {
182        *self == SOURCESEL_A::WTIMER1
183    }
184    #[doc = "Checks if the value of the field is `MSC`"]
185    #[inline(always)]
186    pub fn is_msc(&self) -> bool {
187        *self == SOURCESEL_A::MSC
188    }
189    #[doc = "Checks if the value of the field is `CRYPTO0`"]
190    #[inline(always)]
191    pub fn is_crypto0(&self) -> bool {
192        *self == SOURCESEL_A::CRYPTO0
193    }
194    #[doc = "Checks if the value of the field is `CSEN`"]
195    #[inline(always)]
196    pub fn is_csen(&self) -> bool {
197        *self == SOURCESEL_A::CSEN
198    }
199    #[doc = "Checks if the value of the field is `LESENSE`"]
200    #[inline(always)]
201    pub fn is_lesense(&self) -> bool {
202        *self == SOURCESEL_A::LESENSE
203    }
204    #[doc = "Checks if the value of the field is `CRYPTO1`"]
205    #[inline(always)]
206    pub fn is_crypto1(&self) -> bool {
207        *self == SOURCESEL_A::CRYPTO1
208    }
209}
210#[doc = "Write proxy for field `SOURCESEL`"]
211pub struct SOURCESEL_W<'a> {
212    w: &'a mut W,
213}
214impl<'a> SOURCESEL_W<'a> {
215    #[doc = r"Writes `variant` to the field"]
216    #[inline(always)]
217    pub fn variant(self, variant: SOURCESEL_A) -> &'a mut W {
218        unsafe { self.bits(variant.into()) }
219    }
220    #[doc = "No source selected"]
221    #[inline(always)]
222    pub fn none(self) -> &'a mut W {
223        self.variant(SOURCESEL_A::NONE)
224    }
225    #[doc = "Peripheral Reflex System"]
226    #[inline(always)]
227    pub fn prs(self) -> &'a mut W {
228        self.variant(SOURCESEL_A::PRS)
229    }
230    #[doc = "Analog to Digital Converter 0"]
231    #[inline(always)]
232    pub fn adc0(self) -> &'a mut W {
233        self.variant(SOURCESEL_A::ADC0)
234    }
235    #[doc = "Digital to Analog Converter 0"]
236    #[inline(always)]
237    pub fn vdac0(self) -> &'a mut W {
238        self.variant(SOURCESEL_A::VDAC0)
239    }
240    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 0"]
241    #[inline(always)]
242    pub fn usart0(self) -> &'a mut W {
243        self.variant(SOURCESEL_A::USART0)
244    }
245    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 1"]
246    #[inline(always)]
247    pub fn usart1(self) -> &'a mut W {
248        self.variant(SOURCESEL_A::USART1)
249    }
250    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 2"]
251    #[inline(always)]
252    pub fn usart2(self) -> &'a mut W {
253        self.variant(SOURCESEL_A::USART2)
254    }
255    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 3"]
256    #[inline(always)]
257    pub fn usart3(self) -> &'a mut W {
258        self.variant(SOURCESEL_A::USART3)
259    }
260    #[doc = "Low Energy UART 0"]
261    #[inline(always)]
262    pub fn leuart0(self) -> &'a mut W {
263        self.variant(SOURCESEL_A::LEUART0)
264    }
265    #[doc = "I2C 0"]
266    #[inline(always)]
267    pub fn i2c0(self) -> &'a mut W {
268        self.variant(SOURCESEL_A::I2C0)
269    }
270    #[doc = "I2C 1"]
271    #[inline(always)]
272    pub fn i2c1(self) -> &'a mut W {
273        self.variant(SOURCESEL_A::I2C1)
274    }
275    #[doc = "Timer 0"]
276    #[inline(always)]
277    pub fn timer0(self) -> &'a mut W {
278        self.variant(SOURCESEL_A::TIMER0)
279    }
280    #[doc = "Timer 1"]
281    #[inline(always)]
282    pub fn timer1(self) -> &'a mut W {
283        self.variant(SOURCESEL_A::TIMER1)
284    }
285    #[doc = "Wide Timer 0"]
286    #[inline(always)]
287    pub fn wtimer0(self) -> &'a mut W {
288        self.variant(SOURCESEL_A::WTIMER0)
289    }
290    #[doc = "Wide Timer 1"]
291    #[inline(always)]
292    pub fn wtimer1(self) -> &'a mut W {
293        self.variant(SOURCESEL_A::WTIMER1)
294    }
295    #[doc = "Memory System Controller"]
296    #[inline(always)]
297    pub fn msc(self) -> &'a mut W {
298        self.variant(SOURCESEL_A::MSC)
299    }
300    #[doc = "Advanced Encryption Standard Accelerator 0"]
301    #[inline(always)]
302    pub fn crypto0(self) -> &'a mut W {
303        self.variant(SOURCESEL_A::CRYPTO0)
304    }
305    #[doc = "Capacitive touch sense module"]
306    #[inline(always)]
307    pub fn csen(self) -> &'a mut W {
308        self.variant(SOURCESEL_A::CSEN)
309    }
310    #[doc = "Low Energy Sensor Interface"]
311    #[inline(always)]
312    pub fn lesense(self) -> &'a mut W {
313        self.variant(SOURCESEL_A::LESENSE)
314    }
315    #[doc = "Advanced Encryption Standard Accelerator 1"]
316    #[inline(always)]
317    pub fn crypto1(self) -> &'a mut W {
318        self.variant(SOURCESEL_A::CRYPTO1)
319    }
320    #[doc = r"Writes raw bits to the field"]
321    #[inline(always)]
322    pub unsafe fn bits(self, value: u8) -> &'a mut W {
323        self.w.bits = (self.w.bits & !(0x3f << 16)) | (((value as u32) & 0x3f) << 16);
324        self.w
325    }
326}
327impl R {
328    #[doc = "Bits 0:3 - Signal Select"]
329    #[inline(always)]
330    pub fn sigsel(&self) -> SIGSEL_R {
331        SIGSEL_R::new((self.bits & 0x0f) as u8)
332    }
333    #[doc = "Bits 16:21 - Source Select"]
334    #[inline(always)]
335    pub fn sourcesel(&self) -> SOURCESEL_R {
336        SOURCESEL_R::new(((self.bits >> 16) & 0x3f) as u8)
337    }
338}
339impl W {
340    #[doc = "Bits 0:3 - Signal Select"]
341    #[inline(always)]
342    pub fn sigsel(&mut self) -> SIGSEL_W {
343        SIGSEL_W { w: self }
344    }
345    #[doc = "Bits 16:21 - Source Select"]
346    #[inline(always)]
347    pub fn sourcesel(&mut self) -> SOURCESEL_W {
348        SOURCESEL_W { w: self }
349    }
350}