efm32wg380_pac/dma/
ch0_ctrl.rs

1#[doc = "Register `CH0_CTRL` reader"]
2pub struct R(crate::R<CH0_CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CH0_CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CH0_CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CH0_CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CH0_CTRL` writer"]
17pub struct W(crate::W<CH0_CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CH0_CTRL_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<CH0_CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CH0_CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SIGSEL` reader - Signal Select"]
38pub type SIGSEL_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `SIGSEL` writer - Signal Select"]
40pub type SIGSEL_W<'a> = crate::FieldWriter<'a, u32, CH0_CTRL_SPEC, u8, u8, 4, 0>;
41#[doc = "Source Select\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43#[repr(u8)]
44pub enum SOURCESEL_A {
45    #[doc = "0: No source selected"]
46    NONE = 0,
47    #[doc = "8: Analog to Digital Converter 0"]
48    ADC0 = 8,
49    #[doc = "10: Digital to Analog Converter 0"]
50    DAC0 = 10,
51    #[doc = "12: Universal Synchronous/Asynchronous Receiver/Transmitter 0"]
52    USART0 = 12,
53    #[doc = "13: Universal Synchronous/Asynchronous Receiver/Transmitter 1"]
54    USART1 = 13,
55    #[doc = "14: Universal Synchronous/Asynchronous Receiver/Transmitter 2"]
56    USART2 = 14,
57    #[doc = "16: Low Energy UART 0"]
58    LEUART0 = 16,
59    #[doc = "17: Low Energy UART 1"]
60    LEUART1 = 17,
61    #[doc = "20: I2C 0"]
62    I2C0 = 20,
63    #[doc = "21: I2C 1"]
64    I2C1 = 21,
65    #[doc = "24: Timer 0"]
66    TIMER0 = 24,
67    #[doc = "25: Timer 1"]
68    TIMER1 = 25,
69    #[doc = "26: Timer 2"]
70    TIMER2 = 26,
71    #[doc = "27: Timer 3"]
72    TIMER3 = 27,
73    #[doc = "44: Universal Asynchronous Receiver/Transmitter 0"]
74    UART0 = 44,
75    #[doc = "45: Universal Asynchronous Receiver/Transmitter 1"]
76    UART1 = 45,
77    #[doc = "48: `110000`"]
78    MSC = 48,
79    #[doc = "49: Advanced Encryption Standard Accelerator"]
80    AES = 49,
81    #[doc = "50: Low Energy Sensor Interface"]
82    LESENSE = 50,
83    #[doc = "51: External Bus Interface"]
84    EBI = 51,
85}
86impl From<SOURCESEL_A> for u8 {
87    #[inline(always)]
88    fn from(variant: SOURCESEL_A) -> Self {
89        variant as _
90    }
91}
92#[doc = "Field `SOURCESEL` reader - Source Select"]
93pub type SOURCESEL_R = crate::FieldReader<u8, SOURCESEL_A>;
94impl SOURCESEL_R {
95    #[doc = "Get enumerated values variant"]
96    #[inline(always)]
97    pub fn variant(&self) -> Option<SOURCESEL_A> {
98        match self.bits {
99            0 => Some(SOURCESEL_A::NONE),
100            8 => Some(SOURCESEL_A::ADC0),
101            10 => Some(SOURCESEL_A::DAC0),
102            12 => Some(SOURCESEL_A::USART0),
103            13 => Some(SOURCESEL_A::USART1),
104            14 => Some(SOURCESEL_A::USART2),
105            16 => Some(SOURCESEL_A::LEUART0),
106            17 => Some(SOURCESEL_A::LEUART1),
107            20 => Some(SOURCESEL_A::I2C0),
108            21 => Some(SOURCESEL_A::I2C1),
109            24 => Some(SOURCESEL_A::TIMER0),
110            25 => Some(SOURCESEL_A::TIMER1),
111            26 => Some(SOURCESEL_A::TIMER2),
112            27 => Some(SOURCESEL_A::TIMER3),
113            44 => Some(SOURCESEL_A::UART0),
114            45 => Some(SOURCESEL_A::UART1),
115            48 => Some(SOURCESEL_A::MSC),
116            49 => Some(SOURCESEL_A::AES),
117            50 => Some(SOURCESEL_A::LESENSE),
118            51 => Some(SOURCESEL_A::EBI),
119            _ => None,
120        }
121    }
122    #[doc = "Checks if the value of the field is `NONE`"]
123    #[inline(always)]
124    pub fn is_none(&self) -> bool {
125        *self == SOURCESEL_A::NONE
126    }
127    #[doc = "Checks if the value of the field is `ADC0`"]
128    #[inline(always)]
129    pub fn is_adc0(&self) -> bool {
130        *self == SOURCESEL_A::ADC0
131    }
132    #[doc = "Checks if the value of the field is `DAC0`"]
133    #[inline(always)]
134    pub fn is_dac0(&self) -> bool {
135        *self == SOURCESEL_A::DAC0
136    }
137    #[doc = "Checks if the value of the field is `USART0`"]
138    #[inline(always)]
139    pub fn is_usart0(&self) -> bool {
140        *self == SOURCESEL_A::USART0
141    }
142    #[doc = "Checks if the value of the field is `USART1`"]
143    #[inline(always)]
144    pub fn is_usart1(&self) -> bool {
145        *self == SOURCESEL_A::USART1
146    }
147    #[doc = "Checks if the value of the field is `USART2`"]
148    #[inline(always)]
149    pub fn is_usart2(&self) -> bool {
150        *self == SOURCESEL_A::USART2
151    }
152    #[doc = "Checks if the value of the field is `LEUART0`"]
153    #[inline(always)]
154    pub fn is_leuart0(&self) -> bool {
155        *self == SOURCESEL_A::LEUART0
156    }
157    #[doc = "Checks if the value of the field is `LEUART1`"]
158    #[inline(always)]
159    pub fn is_leuart1(&self) -> bool {
160        *self == SOURCESEL_A::LEUART1
161    }
162    #[doc = "Checks if the value of the field is `I2C0`"]
163    #[inline(always)]
164    pub fn is_i2c0(&self) -> bool {
165        *self == SOURCESEL_A::I2C0
166    }
167    #[doc = "Checks if the value of the field is `I2C1`"]
168    #[inline(always)]
169    pub fn is_i2c1(&self) -> bool {
170        *self == SOURCESEL_A::I2C1
171    }
172    #[doc = "Checks if the value of the field is `TIMER0`"]
173    #[inline(always)]
174    pub fn is_timer0(&self) -> bool {
175        *self == SOURCESEL_A::TIMER0
176    }
177    #[doc = "Checks if the value of the field is `TIMER1`"]
178    #[inline(always)]
179    pub fn is_timer1(&self) -> bool {
180        *self == SOURCESEL_A::TIMER1
181    }
182    #[doc = "Checks if the value of the field is `TIMER2`"]
183    #[inline(always)]
184    pub fn is_timer2(&self) -> bool {
185        *self == SOURCESEL_A::TIMER2
186    }
187    #[doc = "Checks if the value of the field is `TIMER3`"]
188    #[inline(always)]
189    pub fn is_timer3(&self) -> bool {
190        *self == SOURCESEL_A::TIMER3
191    }
192    #[doc = "Checks if the value of the field is `UART0`"]
193    #[inline(always)]
194    pub fn is_uart0(&self) -> bool {
195        *self == SOURCESEL_A::UART0
196    }
197    #[doc = "Checks if the value of the field is `UART1`"]
198    #[inline(always)]
199    pub fn is_uart1(&self) -> bool {
200        *self == SOURCESEL_A::UART1
201    }
202    #[doc = "Checks if the value of the field is `MSC`"]
203    #[inline(always)]
204    pub fn is_msc(&self) -> bool {
205        *self == SOURCESEL_A::MSC
206    }
207    #[doc = "Checks if the value of the field is `AES`"]
208    #[inline(always)]
209    pub fn is_aes(&self) -> bool {
210        *self == SOURCESEL_A::AES
211    }
212    #[doc = "Checks if the value of the field is `LESENSE`"]
213    #[inline(always)]
214    pub fn is_lesense(&self) -> bool {
215        *self == SOURCESEL_A::LESENSE
216    }
217    #[doc = "Checks if the value of the field is `EBI`"]
218    #[inline(always)]
219    pub fn is_ebi(&self) -> bool {
220        *self == SOURCESEL_A::EBI
221    }
222}
223#[doc = "Field `SOURCESEL` writer - Source Select"]
224pub type SOURCESEL_W<'a> = crate::FieldWriter<'a, u32, CH0_CTRL_SPEC, u8, SOURCESEL_A, 6, 16>;
225impl<'a> SOURCESEL_W<'a> {
226    #[doc = "No source selected"]
227    #[inline(always)]
228    pub fn none(self) -> &'a mut W {
229        self.variant(SOURCESEL_A::NONE)
230    }
231    #[doc = "Analog to Digital Converter 0"]
232    #[inline(always)]
233    pub fn adc0(self) -> &'a mut W {
234        self.variant(SOURCESEL_A::ADC0)
235    }
236    #[doc = "Digital to Analog Converter 0"]
237    #[inline(always)]
238    pub fn dac0(self) -> &'a mut W {
239        self.variant(SOURCESEL_A::DAC0)
240    }
241    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 0"]
242    #[inline(always)]
243    pub fn usart0(self) -> &'a mut W {
244        self.variant(SOURCESEL_A::USART0)
245    }
246    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 1"]
247    #[inline(always)]
248    pub fn usart1(self) -> &'a mut W {
249        self.variant(SOURCESEL_A::USART1)
250    }
251    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 2"]
252    #[inline(always)]
253    pub fn usart2(self) -> &'a mut W {
254        self.variant(SOURCESEL_A::USART2)
255    }
256    #[doc = "Low Energy UART 0"]
257    #[inline(always)]
258    pub fn leuart0(self) -> &'a mut W {
259        self.variant(SOURCESEL_A::LEUART0)
260    }
261    #[doc = "Low Energy UART 1"]
262    #[inline(always)]
263    pub fn leuart1(self) -> &'a mut W {
264        self.variant(SOURCESEL_A::LEUART1)
265    }
266    #[doc = "I2C 0"]
267    #[inline(always)]
268    pub fn i2c0(self) -> &'a mut W {
269        self.variant(SOURCESEL_A::I2C0)
270    }
271    #[doc = "I2C 1"]
272    #[inline(always)]
273    pub fn i2c1(self) -> &'a mut W {
274        self.variant(SOURCESEL_A::I2C1)
275    }
276    #[doc = "Timer 0"]
277    #[inline(always)]
278    pub fn timer0(self) -> &'a mut W {
279        self.variant(SOURCESEL_A::TIMER0)
280    }
281    #[doc = "Timer 1"]
282    #[inline(always)]
283    pub fn timer1(self) -> &'a mut W {
284        self.variant(SOURCESEL_A::TIMER1)
285    }
286    #[doc = "Timer 2"]
287    #[inline(always)]
288    pub fn timer2(self) -> &'a mut W {
289        self.variant(SOURCESEL_A::TIMER2)
290    }
291    #[doc = "Timer 3"]
292    #[inline(always)]
293    pub fn timer3(self) -> &'a mut W {
294        self.variant(SOURCESEL_A::TIMER3)
295    }
296    #[doc = "Universal Asynchronous Receiver/Transmitter 0"]
297    #[inline(always)]
298    pub fn uart0(self) -> &'a mut W {
299        self.variant(SOURCESEL_A::UART0)
300    }
301    #[doc = "Universal Asynchronous Receiver/Transmitter 1"]
302    #[inline(always)]
303    pub fn uart1(self) -> &'a mut W {
304        self.variant(SOURCESEL_A::UART1)
305    }
306    #[doc = "`110000`"]
307    #[inline(always)]
308    pub fn msc(self) -> &'a mut W {
309        self.variant(SOURCESEL_A::MSC)
310    }
311    #[doc = "Advanced Encryption Standard Accelerator"]
312    #[inline(always)]
313    pub fn aes(self) -> &'a mut W {
314        self.variant(SOURCESEL_A::AES)
315    }
316    #[doc = "Low Energy Sensor Interface"]
317    #[inline(always)]
318    pub fn lesense(self) -> &'a mut W {
319        self.variant(SOURCESEL_A::LESENSE)
320    }
321    #[doc = "External Bus Interface"]
322    #[inline(always)]
323    pub fn ebi(self) -> &'a mut W {
324        self.variant(SOURCESEL_A::EBI)
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::new(self)
344    }
345    #[doc = "Bits 16:21 - Source Select"]
346    #[inline(always)]
347    pub fn sourcesel(&mut self) -> SOURCESEL_W {
348        SOURCESEL_W::new(self)
349    }
350    #[doc = "Writes raw bits to the register."]
351    #[inline(always)]
352    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
353        self.0.bits(bits);
354        self
355    }
356}
357#[doc = "Channel Control 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 [ch0_ctrl](index.html) module"]
358pub struct CH0_CTRL_SPEC;
359impl crate::RegisterSpec for CH0_CTRL_SPEC {
360    type Ux = u32;
361}
362#[doc = "`read()` method returns [ch0_ctrl::R](R) reader structure"]
363impl crate::Readable for CH0_CTRL_SPEC {
364    type Reader = R;
365}
366#[doc = "`write(|w| ..)` method takes [ch0_ctrl::W](W) writer structure"]
367impl crate::Writable for CH0_CTRL_SPEC {
368    type Writer = W;
369}
370#[doc = "`reset()` method sets CH0_CTRL to value 0"]
371impl crate::Resettable for CH0_CTRL_SPEC {
372    #[inline(always)]
373    fn reset_value() -> Self::Ux {
374        0
375    }
376}