efm32gg11b310_pac/lesense/
ctrl.rs

1#[doc = "Register `CTRL` reader"]
2pub struct R(crate::R<CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CTRL` writer"]
17pub struct W(crate::W<CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<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<CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Configure Scan Mode\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum SCANMODE_A {
41    #[doc = "0: A new scan is started each time the period counter overflows"]
42    PERIODIC = 0,
43    #[doc = "1: A single scan is performed when START in CMD is set"]
44    ONESHOT = 1,
45    #[doc = "2: Pulse on PRS channel"]
46    PRS = 2,
47}
48impl From<SCANMODE_A> for u8 {
49    #[inline(always)]
50    fn from(variant: SCANMODE_A) -> Self {
51        variant as _
52    }
53}
54#[doc = "Field `SCANMODE` reader - Configure Scan Mode"]
55pub type SCANMODE_R = crate::FieldReader<u8, SCANMODE_A>;
56impl SCANMODE_R {
57    #[doc = "Get enumerated values variant"]
58    #[inline(always)]
59    pub fn variant(&self) -> Option<SCANMODE_A> {
60        match self.bits {
61            0 => Some(SCANMODE_A::PERIODIC),
62            1 => Some(SCANMODE_A::ONESHOT),
63            2 => Some(SCANMODE_A::PRS),
64            _ => None,
65        }
66    }
67    #[doc = "Checks if the value of the field is `PERIODIC`"]
68    #[inline(always)]
69    pub fn is_periodic(&self) -> bool {
70        *self == SCANMODE_A::PERIODIC
71    }
72    #[doc = "Checks if the value of the field is `ONESHOT`"]
73    #[inline(always)]
74    pub fn is_oneshot(&self) -> bool {
75        *self == SCANMODE_A::ONESHOT
76    }
77    #[doc = "Checks if the value of the field is `PRS`"]
78    #[inline(always)]
79    pub fn is_prs(&self) -> bool {
80        *self == SCANMODE_A::PRS
81    }
82}
83#[doc = "Field `SCANMODE` writer - Configure Scan Mode"]
84pub type SCANMODE_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, SCANMODE_A, 2, 0>;
85impl<'a> SCANMODE_W<'a> {
86    #[doc = "A new scan is started each time the period counter overflows"]
87    #[inline(always)]
88    pub fn periodic(self) -> &'a mut W {
89        self.variant(SCANMODE_A::PERIODIC)
90    }
91    #[doc = "A single scan is performed when START in CMD is set"]
92    #[inline(always)]
93    pub fn oneshot(self) -> &'a mut W {
94        self.variant(SCANMODE_A::ONESHOT)
95    }
96    #[doc = "Pulse on PRS channel"]
97    #[inline(always)]
98    pub fn prs(self) -> &'a mut W {
99        self.variant(SCANMODE_A::PRS)
100    }
101}
102#[doc = "Scan Start PRS Select\n\nValue on reset: 0"]
103#[derive(Clone, Copy, Debug, PartialEq)]
104#[repr(u8)]
105pub enum PRSSEL_A {
106    #[doc = "0: PRS Channel 0 selected as input"]
107    PRSCH0 = 0,
108    #[doc = "1: PRS Channel 1 selected as input"]
109    PRSCH1 = 1,
110    #[doc = "2: PRS Channel 2 selected as input"]
111    PRSCH2 = 2,
112    #[doc = "3: PRS Channel 3 selected as input"]
113    PRSCH3 = 3,
114    #[doc = "4: PRS Channel 4 selected as input"]
115    PRSCH4 = 4,
116    #[doc = "5: PRS Channel 5 selected as input"]
117    PRSCH5 = 5,
118    #[doc = "6: PRS Channel 6 selected as input"]
119    PRSCH6 = 6,
120    #[doc = "7: PRS Channel 7 selected as input"]
121    PRSCH7 = 7,
122    #[doc = "8: PRS Channel 8 selected as input"]
123    PRSCH8 = 8,
124    #[doc = "9: PRS Channel 9 selected as input"]
125    PRSCH9 = 9,
126    #[doc = "10: PRS Channel 10 selected as input"]
127    PRSCH10 = 10,
128    #[doc = "11: PRS Channel 11 selected as input"]
129    PRSCH11 = 11,
130    #[doc = "12: PRS Channel 12 selected as input"]
131    PRSCH12 = 12,
132    #[doc = "13: PRS Channel 13 selected as input"]
133    PRSCH13 = 13,
134    #[doc = "14: PRS Channel 14 selected as input"]
135    PRSCH14 = 14,
136    #[doc = "15: PRS Channel 15 selected as input"]
137    PRSCH15 = 15,
138    #[doc = "16: PRS Channel 16 selected as input"]
139    PRSCH16 = 16,
140    #[doc = "17: PRS Channel 17 selected as input"]
141    PRSCH17 = 17,
142    #[doc = "18: PRS Channel 18 selected as input"]
143    PRSCH18 = 18,
144    #[doc = "19: PRS Channel 19 selected as input"]
145    PRSCH19 = 19,
146    #[doc = "20: PRS Channel 20 selected as input"]
147    PRSCH20 = 20,
148    #[doc = "21: PRS Channel 21 selected as input"]
149    PRSCH21 = 21,
150    #[doc = "22: PRS Channel 22 selected as input"]
151    PRSCH22 = 22,
152    #[doc = "23: PRS Channel 23 selected as input"]
153    PRSCH23 = 23,
154}
155impl From<PRSSEL_A> for u8 {
156    #[inline(always)]
157    fn from(variant: PRSSEL_A) -> Self {
158        variant as _
159    }
160}
161#[doc = "Field `PRSSEL` reader - Scan Start PRS Select"]
162pub type PRSSEL_R = crate::FieldReader<u8, PRSSEL_A>;
163impl PRSSEL_R {
164    #[doc = "Get enumerated values variant"]
165    #[inline(always)]
166    pub fn variant(&self) -> Option<PRSSEL_A> {
167        match self.bits {
168            0 => Some(PRSSEL_A::PRSCH0),
169            1 => Some(PRSSEL_A::PRSCH1),
170            2 => Some(PRSSEL_A::PRSCH2),
171            3 => Some(PRSSEL_A::PRSCH3),
172            4 => Some(PRSSEL_A::PRSCH4),
173            5 => Some(PRSSEL_A::PRSCH5),
174            6 => Some(PRSSEL_A::PRSCH6),
175            7 => Some(PRSSEL_A::PRSCH7),
176            8 => Some(PRSSEL_A::PRSCH8),
177            9 => Some(PRSSEL_A::PRSCH9),
178            10 => Some(PRSSEL_A::PRSCH10),
179            11 => Some(PRSSEL_A::PRSCH11),
180            12 => Some(PRSSEL_A::PRSCH12),
181            13 => Some(PRSSEL_A::PRSCH13),
182            14 => Some(PRSSEL_A::PRSCH14),
183            15 => Some(PRSSEL_A::PRSCH15),
184            16 => Some(PRSSEL_A::PRSCH16),
185            17 => Some(PRSSEL_A::PRSCH17),
186            18 => Some(PRSSEL_A::PRSCH18),
187            19 => Some(PRSSEL_A::PRSCH19),
188            20 => Some(PRSSEL_A::PRSCH20),
189            21 => Some(PRSSEL_A::PRSCH21),
190            22 => Some(PRSSEL_A::PRSCH22),
191            23 => Some(PRSSEL_A::PRSCH23),
192            _ => None,
193        }
194    }
195    #[doc = "Checks if the value of the field is `PRSCH0`"]
196    #[inline(always)]
197    pub fn is_prsch0(&self) -> bool {
198        *self == PRSSEL_A::PRSCH0
199    }
200    #[doc = "Checks if the value of the field is `PRSCH1`"]
201    #[inline(always)]
202    pub fn is_prsch1(&self) -> bool {
203        *self == PRSSEL_A::PRSCH1
204    }
205    #[doc = "Checks if the value of the field is `PRSCH2`"]
206    #[inline(always)]
207    pub fn is_prsch2(&self) -> bool {
208        *self == PRSSEL_A::PRSCH2
209    }
210    #[doc = "Checks if the value of the field is `PRSCH3`"]
211    #[inline(always)]
212    pub fn is_prsch3(&self) -> bool {
213        *self == PRSSEL_A::PRSCH3
214    }
215    #[doc = "Checks if the value of the field is `PRSCH4`"]
216    #[inline(always)]
217    pub fn is_prsch4(&self) -> bool {
218        *self == PRSSEL_A::PRSCH4
219    }
220    #[doc = "Checks if the value of the field is `PRSCH5`"]
221    #[inline(always)]
222    pub fn is_prsch5(&self) -> bool {
223        *self == PRSSEL_A::PRSCH5
224    }
225    #[doc = "Checks if the value of the field is `PRSCH6`"]
226    #[inline(always)]
227    pub fn is_prsch6(&self) -> bool {
228        *self == PRSSEL_A::PRSCH6
229    }
230    #[doc = "Checks if the value of the field is `PRSCH7`"]
231    #[inline(always)]
232    pub fn is_prsch7(&self) -> bool {
233        *self == PRSSEL_A::PRSCH7
234    }
235    #[doc = "Checks if the value of the field is `PRSCH8`"]
236    #[inline(always)]
237    pub fn is_prsch8(&self) -> bool {
238        *self == PRSSEL_A::PRSCH8
239    }
240    #[doc = "Checks if the value of the field is `PRSCH9`"]
241    #[inline(always)]
242    pub fn is_prsch9(&self) -> bool {
243        *self == PRSSEL_A::PRSCH9
244    }
245    #[doc = "Checks if the value of the field is `PRSCH10`"]
246    #[inline(always)]
247    pub fn is_prsch10(&self) -> bool {
248        *self == PRSSEL_A::PRSCH10
249    }
250    #[doc = "Checks if the value of the field is `PRSCH11`"]
251    #[inline(always)]
252    pub fn is_prsch11(&self) -> bool {
253        *self == PRSSEL_A::PRSCH11
254    }
255    #[doc = "Checks if the value of the field is `PRSCH12`"]
256    #[inline(always)]
257    pub fn is_prsch12(&self) -> bool {
258        *self == PRSSEL_A::PRSCH12
259    }
260    #[doc = "Checks if the value of the field is `PRSCH13`"]
261    #[inline(always)]
262    pub fn is_prsch13(&self) -> bool {
263        *self == PRSSEL_A::PRSCH13
264    }
265    #[doc = "Checks if the value of the field is `PRSCH14`"]
266    #[inline(always)]
267    pub fn is_prsch14(&self) -> bool {
268        *self == PRSSEL_A::PRSCH14
269    }
270    #[doc = "Checks if the value of the field is `PRSCH15`"]
271    #[inline(always)]
272    pub fn is_prsch15(&self) -> bool {
273        *self == PRSSEL_A::PRSCH15
274    }
275    #[doc = "Checks if the value of the field is `PRSCH16`"]
276    #[inline(always)]
277    pub fn is_prsch16(&self) -> bool {
278        *self == PRSSEL_A::PRSCH16
279    }
280    #[doc = "Checks if the value of the field is `PRSCH17`"]
281    #[inline(always)]
282    pub fn is_prsch17(&self) -> bool {
283        *self == PRSSEL_A::PRSCH17
284    }
285    #[doc = "Checks if the value of the field is `PRSCH18`"]
286    #[inline(always)]
287    pub fn is_prsch18(&self) -> bool {
288        *self == PRSSEL_A::PRSCH18
289    }
290    #[doc = "Checks if the value of the field is `PRSCH19`"]
291    #[inline(always)]
292    pub fn is_prsch19(&self) -> bool {
293        *self == PRSSEL_A::PRSCH19
294    }
295    #[doc = "Checks if the value of the field is `PRSCH20`"]
296    #[inline(always)]
297    pub fn is_prsch20(&self) -> bool {
298        *self == PRSSEL_A::PRSCH20
299    }
300    #[doc = "Checks if the value of the field is `PRSCH21`"]
301    #[inline(always)]
302    pub fn is_prsch21(&self) -> bool {
303        *self == PRSSEL_A::PRSCH21
304    }
305    #[doc = "Checks if the value of the field is `PRSCH22`"]
306    #[inline(always)]
307    pub fn is_prsch22(&self) -> bool {
308        *self == PRSSEL_A::PRSCH22
309    }
310    #[doc = "Checks if the value of the field is `PRSCH23`"]
311    #[inline(always)]
312    pub fn is_prsch23(&self) -> bool {
313        *self == PRSSEL_A::PRSCH23
314    }
315}
316#[doc = "Field `PRSSEL` writer - Scan Start PRS Select"]
317pub type PRSSEL_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, PRSSEL_A, 5, 2>;
318impl<'a> PRSSEL_W<'a> {
319    #[doc = "PRS Channel 0 selected as input"]
320    #[inline(always)]
321    pub fn prsch0(self) -> &'a mut W {
322        self.variant(PRSSEL_A::PRSCH0)
323    }
324    #[doc = "PRS Channel 1 selected as input"]
325    #[inline(always)]
326    pub fn prsch1(self) -> &'a mut W {
327        self.variant(PRSSEL_A::PRSCH1)
328    }
329    #[doc = "PRS Channel 2 selected as input"]
330    #[inline(always)]
331    pub fn prsch2(self) -> &'a mut W {
332        self.variant(PRSSEL_A::PRSCH2)
333    }
334    #[doc = "PRS Channel 3 selected as input"]
335    #[inline(always)]
336    pub fn prsch3(self) -> &'a mut W {
337        self.variant(PRSSEL_A::PRSCH3)
338    }
339    #[doc = "PRS Channel 4 selected as input"]
340    #[inline(always)]
341    pub fn prsch4(self) -> &'a mut W {
342        self.variant(PRSSEL_A::PRSCH4)
343    }
344    #[doc = "PRS Channel 5 selected as input"]
345    #[inline(always)]
346    pub fn prsch5(self) -> &'a mut W {
347        self.variant(PRSSEL_A::PRSCH5)
348    }
349    #[doc = "PRS Channel 6 selected as input"]
350    #[inline(always)]
351    pub fn prsch6(self) -> &'a mut W {
352        self.variant(PRSSEL_A::PRSCH6)
353    }
354    #[doc = "PRS Channel 7 selected as input"]
355    #[inline(always)]
356    pub fn prsch7(self) -> &'a mut W {
357        self.variant(PRSSEL_A::PRSCH7)
358    }
359    #[doc = "PRS Channel 8 selected as input"]
360    #[inline(always)]
361    pub fn prsch8(self) -> &'a mut W {
362        self.variant(PRSSEL_A::PRSCH8)
363    }
364    #[doc = "PRS Channel 9 selected as input"]
365    #[inline(always)]
366    pub fn prsch9(self) -> &'a mut W {
367        self.variant(PRSSEL_A::PRSCH9)
368    }
369    #[doc = "PRS Channel 10 selected as input"]
370    #[inline(always)]
371    pub fn prsch10(self) -> &'a mut W {
372        self.variant(PRSSEL_A::PRSCH10)
373    }
374    #[doc = "PRS Channel 11 selected as input"]
375    #[inline(always)]
376    pub fn prsch11(self) -> &'a mut W {
377        self.variant(PRSSEL_A::PRSCH11)
378    }
379    #[doc = "PRS Channel 12 selected as input"]
380    #[inline(always)]
381    pub fn prsch12(self) -> &'a mut W {
382        self.variant(PRSSEL_A::PRSCH12)
383    }
384    #[doc = "PRS Channel 13 selected as input"]
385    #[inline(always)]
386    pub fn prsch13(self) -> &'a mut W {
387        self.variant(PRSSEL_A::PRSCH13)
388    }
389    #[doc = "PRS Channel 14 selected as input"]
390    #[inline(always)]
391    pub fn prsch14(self) -> &'a mut W {
392        self.variant(PRSSEL_A::PRSCH14)
393    }
394    #[doc = "PRS Channel 15 selected as input"]
395    #[inline(always)]
396    pub fn prsch15(self) -> &'a mut W {
397        self.variant(PRSSEL_A::PRSCH15)
398    }
399    #[doc = "PRS Channel 16 selected as input"]
400    #[inline(always)]
401    pub fn prsch16(self) -> &'a mut W {
402        self.variant(PRSSEL_A::PRSCH16)
403    }
404    #[doc = "PRS Channel 17 selected as input"]
405    #[inline(always)]
406    pub fn prsch17(self) -> &'a mut W {
407        self.variant(PRSSEL_A::PRSCH17)
408    }
409    #[doc = "PRS Channel 18 selected as input"]
410    #[inline(always)]
411    pub fn prsch18(self) -> &'a mut W {
412        self.variant(PRSSEL_A::PRSCH18)
413    }
414    #[doc = "PRS Channel 19 selected as input"]
415    #[inline(always)]
416    pub fn prsch19(self) -> &'a mut W {
417        self.variant(PRSSEL_A::PRSCH19)
418    }
419    #[doc = "PRS Channel 20 selected as input"]
420    #[inline(always)]
421    pub fn prsch20(self) -> &'a mut W {
422        self.variant(PRSSEL_A::PRSCH20)
423    }
424    #[doc = "PRS Channel 21 selected as input"]
425    #[inline(always)]
426    pub fn prsch21(self) -> &'a mut W {
427        self.variant(PRSSEL_A::PRSCH21)
428    }
429    #[doc = "PRS Channel 22 selected as input"]
430    #[inline(always)]
431    pub fn prsch22(self) -> &'a mut W {
432        self.variant(PRSSEL_A::PRSCH22)
433    }
434    #[doc = "PRS Channel 23 selected as input"]
435    #[inline(always)]
436    pub fn prsch23(self) -> &'a mut W {
437        self.variant(PRSSEL_A::PRSCH23)
438    }
439}
440#[doc = "Select Scan Configuration\n\nValue on reset: 0"]
441#[derive(Clone, Copy, Debug, PartialEq)]
442#[repr(u8)]
443pub enum SCANCONF_A {
444    #[doc = "0: The channel configuration register registers used are directly mapped to the channel number."]
445    DIRMAP = 0,
446    #[doc = "1: The channel configuration register registers used are CHX+8_CONF for channels 0-7 and CHX-8_CONF for channels 8-15."]
447    INVMAP = 1,
448    #[doc = "2: The channel configuration register registers used toggles between CHX_CONF and CHX+8_CONF when channel x triggers"]
449    TOGGLE = 2,
450    #[doc = "3: The decoder state defines the CONF registers to be used."]
451    DECDEF = 3,
452}
453impl From<SCANCONF_A> for u8 {
454    #[inline(always)]
455    fn from(variant: SCANCONF_A) -> Self {
456        variant as _
457    }
458}
459#[doc = "Field `SCANCONF` reader - Select Scan Configuration"]
460pub type SCANCONF_R = crate::FieldReader<u8, SCANCONF_A>;
461impl SCANCONF_R {
462    #[doc = "Get enumerated values variant"]
463    #[inline(always)]
464    pub fn variant(&self) -> SCANCONF_A {
465        match self.bits {
466            0 => SCANCONF_A::DIRMAP,
467            1 => SCANCONF_A::INVMAP,
468            2 => SCANCONF_A::TOGGLE,
469            3 => SCANCONF_A::DECDEF,
470            _ => unreachable!(),
471        }
472    }
473    #[doc = "Checks if the value of the field is `DIRMAP`"]
474    #[inline(always)]
475    pub fn is_dirmap(&self) -> bool {
476        *self == SCANCONF_A::DIRMAP
477    }
478    #[doc = "Checks if the value of the field is `INVMAP`"]
479    #[inline(always)]
480    pub fn is_invmap(&self) -> bool {
481        *self == SCANCONF_A::INVMAP
482    }
483    #[doc = "Checks if the value of the field is `TOGGLE`"]
484    #[inline(always)]
485    pub fn is_toggle(&self) -> bool {
486        *self == SCANCONF_A::TOGGLE
487    }
488    #[doc = "Checks if the value of the field is `DECDEF`"]
489    #[inline(always)]
490    pub fn is_decdef(&self) -> bool {
491        *self == SCANCONF_A::DECDEF
492    }
493}
494#[doc = "Field `SCANCONF` writer - Select Scan Configuration"]
495pub type SCANCONF_W<'a> = crate::FieldWriterSafe<'a, u32, CTRL_SPEC, u8, SCANCONF_A, 2, 7>;
496impl<'a> SCANCONF_W<'a> {
497    #[doc = "The channel configuration register registers used are directly mapped to the channel number."]
498    #[inline(always)]
499    pub fn dirmap(self) -> &'a mut W {
500        self.variant(SCANCONF_A::DIRMAP)
501    }
502    #[doc = "The channel configuration register registers used are CHX+8_CONF for channels 0-7 and CHX-8_CONF for channels 8-15."]
503    #[inline(always)]
504    pub fn invmap(self) -> &'a mut W {
505        self.variant(SCANCONF_A::INVMAP)
506    }
507    #[doc = "The channel configuration register registers used toggles between CHX_CONF and CHX+8_CONF when channel x triggers"]
508    #[inline(always)]
509    pub fn toggle(self) -> &'a mut W {
510        self.variant(SCANCONF_A::TOGGLE)
511    }
512    #[doc = "The decoder state defines the CONF registers to be used."]
513    #[inline(always)]
514    pub fn decdef(self) -> &'a mut W {
515        self.variant(SCANCONF_A::DECDEF)
516    }
517}
518#[doc = "Field `ALTEXMAP` reader - Alternative Excitation Map"]
519pub type ALTEXMAP_R = crate::BitReader<bool>;
520#[doc = "Field `ALTEXMAP` writer - Alternative Excitation Map"]
521pub type ALTEXMAP_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 11>;
522#[doc = "Field `DUALSAMPLE` reader - Enable Dual Sample Mode"]
523pub type DUALSAMPLE_R = crate::BitReader<bool>;
524#[doc = "Field `DUALSAMPLE` writer - Enable Dual Sample Mode"]
525pub type DUALSAMPLE_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 13>;
526#[doc = "Field `BUFOW` reader - Result Buffer Overwrite"]
527pub type BUFOW_R = crate::BitReader<bool>;
528#[doc = "Field `BUFOW` writer - Result Buffer Overwrite"]
529pub type BUFOW_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 16>;
530#[doc = "Field `STRSCANRES` reader - Enable Storing of SCANRES"]
531pub type STRSCANRES_R = crate::BitReader<bool>;
532#[doc = "Field `STRSCANRES` writer - Enable Storing of SCANRES"]
533pub type STRSCANRES_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 17>;
534#[doc = "Field `BUFIDL` reader - Result Buffer Interrupt and DMA Trigger Level"]
535pub type BUFIDL_R = crate::BitReader<bool>;
536#[doc = "Field `BUFIDL` writer - Result Buffer Interrupt and DMA Trigger Level"]
537pub type BUFIDL_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 19>;
538#[doc = "DMA Wake-up From EM2\n\nValue on reset: 0"]
539#[derive(Clone, Copy, Debug, PartialEq)]
540#[repr(u8)]
541pub enum DMAWU_A {
542    #[doc = "0: No DMA wake-up from EM2"]
543    DISABLE = 0,
544    #[doc = "1: DMA wake-up from EM2 when data is valid in the result buffer"]
545    BUFDATAV = 1,
546    #[doc = "2: DMA wake-up from EM2 when the result buffer is full/half-full depending on BUFIDL configuration"]
547    BUFLEVEL = 2,
548}
549impl From<DMAWU_A> for u8 {
550    #[inline(always)]
551    fn from(variant: DMAWU_A) -> Self {
552        variant as _
553    }
554}
555#[doc = "Field `DMAWU` reader - DMA Wake-up From EM2"]
556pub type DMAWU_R = crate::FieldReader<u8, DMAWU_A>;
557impl DMAWU_R {
558    #[doc = "Get enumerated values variant"]
559    #[inline(always)]
560    pub fn variant(&self) -> Option<DMAWU_A> {
561        match self.bits {
562            0 => Some(DMAWU_A::DISABLE),
563            1 => Some(DMAWU_A::BUFDATAV),
564            2 => Some(DMAWU_A::BUFLEVEL),
565            _ => None,
566        }
567    }
568    #[doc = "Checks if the value of the field is `DISABLE`"]
569    #[inline(always)]
570    pub fn is_disable(&self) -> bool {
571        *self == DMAWU_A::DISABLE
572    }
573    #[doc = "Checks if the value of the field is `BUFDATAV`"]
574    #[inline(always)]
575    pub fn is_bufdatav(&self) -> bool {
576        *self == DMAWU_A::BUFDATAV
577    }
578    #[doc = "Checks if the value of the field is `BUFLEVEL`"]
579    #[inline(always)]
580    pub fn is_buflevel(&self) -> bool {
581        *self == DMAWU_A::BUFLEVEL
582    }
583}
584#[doc = "Field `DMAWU` writer - DMA Wake-up From EM2"]
585pub type DMAWU_W<'a> = crate::FieldWriter<'a, u32, CTRL_SPEC, u8, DMAWU_A, 2, 20>;
586impl<'a> DMAWU_W<'a> {
587    #[doc = "No DMA wake-up from EM2"]
588    #[inline(always)]
589    pub fn disable(self) -> &'a mut W {
590        self.variant(DMAWU_A::DISABLE)
591    }
592    #[doc = "DMA wake-up from EM2 when data is valid in the result buffer"]
593    #[inline(always)]
594    pub fn bufdatav(self) -> &'a mut W {
595        self.variant(DMAWU_A::BUFDATAV)
596    }
597    #[doc = "DMA wake-up from EM2 when the result buffer is full/half-full depending on BUFIDL configuration"]
598    #[inline(always)]
599    pub fn buflevel(self) -> &'a mut W {
600        self.variant(DMAWU_A::BUFLEVEL)
601    }
602}
603#[doc = "Field `DEBUGRUN` reader - Debug Mode Run Enable"]
604pub type DEBUGRUN_R = crate::BitReader<bool>;
605#[doc = "Field `DEBUGRUN` writer - Debug Mode Run Enable"]
606pub type DEBUGRUN_W<'a> = crate::BitWriter<'a, u32, CTRL_SPEC, bool, 22>;
607impl R {
608    #[doc = "Bits 0:1 - Configure Scan Mode"]
609    #[inline(always)]
610    pub fn scanmode(&self) -> SCANMODE_R {
611        SCANMODE_R::new((self.bits & 3) as u8)
612    }
613    #[doc = "Bits 2:6 - Scan Start PRS Select"]
614    #[inline(always)]
615    pub fn prssel(&self) -> PRSSEL_R {
616        PRSSEL_R::new(((self.bits >> 2) & 0x1f) as u8)
617    }
618    #[doc = "Bits 7:8 - Select Scan Configuration"]
619    #[inline(always)]
620    pub fn scanconf(&self) -> SCANCONF_R {
621        SCANCONF_R::new(((self.bits >> 7) & 3) as u8)
622    }
623    #[doc = "Bit 11 - Alternative Excitation Map"]
624    #[inline(always)]
625    pub fn altexmap(&self) -> ALTEXMAP_R {
626        ALTEXMAP_R::new(((self.bits >> 11) & 1) != 0)
627    }
628    #[doc = "Bit 13 - Enable Dual Sample Mode"]
629    #[inline(always)]
630    pub fn dualsample(&self) -> DUALSAMPLE_R {
631        DUALSAMPLE_R::new(((self.bits >> 13) & 1) != 0)
632    }
633    #[doc = "Bit 16 - Result Buffer Overwrite"]
634    #[inline(always)]
635    pub fn bufow(&self) -> BUFOW_R {
636        BUFOW_R::new(((self.bits >> 16) & 1) != 0)
637    }
638    #[doc = "Bit 17 - Enable Storing of SCANRES"]
639    #[inline(always)]
640    pub fn strscanres(&self) -> STRSCANRES_R {
641        STRSCANRES_R::new(((self.bits >> 17) & 1) != 0)
642    }
643    #[doc = "Bit 19 - Result Buffer Interrupt and DMA Trigger Level"]
644    #[inline(always)]
645    pub fn bufidl(&self) -> BUFIDL_R {
646        BUFIDL_R::new(((self.bits >> 19) & 1) != 0)
647    }
648    #[doc = "Bits 20:21 - DMA Wake-up From EM2"]
649    #[inline(always)]
650    pub fn dmawu(&self) -> DMAWU_R {
651        DMAWU_R::new(((self.bits >> 20) & 3) as u8)
652    }
653    #[doc = "Bit 22 - Debug Mode Run Enable"]
654    #[inline(always)]
655    pub fn debugrun(&self) -> DEBUGRUN_R {
656        DEBUGRUN_R::new(((self.bits >> 22) & 1) != 0)
657    }
658}
659impl W {
660    #[doc = "Bits 0:1 - Configure Scan Mode"]
661    #[inline(always)]
662    pub fn scanmode(&mut self) -> SCANMODE_W {
663        SCANMODE_W::new(self)
664    }
665    #[doc = "Bits 2:6 - Scan Start PRS Select"]
666    #[inline(always)]
667    pub fn prssel(&mut self) -> PRSSEL_W {
668        PRSSEL_W::new(self)
669    }
670    #[doc = "Bits 7:8 - Select Scan Configuration"]
671    #[inline(always)]
672    pub fn scanconf(&mut self) -> SCANCONF_W {
673        SCANCONF_W::new(self)
674    }
675    #[doc = "Bit 11 - Alternative Excitation Map"]
676    #[inline(always)]
677    pub fn altexmap(&mut self) -> ALTEXMAP_W {
678        ALTEXMAP_W::new(self)
679    }
680    #[doc = "Bit 13 - Enable Dual Sample Mode"]
681    #[inline(always)]
682    pub fn dualsample(&mut self) -> DUALSAMPLE_W {
683        DUALSAMPLE_W::new(self)
684    }
685    #[doc = "Bit 16 - Result Buffer Overwrite"]
686    #[inline(always)]
687    pub fn bufow(&mut self) -> BUFOW_W {
688        BUFOW_W::new(self)
689    }
690    #[doc = "Bit 17 - Enable Storing of SCANRES"]
691    #[inline(always)]
692    pub fn strscanres(&mut self) -> STRSCANRES_W {
693        STRSCANRES_W::new(self)
694    }
695    #[doc = "Bit 19 - Result Buffer Interrupt and DMA Trigger Level"]
696    #[inline(always)]
697    pub fn bufidl(&mut self) -> BUFIDL_W {
698        BUFIDL_W::new(self)
699    }
700    #[doc = "Bits 20:21 - DMA Wake-up From EM2"]
701    #[inline(always)]
702    pub fn dmawu(&mut self) -> DMAWU_W {
703        DMAWU_W::new(self)
704    }
705    #[doc = "Bit 22 - Debug Mode Run Enable"]
706    #[inline(always)]
707    pub fn debugrun(&mut self) -> DEBUGRUN_W {
708        DEBUGRUN_W::new(self)
709    }
710    #[doc = "Writes raw bits to the register."]
711    #[inline(always)]
712    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
713        self.0.bits(bits);
714        self
715    }
716}
717#[doc = "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 [ctrl](index.html) module"]
718pub struct CTRL_SPEC;
719impl crate::RegisterSpec for CTRL_SPEC {
720    type Ux = u32;
721}
722#[doc = "`read()` method returns [ctrl::R](R) reader structure"]
723impl crate::Readable for CTRL_SPEC {
724    type Reader = R;
725}
726#[doc = "`write(|w| ..)` method takes [ctrl::W](W) writer structure"]
727impl crate::Writable for CTRL_SPEC {
728    type Writer = W;
729}
730#[doc = "`reset()` method sets CTRL to value 0"]
731impl crate::Resettable for CTRL_SPEC {
732    #[inline(always)]
733    fn reset_value() -> Self::Ux {
734        0
735    }
736}