efm32gg_pac/efm32gg995/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, const O: u8> = crate::FieldWriter<'a, u32, CH0_CTRL_SPEC, u8, u8, 4, O>;
41#[doc = "Field `SOURCESEL` reader - Source Select"]
42pub type SOURCESEL_R = crate::FieldReader<u8, SOURCESEL_A>;
43#[doc = "Source Select\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum SOURCESEL_A {
47    #[doc = "0: No source selected"]
48    NONE = 0,
49    #[doc = "8: Analog to Digital Converter 0"]
50    ADC0 = 8,
51    #[doc = "10: Digital to Analog Converter 0"]
52    DAC0 = 10,
53    #[doc = "12: Universal Synchronous/Asynchronous Receiver/Transmitter 0"]
54    USART0 = 12,
55    #[doc = "13: Universal Synchronous/Asynchronous Receiver/Transmitter 1"]
56    USART1 = 13,
57    #[doc = "14: Universal Synchronous/Asynchronous Receiver/Transmitter 2"]
58    USART2 = 14,
59    #[doc = "16: Low Energy UART 0"]
60    LEUART0 = 16,
61    #[doc = "17: Low Energy UART 1"]
62    LEUART1 = 17,
63    #[doc = "20: I2C 0"]
64    I2C0 = 20,
65    #[doc = "21: I2C 1"]
66    I2C1 = 21,
67    #[doc = "24: Timer 0"]
68    TIMER0 = 24,
69    #[doc = "25: Timer 1"]
70    TIMER1 = 25,
71    #[doc = "26: Timer 2"]
72    TIMER2 = 26,
73    #[doc = "27: Timer 3"]
74    TIMER3 = 27,
75    #[doc = "44: Universal Asynchronous Receiver/Transmitter 0"]
76    UART0 = 44,
77    #[doc = "45: Universal Asynchronous Receiver/Transmitter 1"]
78    UART1 = 45,
79    #[doc = "48: `110000`"]
80    MSC = 48,
81    #[doc = "49: Advanced Encryption Standard Accelerator"]
82    AES = 49,
83    #[doc = "50: Low Energy Sensor Interface"]
84    LESENSE = 50,
85    #[doc = "51: External Bus Interface"]
86    EBI = 51,
87}
88impl From<SOURCESEL_A> for u8 {
89    #[inline(always)]
90    fn from(variant: SOURCESEL_A) -> Self {
91        variant as _
92    }
93}
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, const O: u8> =
225    crate::FieldWriter<'a, u32, CH0_CTRL_SPEC, u8, SOURCESEL_A, 6, O>;
226impl<'a, const O: u8> SOURCESEL_W<'a, O> {
227    #[doc = "No source selected"]
228    #[inline(always)]
229    pub fn none(self) -> &'a mut W {
230        self.variant(SOURCESEL_A::NONE)
231    }
232    #[doc = "Analog to Digital Converter 0"]
233    #[inline(always)]
234    pub fn adc0(self) -> &'a mut W {
235        self.variant(SOURCESEL_A::ADC0)
236    }
237    #[doc = "Digital to Analog Converter 0"]
238    #[inline(always)]
239    pub fn dac0(self) -> &'a mut W {
240        self.variant(SOURCESEL_A::DAC0)
241    }
242    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 0"]
243    #[inline(always)]
244    pub fn usart0(self) -> &'a mut W {
245        self.variant(SOURCESEL_A::USART0)
246    }
247    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 1"]
248    #[inline(always)]
249    pub fn usart1(self) -> &'a mut W {
250        self.variant(SOURCESEL_A::USART1)
251    }
252    #[doc = "Universal Synchronous/Asynchronous Receiver/Transmitter 2"]
253    #[inline(always)]
254    pub fn usart2(self) -> &'a mut W {
255        self.variant(SOURCESEL_A::USART2)
256    }
257    #[doc = "Low Energy UART 0"]
258    #[inline(always)]
259    pub fn leuart0(self) -> &'a mut W {
260        self.variant(SOURCESEL_A::LEUART0)
261    }
262    #[doc = "Low Energy UART 1"]
263    #[inline(always)]
264    pub fn leuart1(self) -> &'a mut W {
265        self.variant(SOURCESEL_A::LEUART1)
266    }
267    #[doc = "I2C 0"]
268    #[inline(always)]
269    pub fn i2c0(self) -> &'a mut W {
270        self.variant(SOURCESEL_A::I2C0)
271    }
272    #[doc = "I2C 1"]
273    #[inline(always)]
274    pub fn i2c1(self) -> &'a mut W {
275        self.variant(SOURCESEL_A::I2C1)
276    }
277    #[doc = "Timer 0"]
278    #[inline(always)]
279    pub fn timer0(self) -> &'a mut W {
280        self.variant(SOURCESEL_A::TIMER0)
281    }
282    #[doc = "Timer 1"]
283    #[inline(always)]
284    pub fn timer1(self) -> &'a mut W {
285        self.variant(SOURCESEL_A::TIMER1)
286    }
287    #[doc = "Timer 2"]
288    #[inline(always)]
289    pub fn timer2(self) -> &'a mut W {
290        self.variant(SOURCESEL_A::TIMER2)
291    }
292    #[doc = "Timer 3"]
293    #[inline(always)]
294    pub fn timer3(self) -> &'a mut W {
295        self.variant(SOURCESEL_A::TIMER3)
296    }
297    #[doc = "Universal Asynchronous Receiver/Transmitter 0"]
298    #[inline(always)]
299    pub fn uart0(self) -> &'a mut W {
300        self.variant(SOURCESEL_A::UART0)
301    }
302    #[doc = "Universal Asynchronous Receiver/Transmitter 1"]
303    #[inline(always)]
304    pub fn uart1(self) -> &'a mut W {
305        self.variant(SOURCESEL_A::UART1)
306    }
307    #[doc = "`110000`"]
308    #[inline(always)]
309    pub fn msc(self) -> &'a mut W {
310        self.variant(SOURCESEL_A::MSC)
311    }
312    #[doc = "Advanced Encryption Standard Accelerator"]
313    #[inline(always)]
314    pub fn aes(self) -> &'a mut W {
315        self.variant(SOURCESEL_A::AES)
316    }
317    #[doc = "Low Energy Sensor Interface"]
318    #[inline(always)]
319    pub fn lesense(self) -> &'a mut W {
320        self.variant(SOURCESEL_A::LESENSE)
321    }
322    #[doc = "External Bus Interface"]
323    #[inline(always)]
324    pub fn ebi(self) -> &'a mut W {
325        self.variant(SOURCESEL_A::EBI)
326    }
327}
328impl R {
329    #[doc = "Bits 0:3 - Signal Select"]
330    #[inline(always)]
331    pub fn sigsel(&self) -> SIGSEL_R {
332        SIGSEL_R::new((self.bits & 0x0f) as u8)
333    }
334    #[doc = "Bits 16:21 - Source Select"]
335    #[inline(always)]
336    pub fn sourcesel(&self) -> SOURCESEL_R {
337        SOURCESEL_R::new(((self.bits >> 16) & 0x3f) as u8)
338    }
339}
340impl W {
341    #[doc = "Bits 0:3 - Signal Select"]
342    #[inline(always)]
343    #[must_use]
344    pub fn sigsel(&mut self) -> SIGSEL_W<0> {
345        SIGSEL_W::new(self)
346    }
347    #[doc = "Bits 16:21 - Source Select"]
348    #[inline(always)]
349    #[must_use]
350    pub fn sourcesel(&mut self) -> SOURCESEL_W<16> {
351        SOURCESEL_W::new(self)
352    }
353    #[doc = "Writes raw bits to the register."]
354    #[inline(always)]
355    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
356        self.0.bits(bits);
357        self
358    }
359}
360#[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"]
361pub struct CH0_CTRL_SPEC;
362impl crate::RegisterSpec for CH0_CTRL_SPEC {
363    type Ux = u32;
364}
365#[doc = "`read()` method returns [ch0_ctrl::R](R) reader structure"]
366impl crate::Readable for CH0_CTRL_SPEC {
367    type Reader = R;
368}
369#[doc = "`write(|w| ..)` method takes [ch0_ctrl::W](W) writer structure"]
370impl crate::Writable for CH0_CTRL_SPEC {
371    type Writer = W;
372    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
373    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
374}
375#[doc = "`reset()` method sets CH0_CTRL to value 0"]
376impl crate::Resettable for CH0_CTRL_SPEC {
377    const RESET_VALUE: Self::Ux = 0;
378}