efm32pg12_pac/lesense/
ctrl.rs

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