s32k118_pac/adc0/
sc2.rs

1#[doc = "Register `SC2` reader"]
2pub struct R(crate::R<SC2_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SC2_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SC2_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SC2_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SC2` writer"]
17pub struct W(crate::W<SC2_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SC2_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<SC2_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SC2_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Voltage Reference Selection\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum REFSEL_A {
41    #[doc = "0: Default voltage reference pin pair, that is, external pins VREFH and VREFL"]
42    _00 = 0,
43    #[doc = "1: Alternate reference voltage, that is, VALTH. This voltage may be additional external pin or internal source depending on the MCU configuration. See the chip configuration information for details specific to this MCU."]
44    _01 = 1,
45}
46impl From<REFSEL_A> for u8 {
47    #[inline(always)]
48    fn from(variant: REFSEL_A) -> Self {
49        variant as _
50    }
51}
52#[doc = "Field `REFSEL` reader - Voltage Reference Selection"]
53pub struct REFSEL_R(crate::FieldReader<u8, REFSEL_A>);
54impl REFSEL_R {
55    #[inline(always)]
56    pub(crate) fn new(bits: u8) -> Self {
57        REFSEL_R(crate::FieldReader::new(bits))
58    }
59    #[doc = r"Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> Option<REFSEL_A> {
62        match self.bits {
63            0 => Some(REFSEL_A::_00),
64            1 => Some(REFSEL_A::_01),
65            _ => None,
66        }
67    }
68    #[doc = "Checks if the value of the field is `_00`"]
69    #[inline(always)]
70    pub fn is_00(&self) -> bool {
71        **self == REFSEL_A::_00
72    }
73    #[doc = "Checks if the value of the field is `_01`"]
74    #[inline(always)]
75    pub fn is_01(&self) -> bool {
76        **self == REFSEL_A::_01
77    }
78}
79impl core::ops::Deref for REFSEL_R {
80    type Target = crate::FieldReader<u8, REFSEL_A>;
81    #[inline(always)]
82    fn deref(&self) -> &Self::Target {
83        &self.0
84    }
85}
86#[doc = "Field `REFSEL` writer - Voltage Reference Selection"]
87pub struct REFSEL_W<'a> {
88    w: &'a mut W,
89}
90impl<'a> REFSEL_W<'a> {
91    #[doc = r"Writes `variant` to the field"]
92    #[inline(always)]
93    pub fn variant(self, variant: REFSEL_A) -> &'a mut W {
94        unsafe { self.bits(variant.into()) }
95    }
96    #[doc = "Default voltage reference pin pair, that is, external pins VREFH and VREFL"]
97    #[inline(always)]
98    pub fn _00(self) -> &'a mut W {
99        self.variant(REFSEL_A::_00)
100    }
101    #[doc = "Alternate reference voltage, that is, VALTH. This voltage may be additional external pin or internal source depending on the MCU configuration. See the chip configuration information for details specific to this MCU."]
102    #[inline(always)]
103    pub fn _01(self) -> &'a mut W {
104        self.variant(REFSEL_A::_01)
105    }
106    #[doc = r"Writes raw bits to the field"]
107    #[inline(always)]
108    pub unsafe fn bits(self, value: u8) -> &'a mut W {
109        self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
110        self.w
111    }
112}
113#[doc = "DMA Enable\n\nValue on reset: 0"]
114#[derive(Clone, Copy, Debug, PartialEq)]
115pub enum DMAEN_A {
116    #[doc = "0: DMA is disabled."]
117    _0 = 0,
118    #[doc = "1: DMA is enabled and will assert the ADC DMA request during an ADC conversion complete event , which is indicated when any SC1n\\[COCO\\]
119flag is asserted."]
120    _1 = 1,
121}
122impl From<DMAEN_A> for bool {
123    #[inline(always)]
124    fn from(variant: DMAEN_A) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `DMAEN` reader - DMA Enable"]
129pub struct DMAEN_R(crate::FieldReader<bool, DMAEN_A>);
130impl DMAEN_R {
131    #[inline(always)]
132    pub(crate) fn new(bits: bool) -> Self {
133        DMAEN_R(crate::FieldReader::new(bits))
134    }
135    #[doc = r"Get enumerated values variant"]
136    #[inline(always)]
137    pub fn variant(&self) -> DMAEN_A {
138        match self.bits {
139            false => DMAEN_A::_0,
140            true => DMAEN_A::_1,
141        }
142    }
143    #[doc = "Checks if the value of the field is `_0`"]
144    #[inline(always)]
145    pub fn is_0(&self) -> bool {
146        **self == DMAEN_A::_0
147    }
148    #[doc = "Checks if the value of the field is `_1`"]
149    #[inline(always)]
150    pub fn is_1(&self) -> bool {
151        **self == DMAEN_A::_1
152    }
153}
154impl core::ops::Deref for DMAEN_R {
155    type Target = crate::FieldReader<bool, DMAEN_A>;
156    #[inline(always)]
157    fn deref(&self) -> &Self::Target {
158        &self.0
159    }
160}
161#[doc = "Field `DMAEN` writer - DMA Enable"]
162pub struct DMAEN_W<'a> {
163    w: &'a mut W,
164}
165impl<'a> DMAEN_W<'a> {
166    #[doc = r"Writes `variant` to the field"]
167    #[inline(always)]
168    pub fn variant(self, variant: DMAEN_A) -> &'a mut W {
169        self.bit(variant.into())
170    }
171    #[doc = "DMA is disabled."]
172    #[inline(always)]
173    pub fn _0(self) -> &'a mut W {
174        self.variant(DMAEN_A::_0)
175    }
176    #[doc = "DMA is enabled and will assert the ADC DMA request during an ADC conversion complete event , which is indicated when any SC1n\\[COCO\\]
177flag is asserted."]
178    #[inline(always)]
179    pub fn _1(self) -> &'a mut W {
180        self.variant(DMAEN_A::_1)
181    }
182    #[doc = r"Sets the field bit"]
183    #[inline(always)]
184    pub fn set_bit(self) -> &'a mut W {
185        self.bit(true)
186    }
187    #[doc = r"Clears the field bit"]
188    #[inline(always)]
189    pub fn clear_bit(self) -> &'a mut W {
190        self.bit(false)
191    }
192    #[doc = r"Writes raw bits to the field"]
193    #[inline(always)]
194    pub fn bit(self, value: bool) -> &'a mut W {
195        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
196        self.w
197    }
198}
199#[doc = "Field `ACREN` reader - Compare Function Range Enable"]
200pub struct ACREN_R(crate::FieldReader<bool, bool>);
201impl ACREN_R {
202    #[inline(always)]
203    pub(crate) fn new(bits: bool) -> Self {
204        ACREN_R(crate::FieldReader::new(bits))
205    }
206}
207impl core::ops::Deref for ACREN_R {
208    type Target = crate::FieldReader<bool, bool>;
209    #[inline(always)]
210    fn deref(&self) -> &Self::Target {
211        &self.0
212    }
213}
214#[doc = "Field `ACREN` writer - Compare Function Range Enable"]
215pub struct ACREN_W<'a> {
216    w: &'a mut W,
217}
218impl<'a> ACREN_W<'a> {
219    #[doc = r"Sets the field bit"]
220    #[inline(always)]
221    pub fn set_bit(self) -> &'a mut W {
222        self.bit(true)
223    }
224    #[doc = r"Clears the field bit"]
225    #[inline(always)]
226    pub fn clear_bit(self) -> &'a mut W {
227        self.bit(false)
228    }
229    #[doc = r"Writes raw bits to the field"]
230    #[inline(always)]
231    pub fn bit(self, value: bool) -> &'a mut W {
232        self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
233        self.w
234    }
235}
236#[doc = "Field `ACFGT` reader - Compare Function Greater Than Enable"]
237pub struct ACFGT_R(crate::FieldReader<bool, bool>);
238impl ACFGT_R {
239    #[inline(always)]
240    pub(crate) fn new(bits: bool) -> Self {
241        ACFGT_R(crate::FieldReader::new(bits))
242    }
243}
244impl core::ops::Deref for ACFGT_R {
245    type Target = crate::FieldReader<bool, bool>;
246    #[inline(always)]
247    fn deref(&self) -> &Self::Target {
248        &self.0
249    }
250}
251#[doc = "Field `ACFGT` writer - Compare Function Greater Than Enable"]
252pub struct ACFGT_W<'a> {
253    w: &'a mut W,
254}
255impl<'a> ACFGT_W<'a> {
256    #[doc = r"Sets the field bit"]
257    #[inline(always)]
258    pub fn set_bit(self) -> &'a mut W {
259        self.bit(true)
260    }
261    #[doc = r"Clears the field bit"]
262    #[inline(always)]
263    pub fn clear_bit(self) -> &'a mut W {
264        self.bit(false)
265    }
266    #[doc = r"Writes raw bits to the field"]
267    #[inline(always)]
268    pub fn bit(self, value: bool) -> &'a mut W {
269        self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
270        self.w
271    }
272}
273#[doc = "Compare Function Enable\n\nValue on reset: 0"]
274#[derive(Clone, Copy, Debug, PartialEq)]
275pub enum ACFE_A {
276    #[doc = "0: Compare function disabled."]
277    _0 = 0,
278    #[doc = "1: Compare function enabled."]
279    _1 = 1,
280}
281impl From<ACFE_A> for bool {
282    #[inline(always)]
283    fn from(variant: ACFE_A) -> Self {
284        variant as u8 != 0
285    }
286}
287#[doc = "Field `ACFE` reader - Compare Function Enable"]
288pub struct ACFE_R(crate::FieldReader<bool, ACFE_A>);
289impl ACFE_R {
290    #[inline(always)]
291    pub(crate) fn new(bits: bool) -> Self {
292        ACFE_R(crate::FieldReader::new(bits))
293    }
294    #[doc = r"Get enumerated values variant"]
295    #[inline(always)]
296    pub fn variant(&self) -> ACFE_A {
297        match self.bits {
298            false => ACFE_A::_0,
299            true => ACFE_A::_1,
300        }
301    }
302    #[doc = "Checks if the value of the field is `_0`"]
303    #[inline(always)]
304    pub fn is_0(&self) -> bool {
305        **self == ACFE_A::_0
306    }
307    #[doc = "Checks if the value of the field is `_1`"]
308    #[inline(always)]
309    pub fn is_1(&self) -> bool {
310        **self == ACFE_A::_1
311    }
312}
313impl core::ops::Deref for ACFE_R {
314    type Target = crate::FieldReader<bool, ACFE_A>;
315    #[inline(always)]
316    fn deref(&self) -> &Self::Target {
317        &self.0
318    }
319}
320#[doc = "Field `ACFE` writer - Compare Function Enable"]
321pub struct ACFE_W<'a> {
322    w: &'a mut W,
323}
324impl<'a> ACFE_W<'a> {
325    #[doc = r"Writes `variant` to the field"]
326    #[inline(always)]
327    pub fn variant(self, variant: ACFE_A) -> &'a mut W {
328        self.bit(variant.into())
329    }
330    #[doc = "Compare function disabled."]
331    #[inline(always)]
332    pub fn _0(self) -> &'a mut W {
333        self.variant(ACFE_A::_0)
334    }
335    #[doc = "Compare function enabled."]
336    #[inline(always)]
337    pub fn _1(self) -> &'a mut W {
338        self.variant(ACFE_A::_1)
339    }
340    #[doc = r"Sets the field bit"]
341    #[inline(always)]
342    pub fn set_bit(self) -> &'a mut W {
343        self.bit(true)
344    }
345    #[doc = r"Clears the field bit"]
346    #[inline(always)]
347    pub fn clear_bit(self) -> &'a mut W {
348        self.bit(false)
349    }
350    #[doc = r"Writes raw bits to the field"]
351    #[inline(always)]
352    pub fn bit(self, value: bool) -> &'a mut W {
353        self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
354        self.w
355    }
356}
357#[doc = "Conversion Trigger Select\n\nValue on reset: 0"]
358#[derive(Clone, Copy, Debug, PartialEq)]
359pub enum ADTRG_A {
360    #[doc = "0: Software trigger selected."]
361    _0 = 0,
362    #[doc = "1: Hardware trigger selected."]
363    _1 = 1,
364}
365impl From<ADTRG_A> for bool {
366    #[inline(always)]
367    fn from(variant: ADTRG_A) -> Self {
368        variant as u8 != 0
369    }
370}
371#[doc = "Field `ADTRG` reader - Conversion Trigger Select"]
372pub struct ADTRG_R(crate::FieldReader<bool, ADTRG_A>);
373impl ADTRG_R {
374    #[inline(always)]
375    pub(crate) fn new(bits: bool) -> Self {
376        ADTRG_R(crate::FieldReader::new(bits))
377    }
378    #[doc = r"Get enumerated values variant"]
379    #[inline(always)]
380    pub fn variant(&self) -> ADTRG_A {
381        match self.bits {
382            false => ADTRG_A::_0,
383            true => ADTRG_A::_1,
384        }
385    }
386    #[doc = "Checks if the value of the field is `_0`"]
387    #[inline(always)]
388    pub fn is_0(&self) -> bool {
389        **self == ADTRG_A::_0
390    }
391    #[doc = "Checks if the value of the field is `_1`"]
392    #[inline(always)]
393    pub fn is_1(&self) -> bool {
394        **self == ADTRG_A::_1
395    }
396}
397impl core::ops::Deref for ADTRG_R {
398    type Target = crate::FieldReader<bool, ADTRG_A>;
399    #[inline(always)]
400    fn deref(&self) -> &Self::Target {
401        &self.0
402    }
403}
404#[doc = "Field `ADTRG` writer - Conversion Trigger Select"]
405pub struct ADTRG_W<'a> {
406    w: &'a mut W,
407}
408impl<'a> ADTRG_W<'a> {
409    #[doc = r"Writes `variant` to the field"]
410    #[inline(always)]
411    pub fn variant(self, variant: ADTRG_A) -> &'a mut W {
412        self.bit(variant.into())
413    }
414    #[doc = "Software trigger selected."]
415    #[inline(always)]
416    pub fn _0(self) -> &'a mut W {
417        self.variant(ADTRG_A::_0)
418    }
419    #[doc = "Hardware trigger selected."]
420    #[inline(always)]
421    pub fn _1(self) -> &'a mut W {
422        self.variant(ADTRG_A::_1)
423    }
424    #[doc = r"Sets the field bit"]
425    #[inline(always)]
426    pub fn set_bit(self) -> &'a mut W {
427        self.bit(true)
428    }
429    #[doc = r"Clears the field bit"]
430    #[inline(always)]
431    pub fn clear_bit(self) -> &'a mut W {
432        self.bit(false)
433    }
434    #[doc = r"Writes raw bits to the field"]
435    #[inline(always)]
436    pub fn bit(self, value: bool) -> &'a mut W {
437        self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
438        self.w
439    }
440}
441#[doc = "Conversion Active\n\nValue on reset: 0"]
442#[derive(Clone, Copy, Debug, PartialEq)]
443pub enum ADACT_A {
444    #[doc = "0: Conversion not in progress."]
445    _0 = 0,
446    #[doc = "1: Conversion in progress."]
447    _1 = 1,
448}
449impl From<ADACT_A> for bool {
450    #[inline(always)]
451    fn from(variant: ADACT_A) -> Self {
452        variant as u8 != 0
453    }
454}
455#[doc = "Field `ADACT` reader - Conversion Active"]
456pub struct ADACT_R(crate::FieldReader<bool, ADACT_A>);
457impl ADACT_R {
458    #[inline(always)]
459    pub(crate) fn new(bits: bool) -> Self {
460        ADACT_R(crate::FieldReader::new(bits))
461    }
462    #[doc = r"Get enumerated values variant"]
463    #[inline(always)]
464    pub fn variant(&self) -> ADACT_A {
465        match self.bits {
466            false => ADACT_A::_0,
467            true => ADACT_A::_1,
468        }
469    }
470    #[doc = "Checks if the value of the field is `_0`"]
471    #[inline(always)]
472    pub fn is_0(&self) -> bool {
473        **self == ADACT_A::_0
474    }
475    #[doc = "Checks if the value of the field is `_1`"]
476    #[inline(always)]
477    pub fn is_1(&self) -> bool {
478        **self == ADACT_A::_1
479    }
480}
481impl core::ops::Deref for ADACT_R {
482    type Target = crate::FieldReader<bool, ADACT_A>;
483    #[inline(always)]
484    fn deref(&self) -> &Self::Target {
485        &self.0
486    }
487}
488#[doc = "Field `TRGPRNUM` reader - Trigger Process Number"]
489pub struct TRGPRNUM_R(crate::FieldReader<u8, u8>);
490impl TRGPRNUM_R {
491    #[inline(always)]
492    pub(crate) fn new(bits: u8) -> Self {
493        TRGPRNUM_R(crate::FieldReader::new(bits))
494    }
495}
496impl core::ops::Deref for TRGPRNUM_R {
497    type Target = crate::FieldReader<u8, u8>;
498    #[inline(always)]
499    fn deref(&self) -> &Self::Target {
500        &self.0
501    }
502}
503#[doc = "Trigger Status\n\nValue on reset: 0"]
504#[derive(Clone, Copy, Debug, PartialEq)]
505#[repr(u8)]
506pub enum TRGSTLAT_A {
507    #[doc = "0: No trigger request has been latched"]
508    _0 = 0,
509    #[doc = "1: A trigger request has been latched"]
510    _1 = 1,
511}
512impl From<TRGSTLAT_A> for u8 {
513    #[inline(always)]
514    fn from(variant: TRGSTLAT_A) -> Self {
515        variant as _
516    }
517}
518#[doc = "Field `TRGSTLAT` reader - Trigger Status"]
519pub struct TRGSTLAT_R(crate::FieldReader<u8, TRGSTLAT_A>);
520impl TRGSTLAT_R {
521    #[inline(always)]
522    pub(crate) fn new(bits: u8) -> Self {
523        TRGSTLAT_R(crate::FieldReader::new(bits))
524    }
525    #[doc = r"Get enumerated values variant"]
526    #[inline(always)]
527    pub fn variant(&self) -> Option<TRGSTLAT_A> {
528        match self.bits {
529            0 => Some(TRGSTLAT_A::_0),
530            1 => Some(TRGSTLAT_A::_1),
531            _ => None,
532        }
533    }
534    #[doc = "Checks if the value of the field is `_0`"]
535    #[inline(always)]
536    pub fn is_0(&self) -> bool {
537        **self == TRGSTLAT_A::_0
538    }
539    #[doc = "Checks if the value of the field is `_1`"]
540    #[inline(always)]
541    pub fn is_1(&self) -> bool {
542        **self == TRGSTLAT_A::_1
543    }
544}
545impl core::ops::Deref for TRGSTLAT_R {
546    type Target = crate::FieldReader<u8, TRGSTLAT_A>;
547    #[inline(always)]
548    fn deref(&self) -> &Self::Target {
549        &self.0
550    }
551}
552#[doc = "Error in Multiplexed Trigger Request\n\nValue on reset: 0"]
553#[derive(Clone, Copy, Debug, PartialEq)]
554#[repr(u8)]
555pub enum TRGSTERR_A {
556    #[doc = "0: No error has occurred"]
557    _0 = 0,
558    #[doc = "1: An error has occurred"]
559    _1 = 1,
560}
561impl From<TRGSTERR_A> for u8 {
562    #[inline(always)]
563    fn from(variant: TRGSTERR_A) -> Self {
564        variant as _
565    }
566}
567#[doc = "Field `TRGSTERR` reader - Error in Multiplexed Trigger Request"]
568pub struct TRGSTERR_R(crate::FieldReader<u8, TRGSTERR_A>);
569impl TRGSTERR_R {
570    #[inline(always)]
571    pub(crate) fn new(bits: u8) -> Self {
572        TRGSTERR_R(crate::FieldReader::new(bits))
573    }
574    #[doc = r"Get enumerated values variant"]
575    #[inline(always)]
576    pub fn variant(&self) -> Option<TRGSTERR_A> {
577        match self.bits {
578            0 => Some(TRGSTERR_A::_0),
579            1 => Some(TRGSTERR_A::_1),
580            _ => None,
581        }
582    }
583    #[doc = "Checks if the value of the field is `_0`"]
584    #[inline(always)]
585    pub fn is_0(&self) -> bool {
586        **self == TRGSTERR_A::_0
587    }
588    #[doc = "Checks if the value of the field is `_1`"]
589    #[inline(always)]
590    pub fn is_1(&self) -> bool {
591        **self == TRGSTERR_A::_1
592    }
593}
594impl core::ops::Deref for TRGSTERR_R {
595    type Target = crate::FieldReader<u8, TRGSTERR_A>;
596    #[inline(always)]
597    fn deref(&self) -> &Self::Target {
598        &self.0
599    }
600}
601impl R {
602    #[doc = "Bits 0:1 - Voltage Reference Selection"]
603    #[inline(always)]
604    pub fn refsel(&self) -> REFSEL_R {
605        REFSEL_R::new((self.bits & 0x03) as u8)
606    }
607    #[doc = "Bit 2 - DMA Enable"]
608    #[inline(always)]
609    pub fn dmaen(&self) -> DMAEN_R {
610        DMAEN_R::new(((self.bits >> 2) & 0x01) != 0)
611    }
612    #[doc = "Bit 3 - Compare Function Range Enable"]
613    #[inline(always)]
614    pub fn acren(&self) -> ACREN_R {
615        ACREN_R::new(((self.bits >> 3) & 0x01) != 0)
616    }
617    #[doc = "Bit 4 - Compare Function Greater Than Enable"]
618    #[inline(always)]
619    pub fn acfgt(&self) -> ACFGT_R {
620        ACFGT_R::new(((self.bits >> 4) & 0x01) != 0)
621    }
622    #[doc = "Bit 5 - Compare Function Enable"]
623    #[inline(always)]
624    pub fn acfe(&self) -> ACFE_R {
625        ACFE_R::new(((self.bits >> 5) & 0x01) != 0)
626    }
627    #[doc = "Bit 6 - Conversion Trigger Select"]
628    #[inline(always)]
629    pub fn adtrg(&self) -> ADTRG_R {
630        ADTRG_R::new(((self.bits >> 6) & 0x01) != 0)
631    }
632    #[doc = "Bit 7 - Conversion Active"]
633    #[inline(always)]
634    pub fn adact(&self) -> ADACT_R {
635        ADACT_R::new(((self.bits >> 7) & 0x01) != 0)
636    }
637    #[doc = "Bits 13:14 - Trigger Process Number"]
638    #[inline(always)]
639    pub fn trgprnum(&self) -> TRGPRNUM_R {
640        TRGPRNUM_R::new(((self.bits >> 13) & 0x03) as u8)
641    }
642    #[doc = "Bits 16:19 - Trigger Status"]
643    #[inline(always)]
644    pub fn trgstlat(&self) -> TRGSTLAT_R {
645        TRGSTLAT_R::new(((self.bits >> 16) & 0x0f) as u8)
646    }
647    #[doc = "Bits 24:27 - Error in Multiplexed Trigger Request"]
648    #[inline(always)]
649    pub fn trgsterr(&self) -> TRGSTERR_R {
650        TRGSTERR_R::new(((self.bits >> 24) & 0x0f) as u8)
651    }
652}
653impl W {
654    #[doc = "Bits 0:1 - Voltage Reference Selection"]
655    #[inline(always)]
656    pub fn refsel(&mut self) -> REFSEL_W {
657        REFSEL_W { w: self }
658    }
659    #[doc = "Bit 2 - DMA Enable"]
660    #[inline(always)]
661    pub fn dmaen(&mut self) -> DMAEN_W {
662        DMAEN_W { w: self }
663    }
664    #[doc = "Bit 3 - Compare Function Range Enable"]
665    #[inline(always)]
666    pub fn acren(&mut self) -> ACREN_W {
667        ACREN_W { w: self }
668    }
669    #[doc = "Bit 4 - Compare Function Greater Than Enable"]
670    #[inline(always)]
671    pub fn acfgt(&mut self) -> ACFGT_W {
672        ACFGT_W { w: self }
673    }
674    #[doc = "Bit 5 - Compare Function Enable"]
675    #[inline(always)]
676    pub fn acfe(&mut self) -> ACFE_W {
677        ACFE_W { w: self }
678    }
679    #[doc = "Bit 6 - Conversion Trigger Select"]
680    #[inline(always)]
681    pub fn adtrg(&mut self) -> ADTRG_W {
682        ADTRG_W { w: self }
683    }
684    #[doc = "Writes raw bits to the register."]
685    #[inline(always)]
686    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
687        self.0.bits(bits);
688        self
689    }
690}
691#[doc = "Status and Control Register 2\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 [sc2](index.html) module"]
692pub struct SC2_SPEC;
693impl crate::RegisterSpec for SC2_SPEC {
694    type Ux = u32;
695}
696#[doc = "`read()` method returns [sc2::R](R) reader structure"]
697impl crate::Readable for SC2_SPEC {
698    type Reader = R;
699}
700#[doc = "`write(|w| ..)` method takes [sc2::W](W) writer structure"]
701impl crate::Writable for SC2_SPEC {
702    type Writer = W;
703}
704#[doc = "`reset()` method sets SC2 to value 0"]
705impl crate::Resettable for SC2_SPEC {
706    #[inline(always)]
707    fn reset_value() -> Self::Ux {
708        0
709    }
710}