max32660_pac/smon/
extscn.rs

1#[doc = "Register `EXTSCN` reader"]
2pub struct R(crate::R<EXTSCN_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<EXTSCN_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<EXTSCN_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<EXTSCN_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `EXTSCN` writer"]
17pub struct W(crate::W<EXTSCN_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<EXTSCN_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<EXTSCN_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<EXTSCN_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "External Sensor Enable for input/output pair 0.\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum EXTS_EN0_A {
40    #[doc = "0: Disable."]
41    DIS = 0,
42    #[doc = "1: Enable."]
43    EN = 1,
44}
45impl From<EXTS_EN0_A> for bool {
46    #[inline(always)]
47    fn from(variant: EXTS_EN0_A) -> Self {
48        variant as u8 != 0
49    }
50}
51#[doc = "Field `EXTS_EN0` reader - External Sensor Enable for input/output pair 0."]
52pub struct EXTS_EN0_R(crate::FieldReader<bool, EXTS_EN0_A>);
53impl EXTS_EN0_R {
54    #[inline(always)]
55    pub(crate) fn new(bits: bool) -> Self {
56        EXTS_EN0_R(crate::FieldReader::new(bits))
57    }
58    #[doc = r"Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> EXTS_EN0_A {
61        match self.bits {
62            false => EXTS_EN0_A::DIS,
63            true => EXTS_EN0_A::EN,
64        }
65    }
66    #[doc = "Checks if the value of the field is `DIS`"]
67    #[inline(always)]
68    pub fn is_dis(&self) -> bool {
69        **self == EXTS_EN0_A::DIS
70    }
71    #[doc = "Checks if the value of the field is `EN`"]
72    #[inline(always)]
73    pub fn is_en(&self) -> bool {
74        **self == EXTS_EN0_A::EN
75    }
76}
77impl core::ops::Deref for EXTS_EN0_R {
78    type Target = crate::FieldReader<bool, EXTS_EN0_A>;
79    #[inline(always)]
80    fn deref(&self) -> &Self::Target {
81        &self.0
82    }
83}
84#[doc = "Field `EXTS_EN0` writer - External Sensor Enable for input/output pair 0."]
85pub struct EXTS_EN0_W<'a> {
86    w: &'a mut W,
87}
88impl<'a> EXTS_EN0_W<'a> {
89    #[doc = r"Writes `variant` to the field"]
90    #[inline(always)]
91    pub fn variant(self, variant: EXTS_EN0_A) -> &'a mut W {
92        self.bit(variant.into())
93    }
94    #[doc = "Disable."]
95    #[inline(always)]
96    pub fn dis(self) -> &'a mut W {
97        self.variant(EXTS_EN0_A::DIS)
98    }
99    #[doc = "Enable."]
100    #[inline(always)]
101    pub fn en(self) -> &'a mut W {
102        self.variant(EXTS_EN0_A::EN)
103    }
104    #[doc = r"Sets the field bit"]
105    #[inline(always)]
106    pub fn set_bit(self) -> &'a mut W {
107        self.bit(true)
108    }
109    #[doc = r"Clears the field bit"]
110    #[inline(always)]
111    pub fn clear_bit(self) -> &'a mut W {
112        self.bit(false)
113    }
114    #[doc = r"Writes raw bits to the field"]
115    #[inline(always)]
116    pub fn bit(self, value: bool) -> &'a mut W {
117        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
118        self.w
119    }
120}
121#[doc = "External Sensor Enable for input/output pair 1.\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123pub enum EXTS_EN1_A {
124    #[doc = "0: Disable."]
125    DIS = 0,
126    #[doc = "1: Enable."]
127    EN = 1,
128}
129impl From<EXTS_EN1_A> for bool {
130    #[inline(always)]
131    fn from(variant: EXTS_EN1_A) -> Self {
132        variant as u8 != 0
133    }
134}
135#[doc = "Field `EXTS_EN1` reader - External Sensor Enable for input/output pair 1."]
136pub struct EXTS_EN1_R(crate::FieldReader<bool, EXTS_EN1_A>);
137impl EXTS_EN1_R {
138    #[inline(always)]
139    pub(crate) fn new(bits: bool) -> Self {
140        EXTS_EN1_R(crate::FieldReader::new(bits))
141    }
142    #[doc = r"Get enumerated values variant"]
143    #[inline(always)]
144    pub fn variant(&self) -> EXTS_EN1_A {
145        match self.bits {
146            false => EXTS_EN1_A::DIS,
147            true => EXTS_EN1_A::EN,
148        }
149    }
150    #[doc = "Checks if the value of the field is `DIS`"]
151    #[inline(always)]
152    pub fn is_dis(&self) -> bool {
153        **self == EXTS_EN1_A::DIS
154    }
155    #[doc = "Checks if the value of the field is `EN`"]
156    #[inline(always)]
157    pub fn is_en(&self) -> bool {
158        **self == EXTS_EN1_A::EN
159    }
160}
161impl core::ops::Deref for EXTS_EN1_R {
162    type Target = crate::FieldReader<bool, EXTS_EN1_A>;
163    #[inline(always)]
164    fn deref(&self) -> &Self::Target {
165        &self.0
166    }
167}
168#[doc = "Field `EXTS_EN1` writer - External Sensor Enable for input/output pair 1."]
169pub struct EXTS_EN1_W<'a> {
170    w: &'a mut W,
171}
172impl<'a> EXTS_EN1_W<'a> {
173    #[doc = r"Writes `variant` to the field"]
174    #[inline(always)]
175    pub fn variant(self, variant: EXTS_EN1_A) -> &'a mut W {
176        self.bit(variant.into())
177    }
178    #[doc = "Disable."]
179    #[inline(always)]
180    pub fn dis(self) -> &'a mut W {
181        self.variant(EXTS_EN1_A::DIS)
182    }
183    #[doc = "Enable."]
184    #[inline(always)]
185    pub fn en(self) -> &'a mut W {
186        self.variant(EXTS_EN1_A::EN)
187    }
188    #[doc = r"Sets the field bit"]
189    #[inline(always)]
190    pub fn set_bit(self) -> &'a mut W {
191        self.bit(true)
192    }
193    #[doc = r"Clears the field bit"]
194    #[inline(always)]
195    pub fn clear_bit(self) -> &'a mut W {
196        self.bit(false)
197    }
198    #[doc = r"Writes raw bits to the field"]
199    #[inline(always)]
200    pub fn bit(self, value: bool) -> &'a mut W {
201        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
202        self.w
203    }
204}
205#[doc = "External Sensor Enable for input/output pair 2.\n\nValue on reset: 0"]
206#[derive(Clone, Copy, Debug, PartialEq)]
207pub enum EXTS_EN2_A {
208    #[doc = "0: Disable."]
209    DIS = 0,
210    #[doc = "1: Enable."]
211    EN = 1,
212}
213impl From<EXTS_EN2_A> for bool {
214    #[inline(always)]
215    fn from(variant: EXTS_EN2_A) -> Self {
216        variant as u8 != 0
217    }
218}
219#[doc = "Field `EXTS_EN2` reader - External Sensor Enable for input/output pair 2."]
220pub struct EXTS_EN2_R(crate::FieldReader<bool, EXTS_EN2_A>);
221impl EXTS_EN2_R {
222    #[inline(always)]
223    pub(crate) fn new(bits: bool) -> Self {
224        EXTS_EN2_R(crate::FieldReader::new(bits))
225    }
226    #[doc = r"Get enumerated values variant"]
227    #[inline(always)]
228    pub fn variant(&self) -> EXTS_EN2_A {
229        match self.bits {
230            false => EXTS_EN2_A::DIS,
231            true => EXTS_EN2_A::EN,
232        }
233    }
234    #[doc = "Checks if the value of the field is `DIS`"]
235    #[inline(always)]
236    pub fn is_dis(&self) -> bool {
237        **self == EXTS_EN2_A::DIS
238    }
239    #[doc = "Checks if the value of the field is `EN`"]
240    #[inline(always)]
241    pub fn is_en(&self) -> bool {
242        **self == EXTS_EN2_A::EN
243    }
244}
245impl core::ops::Deref for EXTS_EN2_R {
246    type Target = crate::FieldReader<bool, EXTS_EN2_A>;
247    #[inline(always)]
248    fn deref(&self) -> &Self::Target {
249        &self.0
250    }
251}
252#[doc = "Field `EXTS_EN2` writer - External Sensor Enable for input/output pair 2."]
253pub struct EXTS_EN2_W<'a> {
254    w: &'a mut W,
255}
256impl<'a> EXTS_EN2_W<'a> {
257    #[doc = r"Writes `variant` to the field"]
258    #[inline(always)]
259    pub fn variant(self, variant: EXTS_EN2_A) -> &'a mut W {
260        self.bit(variant.into())
261    }
262    #[doc = "Disable."]
263    #[inline(always)]
264    pub fn dis(self) -> &'a mut W {
265        self.variant(EXTS_EN2_A::DIS)
266    }
267    #[doc = "Enable."]
268    #[inline(always)]
269    pub fn en(self) -> &'a mut W {
270        self.variant(EXTS_EN2_A::EN)
271    }
272    #[doc = r"Sets the field bit"]
273    #[inline(always)]
274    pub fn set_bit(self) -> &'a mut W {
275        self.bit(true)
276    }
277    #[doc = r"Clears the field bit"]
278    #[inline(always)]
279    pub fn clear_bit(self) -> &'a mut W {
280        self.bit(false)
281    }
282    #[doc = r"Writes raw bits to the field"]
283    #[inline(always)]
284    pub fn bit(self, value: bool) -> &'a mut W {
285        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
286        self.w
287    }
288}
289#[doc = "External Sensor Enable for input/output pair 3.\n\nValue on reset: 0"]
290#[derive(Clone, Copy, Debug, PartialEq)]
291pub enum EXTS_EN3_A {
292    #[doc = "0: Disable."]
293    DIS = 0,
294    #[doc = "1: Enable."]
295    EN = 1,
296}
297impl From<EXTS_EN3_A> for bool {
298    #[inline(always)]
299    fn from(variant: EXTS_EN3_A) -> Self {
300        variant as u8 != 0
301    }
302}
303#[doc = "Field `EXTS_EN3` reader - External Sensor Enable for input/output pair 3."]
304pub struct EXTS_EN3_R(crate::FieldReader<bool, EXTS_EN3_A>);
305impl EXTS_EN3_R {
306    #[inline(always)]
307    pub(crate) fn new(bits: bool) -> Self {
308        EXTS_EN3_R(crate::FieldReader::new(bits))
309    }
310    #[doc = r"Get enumerated values variant"]
311    #[inline(always)]
312    pub fn variant(&self) -> EXTS_EN3_A {
313        match self.bits {
314            false => EXTS_EN3_A::DIS,
315            true => EXTS_EN3_A::EN,
316        }
317    }
318    #[doc = "Checks if the value of the field is `DIS`"]
319    #[inline(always)]
320    pub fn is_dis(&self) -> bool {
321        **self == EXTS_EN3_A::DIS
322    }
323    #[doc = "Checks if the value of the field is `EN`"]
324    #[inline(always)]
325    pub fn is_en(&self) -> bool {
326        **self == EXTS_EN3_A::EN
327    }
328}
329impl core::ops::Deref for EXTS_EN3_R {
330    type Target = crate::FieldReader<bool, EXTS_EN3_A>;
331    #[inline(always)]
332    fn deref(&self) -> &Self::Target {
333        &self.0
334    }
335}
336#[doc = "Field `EXTS_EN3` writer - External Sensor Enable for input/output pair 3."]
337pub struct EXTS_EN3_W<'a> {
338    w: &'a mut W,
339}
340impl<'a> EXTS_EN3_W<'a> {
341    #[doc = r"Writes `variant` to the field"]
342    #[inline(always)]
343    pub fn variant(self, variant: EXTS_EN3_A) -> &'a mut W {
344        self.bit(variant.into())
345    }
346    #[doc = "Disable."]
347    #[inline(always)]
348    pub fn dis(self) -> &'a mut W {
349        self.variant(EXTS_EN3_A::DIS)
350    }
351    #[doc = "Enable."]
352    #[inline(always)]
353    pub fn en(self) -> &'a mut W {
354        self.variant(EXTS_EN3_A::EN)
355    }
356    #[doc = r"Sets the field bit"]
357    #[inline(always)]
358    pub fn set_bit(self) -> &'a mut W {
359        self.bit(true)
360    }
361    #[doc = r"Clears the field bit"]
362    #[inline(always)]
363    pub fn clear_bit(self) -> &'a mut W {
364        self.bit(false)
365    }
366    #[doc = r"Writes raw bits to the field"]
367    #[inline(always)]
368    pub fn bit(self, value: bool) -> &'a mut W {
369        self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
370        self.w
371    }
372}
373#[doc = "External Sensor Enable for input/output pair 4.\n\nValue on reset: 0"]
374#[derive(Clone, Copy, Debug, PartialEq)]
375pub enum EXTS_EN4_A {
376    #[doc = "0: Disable."]
377    DIS = 0,
378    #[doc = "1: Enable."]
379    EN = 1,
380}
381impl From<EXTS_EN4_A> for bool {
382    #[inline(always)]
383    fn from(variant: EXTS_EN4_A) -> Self {
384        variant as u8 != 0
385    }
386}
387#[doc = "Field `EXTS_EN4` reader - External Sensor Enable for input/output pair 4."]
388pub struct EXTS_EN4_R(crate::FieldReader<bool, EXTS_EN4_A>);
389impl EXTS_EN4_R {
390    #[inline(always)]
391    pub(crate) fn new(bits: bool) -> Self {
392        EXTS_EN4_R(crate::FieldReader::new(bits))
393    }
394    #[doc = r"Get enumerated values variant"]
395    #[inline(always)]
396    pub fn variant(&self) -> EXTS_EN4_A {
397        match self.bits {
398            false => EXTS_EN4_A::DIS,
399            true => EXTS_EN4_A::EN,
400        }
401    }
402    #[doc = "Checks if the value of the field is `DIS`"]
403    #[inline(always)]
404    pub fn is_dis(&self) -> bool {
405        **self == EXTS_EN4_A::DIS
406    }
407    #[doc = "Checks if the value of the field is `EN`"]
408    #[inline(always)]
409    pub fn is_en(&self) -> bool {
410        **self == EXTS_EN4_A::EN
411    }
412}
413impl core::ops::Deref for EXTS_EN4_R {
414    type Target = crate::FieldReader<bool, EXTS_EN4_A>;
415    #[inline(always)]
416    fn deref(&self) -> &Self::Target {
417        &self.0
418    }
419}
420#[doc = "Field `EXTS_EN4` writer - External Sensor Enable for input/output pair 4."]
421pub struct EXTS_EN4_W<'a> {
422    w: &'a mut W,
423}
424impl<'a> EXTS_EN4_W<'a> {
425    #[doc = r"Writes `variant` to the field"]
426    #[inline(always)]
427    pub fn variant(self, variant: EXTS_EN4_A) -> &'a mut W {
428        self.bit(variant.into())
429    }
430    #[doc = "Disable."]
431    #[inline(always)]
432    pub fn dis(self) -> &'a mut W {
433        self.variant(EXTS_EN4_A::DIS)
434    }
435    #[doc = "Enable."]
436    #[inline(always)]
437    pub fn en(self) -> &'a mut W {
438        self.variant(EXTS_EN4_A::EN)
439    }
440    #[doc = r"Sets the field bit"]
441    #[inline(always)]
442    pub fn set_bit(self) -> &'a mut W {
443        self.bit(true)
444    }
445    #[doc = r"Clears the field bit"]
446    #[inline(always)]
447    pub fn clear_bit(self) -> &'a mut W {
448        self.bit(false)
449    }
450    #[doc = r"Writes raw bits to the field"]
451    #[inline(always)]
452    pub fn bit(self, value: bool) -> &'a mut W {
453        self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
454        self.w
455    }
456}
457#[doc = "External Sensor Enable for input/output pair 5.\n\nValue on reset: 0"]
458#[derive(Clone, Copy, Debug, PartialEq)]
459pub enum EXTS_EN5_A {
460    #[doc = "0: Disable."]
461    DIS = 0,
462    #[doc = "1: Enable."]
463    EN = 1,
464}
465impl From<EXTS_EN5_A> for bool {
466    #[inline(always)]
467    fn from(variant: EXTS_EN5_A) -> Self {
468        variant as u8 != 0
469    }
470}
471#[doc = "Field `EXTS_EN5` reader - External Sensor Enable for input/output pair 5."]
472pub struct EXTS_EN5_R(crate::FieldReader<bool, EXTS_EN5_A>);
473impl EXTS_EN5_R {
474    #[inline(always)]
475    pub(crate) fn new(bits: bool) -> Self {
476        EXTS_EN5_R(crate::FieldReader::new(bits))
477    }
478    #[doc = r"Get enumerated values variant"]
479    #[inline(always)]
480    pub fn variant(&self) -> EXTS_EN5_A {
481        match self.bits {
482            false => EXTS_EN5_A::DIS,
483            true => EXTS_EN5_A::EN,
484        }
485    }
486    #[doc = "Checks if the value of the field is `DIS`"]
487    #[inline(always)]
488    pub fn is_dis(&self) -> bool {
489        **self == EXTS_EN5_A::DIS
490    }
491    #[doc = "Checks if the value of the field is `EN`"]
492    #[inline(always)]
493    pub fn is_en(&self) -> bool {
494        **self == EXTS_EN5_A::EN
495    }
496}
497impl core::ops::Deref for EXTS_EN5_R {
498    type Target = crate::FieldReader<bool, EXTS_EN5_A>;
499    #[inline(always)]
500    fn deref(&self) -> &Self::Target {
501        &self.0
502    }
503}
504#[doc = "Field `EXTS_EN5` writer - External Sensor Enable for input/output pair 5."]
505pub struct EXTS_EN5_W<'a> {
506    w: &'a mut W,
507}
508impl<'a> EXTS_EN5_W<'a> {
509    #[doc = r"Writes `variant` to the field"]
510    #[inline(always)]
511    pub fn variant(self, variant: EXTS_EN5_A) -> &'a mut W {
512        self.bit(variant.into())
513    }
514    #[doc = "Disable."]
515    #[inline(always)]
516    pub fn dis(self) -> &'a mut W {
517        self.variant(EXTS_EN5_A::DIS)
518    }
519    #[doc = "Enable."]
520    #[inline(always)]
521    pub fn en(self) -> &'a mut W {
522        self.variant(EXTS_EN5_A::EN)
523    }
524    #[doc = r"Sets the field bit"]
525    #[inline(always)]
526    pub fn set_bit(self) -> &'a mut W {
527        self.bit(true)
528    }
529    #[doc = r"Clears the field bit"]
530    #[inline(always)]
531    pub fn clear_bit(self) -> &'a mut W {
532        self.bit(false)
533    }
534    #[doc = r"Writes raw bits to the field"]
535    #[inline(always)]
536    pub fn bit(self, value: bool) -> &'a mut W {
537        self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
538        self.w
539    }
540}
541#[doc = "Field `EXTCNT` reader - External Sensor Error Counter. These bits set the number of external sensor accepted mismatches that have to occur within a single bit period before an external sensor alarm is triggered."]
542pub struct EXTCNT_R(crate::FieldReader<u8, u8>);
543impl EXTCNT_R {
544    #[inline(always)]
545    pub(crate) fn new(bits: u8) -> Self {
546        EXTCNT_R(crate::FieldReader::new(bits))
547    }
548}
549impl core::ops::Deref for EXTCNT_R {
550    type Target = crate::FieldReader<u8, u8>;
551    #[inline(always)]
552    fn deref(&self) -> &Self::Target {
553        &self.0
554    }
555}
556#[doc = "Field `EXTCNT` writer - External Sensor Error Counter. These bits set the number of external sensor accepted mismatches that have to occur within a single bit period before an external sensor alarm is triggered."]
557pub struct EXTCNT_W<'a> {
558    w: &'a mut W,
559}
560impl<'a> EXTCNT_W<'a> {
561    #[doc = r"Writes raw bits to the field"]
562    #[inline(always)]
563    pub unsafe fn bits(self, value: u8) -> &'a mut W {
564        self.w.bits = (self.w.bits & !(0x1f << 16)) | ((value as u32 & 0x1f) << 16);
565        self.w
566    }
567}
568#[doc = "External Sensor Frequency. These bits define the frequency at which the external sensors are clocked to/from the EXTS_IN and EXTS_OUT pair.\n\nValue on reset: 0"]
569#[derive(Clone, Copy, Debug, PartialEq)]
570#[repr(u8)]
571pub enum EXTFRQ_A {
572    #[doc = "0: Div 4 (2000Hz)."]
573    FREQ2000HZ = 0,
574    #[doc = "1: Div 8 (1000Hz)."]
575    FREQ1000HZ = 1,
576    #[doc = "2: Div 16 (500Hz)."]
577    FREQ500HZ = 2,
578    #[doc = "3: Div 32 (250Hz)."]
579    FREQ250HZ = 3,
580    #[doc = "4: Div 64 (125Hz)."]
581    FREQ125HZ = 4,
582    #[doc = "5: Div 128 (63Hz)."]
583    FREQ63HZ = 5,
584    #[doc = "6: Div 256 (31Hz)."]
585    FREQ31HZ = 6,
586    #[doc = "7: Reserved. Do not use."]
587    RFU = 7,
588}
589impl From<EXTFRQ_A> for u8 {
590    #[inline(always)]
591    fn from(variant: EXTFRQ_A) -> Self {
592        variant as _
593    }
594}
595#[doc = "Field `EXTFRQ` reader - External Sensor Frequency. These bits define the frequency at which the external sensors are clocked to/from the EXTS_IN and EXTS_OUT pair."]
596pub struct EXTFRQ_R(crate::FieldReader<u8, EXTFRQ_A>);
597impl EXTFRQ_R {
598    #[inline(always)]
599    pub(crate) fn new(bits: u8) -> Self {
600        EXTFRQ_R(crate::FieldReader::new(bits))
601    }
602    #[doc = r"Get enumerated values variant"]
603    #[inline(always)]
604    pub fn variant(&self) -> EXTFRQ_A {
605        match self.bits {
606            0 => EXTFRQ_A::FREQ2000HZ,
607            1 => EXTFRQ_A::FREQ1000HZ,
608            2 => EXTFRQ_A::FREQ500HZ,
609            3 => EXTFRQ_A::FREQ250HZ,
610            4 => EXTFRQ_A::FREQ125HZ,
611            5 => EXTFRQ_A::FREQ63HZ,
612            6 => EXTFRQ_A::FREQ31HZ,
613            7 => EXTFRQ_A::RFU,
614            _ => unreachable!(),
615        }
616    }
617    #[doc = "Checks if the value of the field is `FREQ2000HZ`"]
618    #[inline(always)]
619    pub fn is_freq2000hz(&self) -> bool {
620        **self == EXTFRQ_A::FREQ2000HZ
621    }
622    #[doc = "Checks if the value of the field is `FREQ1000HZ`"]
623    #[inline(always)]
624    pub fn is_freq1000hz(&self) -> bool {
625        **self == EXTFRQ_A::FREQ1000HZ
626    }
627    #[doc = "Checks if the value of the field is `FREQ500HZ`"]
628    #[inline(always)]
629    pub fn is_freq500hz(&self) -> bool {
630        **self == EXTFRQ_A::FREQ500HZ
631    }
632    #[doc = "Checks if the value of the field is `FREQ250HZ`"]
633    #[inline(always)]
634    pub fn is_freq250hz(&self) -> bool {
635        **self == EXTFRQ_A::FREQ250HZ
636    }
637    #[doc = "Checks if the value of the field is `FREQ125HZ`"]
638    #[inline(always)]
639    pub fn is_freq125hz(&self) -> bool {
640        **self == EXTFRQ_A::FREQ125HZ
641    }
642    #[doc = "Checks if the value of the field is `FREQ63HZ`"]
643    #[inline(always)]
644    pub fn is_freq63hz(&self) -> bool {
645        **self == EXTFRQ_A::FREQ63HZ
646    }
647    #[doc = "Checks if the value of the field is `FREQ31HZ`"]
648    #[inline(always)]
649    pub fn is_freq31hz(&self) -> bool {
650        **self == EXTFRQ_A::FREQ31HZ
651    }
652    #[doc = "Checks if the value of the field is `RFU`"]
653    #[inline(always)]
654    pub fn is_rfu(&self) -> bool {
655        **self == EXTFRQ_A::RFU
656    }
657}
658impl core::ops::Deref for EXTFRQ_R {
659    type Target = crate::FieldReader<u8, EXTFRQ_A>;
660    #[inline(always)]
661    fn deref(&self) -> &Self::Target {
662        &self.0
663    }
664}
665#[doc = "Field `EXTFRQ` writer - External Sensor Frequency. These bits define the frequency at which the external sensors are clocked to/from the EXTS_IN and EXTS_OUT pair."]
666pub struct EXTFRQ_W<'a> {
667    w: &'a mut W,
668}
669impl<'a> EXTFRQ_W<'a> {
670    #[doc = r"Writes `variant` to the field"]
671    #[inline(always)]
672    pub fn variant(self, variant: EXTFRQ_A) -> &'a mut W {
673        self.bits(variant.into())
674    }
675    #[doc = "Div 4 (2000Hz)."]
676    #[inline(always)]
677    pub fn freq2000hz(self) -> &'a mut W {
678        self.variant(EXTFRQ_A::FREQ2000HZ)
679    }
680    #[doc = "Div 8 (1000Hz)."]
681    #[inline(always)]
682    pub fn freq1000hz(self) -> &'a mut W {
683        self.variant(EXTFRQ_A::FREQ1000HZ)
684    }
685    #[doc = "Div 16 (500Hz)."]
686    #[inline(always)]
687    pub fn freq500hz(self) -> &'a mut W {
688        self.variant(EXTFRQ_A::FREQ500HZ)
689    }
690    #[doc = "Div 32 (250Hz)."]
691    #[inline(always)]
692    pub fn freq250hz(self) -> &'a mut W {
693        self.variant(EXTFRQ_A::FREQ250HZ)
694    }
695    #[doc = "Div 64 (125Hz)."]
696    #[inline(always)]
697    pub fn freq125hz(self) -> &'a mut W {
698        self.variant(EXTFRQ_A::FREQ125HZ)
699    }
700    #[doc = "Div 128 (63Hz)."]
701    #[inline(always)]
702    pub fn freq63hz(self) -> &'a mut W {
703        self.variant(EXTFRQ_A::FREQ63HZ)
704    }
705    #[doc = "Div 256 (31Hz)."]
706    #[inline(always)]
707    pub fn freq31hz(self) -> &'a mut W {
708        self.variant(EXTFRQ_A::FREQ31HZ)
709    }
710    #[doc = "Reserved. Do not use."]
711    #[inline(always)]
712    pub fn rfu(self) -> &'a mut W {
713        self.variant(EXTFRQ_A::RFU)
714    }
715    #[doc = r"Writes raw bits to the field"]
716    #[inline(always)]
717    pub fn bits(self, value: u8) -> &'a mut W {
718        self.w.bits = (self.w.bits & !(0x07 << 21)) | ((value as u32 & 0x07) << 21);
719        self.w
720    }
721}
722#[doc = "Clock Divide. These bits are used to divide the 8KHz input clock. The resulting divided clock is used for all logic within the Security Monitor Block. Note: If the input clock is divided with these bits, the error count threshold table and output frequency will be affected accordingly with the same divide factor.\n\nValue on reset: 0"]
723#[derive(Clone, Copy, Debug, PartialEq)]
724#[repr(u8)]
725pub enum DIVCLK_A {
726    #[doc = "0: Divide by 1 (8000 Hz)."]
727    DIV1 = 0,
728    #[doc = "1: Divide by 2 (4000 Hz)."]
729    DIV2 = 1,
730    #[doc = "2: Divide by 4 (2000 Hz)."]
731    DIV4 = 2,
732    #[doc = "3: Divide by 8 (1000 Hz)."]
733    DIV8 = 3,
734    #[doc = "4: Divide by 16 (500 Hz)."]
735    DIV16 = 4,
736    #[doc = "5: Divide by 32 (250 Hz)."]
737    DIV32 = 5,
738    #[doc = "6: Divide by 64 (125 Hz)."]
739    DIV64 = 6,
740}
741impl From<DIVCLK_A> for u8 {
742    #[inline(always)]
743    fn from(variant: DIVCLK_A) -> Self {
744        variant as _
745    }
746}
747#[doc = "Field `DIVCLK` reader - Clock Divide. These bits are used to divide the 8KHz input clock. The resulting divided clock is used for all logic within the Security Monitor Block. Note: If the input clock is divided with these bits, the error count threshold table and output frequency will be affected accordingly with the same divide factor."]
748pub struct DIVCLK_R(crate::FieldReader<u8, DIVCLK_A>);
749impl DIVCLK_R {
750    #[inline(always)]
751    pub(crate) fn new(bits: u8) -> Self {
752        DIVCLK_R(crate::FieldReader::new(bits))
753    }
754    #[doc = r"Get enumerated values variant"]
755    #[inline(always)]
756    pub fn variant(&self) -> Option<DIVCLK_A> {
757        match self.bits {
758            0 => Some(DIVCLK_A::DIV1),
759            1 => Some(DIVCLK_A::DIV2),
760            2 => Some(DIVCLK_A::DIV4),
761            3 => Some(DIVCLK_A::DIV8),
762            4 => Some(DIVCLK_A::DIV16),
763            5 => Some(DIVCLK_A::DIV32),
764            6 => Some(DIVCLK_A::DIV64),
765            _ => None,
766        }
767    }
768    #[doc = "Checks if the value of the field is `DIV1`"]
769    #[inline(always)]
770    pub fn is_div1(&self) -> bool {
771        **self == DIVCLK_A::DIV1
772    }
773    #[doc = "Checks if the value of the field is `DIV2`"]
774    #[inline(always)]
775    pub fn is_div2(&self) -> bool {
776        **self == DIVCLK_A::DIV2
777    }
778    #[doc = "Checks if the value of the field is `DIV4`"]
779    #[inline(always)]
780    pub fn is_div4(&self) -> bool {
781        **self == DIVCLK_A::DIV4
782    }
783    #[doc = "Checks if the value of the field is `DIV8`"]
784    #[inline(always)]
785    pub fn is_div8(&self) -> bool {
786        **self == DIVCLK_A::DIV8
787    }
788    #[doc = "Checks if the value of the field is `DIV16`"]
789    #[inline(always)]
790    pub fn is_div16(&self) -> bool {
791        **self == DIVCLK_A::DIV16
792    }
793    #[doc = "Checks if the value of the field is `DIV32`"]
794    #[inline(always)]
795    pub fn is_div32(&self) -> bool {
796        **self == DIVCLK_A::DIV32
797    }
798    #[doc = "Checks if the value of the field is `DIV64`"]
799    #[inline(always)]
800    pub fn is_div64(&self) -> bool {
801        **self == DIVCLK_A::DIV64
802    }
803}
804impl core::ops::Deref for DIVCLK_R {
805    type Target = crate::FieldReader<u8, DIVCLK_A>;
806    #[inline(always)]
807    fn deref(&self) -> &Self::Target {
808        &self.0
809    }
810}
811#[doc = "Field `DIVCLK` writer - Clock Divide. These bits are used to divide the 8KHz input clock. The resulting divided clock is used for all logic within the Security Monitor Block. Note: If the input clock is divided with these bits, the error count threshold table and output frequency will be affected accordingly with the same divide factor."]
812pub struct DIVCLK_W<'a> {
813    w: &'a mut W,
814}
815impl<'a> DIVCLK_W<'a> {
816    #[doc = r"Writes `variant` to the field"]
817    #[inline(always)]
818    pub fn variant(self, variant: DIVCLK_A) -> &'a mut W {
819        unsafe { self.bits(variant.into()) }
820    }
821    #[doc = "Divide by 1 (8000 Hz)."]
822    #[inline(always)]
823    pub fn div1(self) -> &'a mut W {
824        self.variant(DIVCLK_A::DIV1)
825    }
826    #[doc = "Divide by 2 (4000 Hz)."]
827    #[inline(always)]
828    pub fn div2(self) -> &'a mut W {
829        self.variant(DIVCLK_A::DIV2)
830    }
831    #[doc = "Divide by 4 (2000 Hz)."]
832    #[inline(always)]
833    pub fn div4(self) -> &'a mut W {
834        self.variant(DIVCLK_A::DIV4)
835    }
836    #[doc = "Divide by 8 (1000 Hz)."]
837    #[inline(always)]
838    pub fn div8(self) -> &'a mut W {
839        self.variant(DIVCLK_A::DIV8)
840    }
841    #[doc = "Divide by 16 (500 Hz)."]
842    #[inline(always)]
843    pub fn div16(self) -> &'a mut W {
844        self.variant(DIVCLK_A::DIV16)
845    }
846    #[doc = "Divide by 32 (250 Hz)."]
847    #[inline(always)]
848    pub fn div32(self) -> &'a mut W {
849        self.variant(DIVCLK_A::DIV32)
850    }
851    #[doc = "Divide by 64 (125 Hz)."]
852    #[inline(always)]
853    pub fn div64(self) -> &'a mut W {
854        self.variant(DIVCLK_A::DIV64)
855    }
856    #[doc = r"Writes raw bits to the field"]
857    #[inline(always)]
858    pub unsafe fn bits(self, value: u8) -> &'a mut W {
859        self.w.bits = (self.w.bits & !(0x07 << 24)) | ((value as u32 & 0x07) << 24);
860        self.w
861    }
862}
863#[doc = "Busy. This bit is set to 1 by hardware after EXTSCN register is written to. This bit is automatically cleared to 0 after this register information has been transferred to the security monitor domain.\n\nValue on reset: 0"]
864#[derive(Clone, Copy, Debug, PartialEq)]
865pub enum BUSY_A {
866    #[doc = "0: Idle."]
867    IDLE = 0,
868    #[doc = "1: Update in Progress."]
869    BUSY = 1,
870}
871impl From<BUSY_A> for bool {
872    #[inline(always)]
873    fn from(variant: BUSY_A) -> Self {
874        variant as u8 != 0
875    }
876}
877#[doc = "Field `BUSY` reader - Busy. This bit is set to 1 by hardware after EXTSCN register is written to. This bit is automatically cleared to 0 after this register information has been transferred to the security monitor domain."]
878pub struct BUSY_R(crate::FieldReader<bool, BUSY_A>);
879impl BUSY_R {
880    #[inline(always)]
881    pub(crate) fn new(bits: bool) -> Self {
882        BUSY_R(crate::FieldReader::new(bits))
883    }
884    #[doc = r"Get enumerated values variant"]
885    #[inline(always)]
886    pub fn variant(&self) -> BUSY_A {
887        match self.bits {
888            false => BUSY_A::IDLE,
889            true => BUSY_A::BUSY,
890        }
891    }
892    #[doc = "Checks if the value of the field is `IDLE`"]
893    #[inline(always)]
894    pub fn is_idle(&self) -> bool {
895        **self == BUSY_A::IDLE
896    }
897    #[doc = "Checks if the value of the field is `BUSY`"]
898    #[inline(always)]
899    pub fn is_busy(&self) -> bool {
900        **self == BUSY_A::BUSY
901    }
902}
903impl core::ops::Deref for BUSY_R {
904    type Target = crate::FieldReader<bool, BUSY_A>;
905    #[inline(always)]
906    fn deref(&self) -> &Self::Target {
907        &self.0
908    }
909}
910#[doc = "Lock Register. Once locked, the EXTSCN register can no longer be modified. Only a battery disconnect will clear this bit. VBAT powers this register.\n\nValue on reset: 0"]
911#[derive(Clone, Copy, Debug, PartialEq)]
912pub enum LOCK_A {
913    #[doc = "0: Unlocked."]
914    UNLOCKED = 0,
915    #[doc = "1: Locked."]
916    LOCKED = 1,
917}
918impl From<LOCK_A> for bool {
919    #[inline(always)]
920    fn from(variant: LOCK_A) -> Self {
921        variant as u8 != 0
922    }
923}
924#[doc = "Field `LOCK` reader - Lock Register. Once locked, the EXTSCN register can no longer be modified. Only a battery disconnect will clear this bit. VBAT powers this register."]
925pub struct LOCK_R(crate::FieldReader<bool, LOCK_A>);
926impl LOCK_R {
927    #[inline(always)]
928    pub(crate) fn new(bits: bool) -> Self {
929        LOCK_R(crate::FieldReader::new(bits))
930    }
931    #[doc = r"Get enumerated values variant"]
932    #[inline(always)]
933    pub fn variant(&self) -> LOCK_A {
934        match self.bits {
935            false => LOCK_A::UNLOCKED,
936            true => LOCK_A::LOCKED,
937        }
938    }
939    #[doc = "Checks if the value of the field is `UNLOCKED`"]
940    #[inline(always)]
941    pub fn is_unlocked(&self) -> bool {
942        **self == LOCK_A::UNLOCKED
943    }
944    #[doc = "Checks if the value of the field is `LOCKED`"]
945    #[inline(always)]
946    pub fn is_locked(&self) -> bool {
947        **self == LOCK_A::LOCKED
948    }
949}
950impl core::ops::Deref for LOCK_R {
951    type Target = crate::FieldReader<bool, LOCK_A>;
952    #[inline(always)]
953    fn deref(&self) -> &Self::Target {
954        &self.0
955    }
956}
957#[doc = "Field `LOCK` writer - Lock Register. Once locked, the EXTSCN register can no longer be modified. Only a battery disconnect will clear this bit. VBAT powers this register."]
958pub struct LOCK_W<'a> {
959    w: &'a mut W,
960}
961impl<'a> LOCK_W<'a> {
962    #[doc = r"Writes `variant` to the field"]
963    #[inline(always)]
964    pub fn variant(self, variant: LOCK_A) -> &'a mut W {
965        self.bit(variant.into())
966    }
967    #[doc = "Unlocked."]
968    #[inline(always)]
969    pub fn unlocked(self) -> &'a mut W {
970        self.variant(LOCK_A::UNLOCKED)
971    }
972    #[doc = "Locked."]
973    #[inline(always)]
974    pub fn locked(self) -> &'a mut W {
975        self.variant(LOCK_A::LOCKED)
976    }
977    #[doc = r"Sets the field bit"]
978    #[inline(always)]
979    pub fn set_bit(self) -> &'a mut W {
980        self.bit(true)
981    }
982    #[doc = r"Clears the field bit"]
983    #[inline(always)]
984    pub fn clear_bit(self) -> &'a mut W {
985        self.bit(false)
986    }
987    #[doc = r"Writes raw bits to the field"]
988    #[inline(always)]
989    pub fn bit(self, value: bool) -> &'a mut W {
990        self.w.bits = (self.w.bits & !(0x01 << 31)) | ((value as u32 & 0x01) << 31);
991        self.w
992    }
993}
994impl R {
995    #[doc = "Bit 0 - External Sensor Enable for input/output pair 0."]
996    #[inline(always)]
997    pub fn exts_en0(&self) -> EXTS_EN0_R {
998        EXTS_EN0_R::new((self.bits & 0x01) != 0)
999    }
1000    #[doc = "Bit 1 - External Sensor Enable for input/output pair 1."]
1001    #[inline(always)]
1002    pub fn exts_en1(&self) -> EXTS_EN1_R {
1003        EXTS_EN1_R::new(((self.bits >> 1) & 0x01) != 0)
1004    }
1005    #[doc = "Bit 2 - External Sensor Enable for input/output pair 2."]
1006    #[inline(always)]
1007    pub fn exts_en2(&self) -> EXTS_EN2_R {
1008        EXTS_EN2_R::new(((self.bits >> 2) & 0x01) != 0)
1009    }
1010    #[doc = "Bit 3 - External Sensor Enable for input/output pair 3."]
1011    #[inline(always)]
1012    pub fn exts_en3(&self) -> EXTS_EN3_R {
1013        EXTS_EN3_R::new(((self.bits >> 3) & 0x01) != 0)
1014    }
1015    #[doc = "Bit 4 - External Sensor Enable for input/output pair 4."]
1016    #[inline(always)]
1017    pub fn exts_en4(&self) -> EXTS_EN4_R {
1018        EXTS_EN4_R::new(((self.bits >> 4) & 0x01) != 0)
1019    }
1020    #[doc = "Bit 5 - External Sensor Enable for input/output pair 5."]
1021    #[inline(always)]
1022    pub fn exts_en5(&self) -> EXTS_EN5_R {
1023        EXTS_EN5_R::new(((self.bits >> 5) & 0x01) != 0)
1024    }
1025    #[doc = "Bits 16:20 - External Sensor Error Counter. These bits set the number of external sensor accepted mismatches that have to occur within a single bit period before an external sensor alarm is triggered."]
1026    #[inline(always)]
1027    pub fn extcnt(&self) -> EXTCNT_R {
1028        EXTCNT_R::new(((self.bits >> 16) & 0x1f) as u8)
1029    }
1030    #[doc = "Bits 21:23 - External Sensor Frequency. These bits define the frequency at which the external sensors are clocked to/from the EXTS_IN and EXTS_OUT pair."]
1031    #[inline(always)]
1032    pub fn extfrq(&self) -> EXTFRQ_R {
1033        EXTFRQ_R::new(((self.bits >> 21) & 0x07) as u8)
1034    }
1035    #[doc = "Bits 24:26 - Clock Divide. These bits are used to divide the 8KHz input clock. The resulting divided clock is used for all logic within the Security Monitor Block. Note: If the input clock is divided with these bits, the error count threshold table and output frequency will be affected accordingly with the same divide factor."]
1036    #[inline(always)]
1037    pub fn divclk(&self) -> DIVCLK_R {
1038        DIVCLK_R::new(((self.bits >> 24) & 0x07) as u8)
1039    }
1040    #[doc = "Bit 30 - Busy. This bit is set to 1 by hardware after EXTSCN register is written to. This bit is automatically cleared to 0 after this register information has been transferred to the security monitor domain."]
1041    #[inline(always)]
1042    pub fn busy(&self) -> BUSY_R {
1043        BUSY_R::new(((self.bits >> 30) & 0x01) != 0)
1044    }
1045    #[doc = "Bit 31 - Lock Register. Once locked, the EXTSCN register can no longer be modified. Only a battery disconnect will clear this bit. VBAT powers this register."]
1046    #[inline(always)]
1047    pub fn lock(&self) -> LOCK_R {
1048        LOCK_R::new(((self.bits >> 31) & 0x01) != 0)
1049    }
1050}
1051impl W {
1052    #[doc = "Bit 0 - External Sensor Enable for input/output pair 0."]
1053    #[inline(always)]
1054    pub fn exts_en0(&mut self) -> EXTS_EN0_W {
1055        EXTS_EN0_W { w: self }
1056    }
1057    #[doc = "Bit 1 - External Sensor Enable for input/output pair 1."]
1058    #[inline(always)]
1059    pub fn exts_en1(&mut self) -> EXTS_EN1_W {
1060        EXTS_EN1_W { w: self }
1061    }
1062    #[doc = "Bit 2 - External Sensor Enable for input/output pair 2."]
1063    #[inline(always)]
1064    pub fn exts_en2(&mut self) -> EXTS_EN2_W {
1065        EXTS_EN2_W { w: self }
1066    }
1067    #[doc = "Bit 3 - External Sensor Enable for input/output pair 3."]
1068    #[inline(always)]
1069    pub fn exts_en3(&mut self) -> EXTS_EN3_W {
1070        EXTS_EN3_W { w: self }
1071    }
1072    #[doc = "Bit 4 - External Sensor Enable for input/output pair 4."]
1073    #[inline(always)]
1074    pub fn exts_en4(&mut self) -> EXTS_EN4_W {
1075        EXTS_EN4_W { w: self }
1076    }
1077    #[doc = "Bit 5 - External Sensor Enable for input/output pair 5."]
1078    #[inline(always)]
1079    pub fn exts_en5(&mut self) -> EXTS_EN5_W {
1080        EXTS_EN5_W { w: self }
1081    }
1082    #[doc = "Bits 16:20 - External Sensor Error Counter. These bits set the number of external sensor accepted mismatches that have to occur within a single bit period before an external sensor alarm is triggered."]
1083    #[inline(always)]
1084    pub fn extcnt(&mut self) -> EXTCNT_W {
1085        EXTCNT_W { w: self }
1086    }
1087    #[doc = "Bits 21:23 - External Sensor Frequency. These bits define the frequency at which the external sensors are clocked to/from the EXTS_IN and EXTS_OUT pair."]
1088    #[inline(always)]
1089    pub fn extfrq(&mut self) -> EXTFRQ_W {
1090        EXTFRQ_W { w: self }
1091    }
1092    #[doc = "Bits 24:26 - Clock Divide. These bits are used to divide the 8KHz input clock. The resulting divided clock is used for all logic within the Security Monitor Block. Note: If the input clock is divided with these bits, the error count threshold table and output frequency will be affected accordingly with the same divide factor."]
1093    #[inline(always)]
1094    pub fn divclk(&mut self) -> DIVCLK_W {
1095        DIVCLK_W { w: self }
1096    }
1097    #[doc = "Bit 31 - Lock Register. Once locked, the EXTSCN register can no longer be modified. Only a battery disconnect will clear this bit. VBAT powers this register."]
1098    #[inline(always)]
1099    pub fn lock(&mut self) -> LOCK_W {
1100        LOCK_W { w: self }
1101    }
1102    #[doc = "Writes raw bits to the register."]
1103    #[inline(always)]
1104    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1105        self.0.bits(bits);
1106        self
1107    }
1108}
1109#[doc = "External Sensor 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 [extscn](index.html) module"]
1110pub struct EXTSCN_SPEC;
1111impl crate::RegisterSpec for EXTSCN_SPEC {
1112    type Ux = u32;
1113}
1114#[doc = "`read()` method returns [extscn::R](R) reader structure"]
1115impl crate::Readable for EXTSCN_SPEC {
1116    type Reader = R;
1117}
1118#[doc = "`write(|w| ..)` method takes [extscn::W](W) writer structure"]
1119impl crate::Writable for EXTSCN_SPEC {
1120    type Writer = W;
1121}
1122#[doc = "`reset()` method sets EXTSCN to value 0"]
1123impl crate::Resettable for EXTSCN_SPEC {
1124    #[inline(always)]
1125    fn reset_value() -> Self::Ux {
1126        0
1127    }
1128}