1#[doc = "Register `ACC_MR` reader"]
2pub struct R(crate::R<ACC_MR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<ACC_MR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<ACC_MR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<ACC_MR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `ACC_MR` writer"]
17pub struct W(crate::W<ACC_MR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<ACC_MR_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<ACC_MR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<ACC_MR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Selection for Minus Comparator Input\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum SELMINUS_A {
41 #[doc = "0: Select TS"]
42 TS = 0,
43 #[doc = "1: Select VREFP"]
44 VREFP = 1,
45 #[doc = "2: Select DAC0"]
46 DAC0 = 2,
47 #[doc = "3: Select DAC1"]
48 DAC1 = 3,
49 #[doc = "4: Select AFE0_AD0"]
50 AFE0_AD0 = 4,
51 #[doc = "5: Select AFE0_AD1"]
52 AFE0_AD1 = 5,
53 #[doc = "6: Select AFE0_AD2"]
54 AFE0_AD2 = 6,
55 #[doc = "7: Select AFE0_AD3"]
56 AFE0_AD3 = 7,
57}
58impl From<SELMINUS_A> for u8 {
59 #[inline(always)]
60 fn from(variant: SELMINUS_A) -> Self {
61 variant as _
62 }
63}
64#[doc = "Field `SELMINUS` reader - Selection for Minus Comparator Input"]
65pub struct SELMINUS_R(crate::FieldReader<u8, SELMINUS_A>);
66impl SELMINUS_R {
67 #[inline(always)]
68 pub(crate) fn new(bits: u8) -> Self {
69 SELMINUS_R(crate::FieldReader::new(bits))
70 }
71 #[doc = r"Get enumerated values variant"]
72 #[inline(always)]
73 pub fn variant(&self) -> SELMINUS_A {
74 match self.bits {
75 0 => SELMINUS_A::TS,
76 1 => SELMINUS_A::VREFP,
77 2 => SELMINUS_A::DAC0,
78 3 => SELMINUS_A::DAC1,
79 4 => SELMINUS_A::AFE0_AD0,
80 5 => SELMINUS_A::AFE0_AD1,
81 6 => SELMINUS_A::AFE0_AD2,
82 7 => SELMINUS_A::AFE0_AD3,
83 _ => unreachable!(),
84 }
85 }
86 #[doc = "Checks if the value of the field is `TS`"]
87 #[inline(always)]
88 pub fn is_ts(&self) -> bool {
89 **self == SELMINUS_A::TS
90 }
91 #[doc = "Checks if the value of the field is `VREFP`"]
92 #[inline(always)]
93 pub fn is_vrefp(&self) -> bool {
94 **self == SELMINUS_A::VREFP
95 }
96 #[doc = "Checks if the value of the field is `DAC0`"]
97 #[inline(always)]
98 pub fn is_dac0(&self) -> bool {
99 **self == SELMINUS_A::DAC0
100 }
101 #[doc = "Checks if the value of the field is `DAC1`"]
102 #[inline(always)]
103 pub fn is_dac1(&self) -> bool {
104 **self == SELMINUS_A::DAC1
105 }
106 #[doc = "Checks if the value of the field is `AFE0_AD0`"]
107 #[inline(always)]
108 pub fn is_afe0_ad0(&self) -> bool {
109 **self == SELMINUS_A::AFE0_AD0
110 }
111 #[doc = "Checks if the value of the field is `AFE0_AD1`"]
112 #[inline(always)]
113 pub fn is_afe0_ad1(&self) -> bool {
114 **self == SELMINUS_A::AFE0_AD1
115 }
116 #[doc = "Checks if the value of the field is `AFE0_AD2`"]
117 #[inline(always)]
118 pub fn is_afe0_ad2(&self) -> bool {
119 **self == SELMINUS_A::AFE0_AD2
120 }
121 #[doc = "Checks if the value of the field is `AFE0_AD3`"]
122 #[inline(always)]
123 pub fn is_afe0_ad3(&self) -> bool {
124 **self == SELMINUS_A::AFE0_AD3
125 }
126}
127impl core::ops::Deref for SELMINUS_R {
128 type Target = crate::FieldReader<u8, SELMINUS_A>;
129 #[inline(always)]
130 fn deref(&self) -> &Self::Target {
131 &self.0
132 }
133}
134#[doc = "Field `SELMINUS` writer - Selection for Minus Comparator Input"]
135pub struct SELMINUS_W<'a> {
136 w: &'a mut W,
137}
138impl<'a> SELMINUS_W<'a> {
139 #[doc = r"Writes `variant` to the field"]
140 #[inline(always)]
141 pub fn variant(self, variant: SELMINUS_A) -> &'a mut W {
142 self.bits(variant.into())
143 }
144 #[doc = "Select TS"]
145 #[inline(always)]
146 pub fn ts(self) -> &'a mut W {
147 self.variant(SELMINUS_A::TS)
148 }
149 #[doc = "Select VREFP"]
150 #[inline(always)]
151 pub fn vrefp(self) -> &'a mut W {
152 self.variant(SELMINUS_A::VREFP)
153 }
154 #[doc = "Select DAC0"]
155 #[inline(always)]
156 pub fn dac0(self) -> &'a mut W {
157 self.variant(SELMINUS_A::DAC0)
158 }
159 #[doc = "Select DAC1"]
160 #[inline(always)]
161 pub fn dac1(self) -> &'a mut W {
162 self.variant(SELMINUS_A::DAC1)
163 }
164 #[doc = "Select AFE0_AD0"]
165 #[inline(always)]
166 pub fn afe0_ad0(self) -> &'a mut W {
167 self.variant(SELMINUS_A::AFE0_AD0)
168 }
169 #[doc = "Select AFE0_AD1"]
170 #[inline(always)]
171 pub fn afe0_ad1(self) -> &'a mut W {
172 self.variant(SELMINUS_A::AFE0_AD1)
173 }
174 #[doc = "Select AFE0_AD2"]
175 #[inline(always)]
176 pub fn afe0_ad2(self) -> &'a mut W {
177 self.variant(SELMINUS_A::AFE0_AD2)
178 }
179 #[doc = "Select AFE0_AD3"]
180 #[inline(always)]
181 pub fn afe0_ad3(self) -> &'a mut W {
182 self.variant(SELMINUS_A::AFE0_AD3)
183 }
184 #[doc = r"Writes raw bits to the field"]
185 #[inline(always)]
186 pub fn bits(self, value: u8) -> &'a mut W {
187 self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
188 self.w
189 }
190}
191#[doc = "Selection For Plus Comparator Input\n\nValue on reset: 0"]
192#[derive(Clone, Copy, Debug, PartialEq)]
193#[repr(u8)]
194pub enum SELPLUS_A {
195 #[doc = "0: Select AFE0_AD0"]
196 AFE0_AD0 = 0,
197 #[doc = "1: Select AFE0_AD1"]
198 AFE0_AD1 = 1,
199 #[doc = "2: Select AFE0_AD2"]
200 AFE0_AD2 = 2,
201 #[doc = "3: Select AFE0_AD3"]
202 AFE0_AD3 = 3,
203 #[doc = "4: Select AFE0_AD4"]
204 AFE0_AD4 = 4,
205 #[doc = "5: Select AFE0_AD5"]
206 AFE0_AD5 = 5,
207 #[doc = "6: Select AFE1_AD0"]
208 AFE1_AD0 = 6,
209 #[doc = "7: Select AFE1_AD1"]
210 AFE1_AD1 = 7,
211}
212impl From<SELPLUS_A> for u8 {
213 #[inline(always)]
214 fn from(variant: SELPLUS_A) -> Self {
215 variant as _
216 }
217}
218#[doc = "Field `SELPLUS` reader - Selection For Plus Comparator Input"]
219pub struct SELPLUS_R(crate::FieldReader<u8, SELPLUS_A>);
220impl SELPLUS_R {
221 #[inline(always)]
222 pub(crate) fn new(bits: u8) -> Self {
223 SELPLUS_R(crate::FieldReader::new(bits))
224 }
225 #[doc = r"Get enumerated values variant"]
226 #[inline(always)]
227 pub fn variant(&self) -> SELPLUS_A {
228 match self.bits {
229 0 => SELPLUS_A::AFE0_AD0,
230 1 => SELPLUS_A::AFE0_AD1,
231 2 => SELPLUS_A::AFE0_AD2,
232 3 => SELPLUS_A::AFE0_AD3,
233 4 => SELPLUS_A::AFE0_AD4,
234 5 => SELPLUS_A::AFE0_AD5,
235 6 => SELPLUS_A::AFE1_AD0,
236 7 => SELPLUS_A::AFE1_AD1,
237 _ => unreachable!(),
238 }
239 }
240 #[doc = "Checks if the value of the field is `AFE0_AD0`"]
241 #[inline(always)]
242 pub fn is_afe0_ad0(&self) -> bool {
243 **self == SELPLUS_A::AFE0_AD0
244 }
245 #[doc = "Checks if the value of the field is `AFE0_AD1`"]
246 #[inline(always)]
247 pub fn is_afe0_ad1(&self) -> bool {
248 **self == SELPLUS_A::AFE0_AD1
249 }
250 #[doc = "Checks if the value of the field is `AFE0_AD2`"]
251 #[inline(always)]
252 pub fn is_afe0_ad2(&self) -> bool {
253 **self == SELPLUS_A::AFE0_AD2
254 }
255 #[doc = "Checks if the value of the field is `AFE0_AD3`"]
256 #[inline(always)]
257 pub fn is_afe0_ad3(&self) -> bool {
258 **self == SELPLUS_A::AFE0_AD3
259 }
260 #[doc = "Checks if the value of the field is `AFE0_AD4`"]
261 #[inline(always)]
262 pub fn is_afe0_ad4(&self) -> bool {
263 **self == SELPLUS_A::AFE0_AD4
264 }
265 #[doc = "Checks if the value of the field is `AFE0_AD5`"]
266 #[inline(always)]
267 pub fn is_afe0_ad5(&self) -> bool {
268 **self == SELPLUS_A::AFE0_AD5
269 }
270 #[doc = "Checks if the value of the field is `AFE1_AD0`"]
271 #[inline(always)]
272 pub fn is_afe1_ad0(&self) -> bool {
273 **self == SELPLUS_A::AFE1_AD0
274 }
275 #[doc = "Checks if the value of the field is `AFE1_AD1`"]
276 #[inline(always)]
277 pub fn is_afe1_ad1(&self) -> bool {
278 **self == SELPLUS_A::AFE1_AD1
279 }
280}
281impl core::ops::Deref for SELPLUS_R {
282 type Target = crate::FieldReader<u8, SELPLUS_A>;
283 #[inline(always)]
284 fn deref(&self) -> &Self::Target {
285 &self.0
286 }
287}
288#[doc = "Field `SELPLUS` writer - Selection For Plus Comparator Input"]
289pub struct SELPLUS_W<'a> {
290 w: &'a mut W,
291}
292impl<'a> SELPLUS_W<'a> {
293 #[doc = r"Writes `variant` to the field"]
294 #[inline(always)]
295 pub fn variant(self, variant: SELPLUS_A) -> &'a mut W {
296 self.bits(variant.into())
297 }
298 #[doc = "Select AFE0_AD0"]
299 #[inline(always)]
300 pub fn afe0_ad0(self) -> &'a mut W {
301 self.variant(SELPLUS_A::AFE0_AD0)
302 }
303 #[doc = "Select AFE0_AD1"]
304 #[inline(always)]
305 pub fn afe0_ad1(self) -> &'a mut W {
306 self.variant(SELPLUS_A::AFE0_AD1)
307 }
308 #[doc = "Select AFE0_AD2"]
309 #[inline(always)]
310 pub fn afe0_ad2(self) -> &'a mut W {
311 self.variant(SELPLUS_A::AFE0_AD2)
312 }
313 #[doc = "Select AFE0_AD3"]
314 #[inline(always)]
315 pub fn afe0_ad3(self) -> &'a mut W {
316 self.variant(SELPLUS_A::AFE0_AD3)
317 }
318 #[doc = "Select AFE0_AD4"]
319 #[inline(always)]
320 pub fn afe0_ad4(self) -> &'a mut W {
321 self.variant(SELPLUS_A::AFE0_AD4)
322 }
323 #[doc = "Select AFE0_AD5"]
324 #[inline(always)]
325 pub fn afe0_ad5(self) -> &'a mut W {
326 self.variant(SELPLUS_A::AFE0_AD5)
327 }
328 #[doc = "Select AFE1_AD0"]
329 #[inline(always)]
330 pub fn afe1_ad0(self) -> &'a mut W {
331 self.variant(SELPLUS_A::AFE1_AD0)
332 }
333 #[doc = "Select AFE1_AD1"]
334 #[inline(always)]
335 pub fn afe1_ad1(self) -> &'a mut W {
336 self.variant(SELPLUS_A::AFE1_AD1)
337 }
338 #[doc = r"Writes raw bits to the field"]
339 #[inline(always)]
340 pub fn bits(self, value: u8) -> &'a mut W {
341 self.w.bits = (self.w.bits & !(0x07 << 4)) | ((value as u32 & 0x07) << 4);
342 self.w
343 }
344}
345#[doc = "Analog Comparator Enable\n\nValue on reset: 0"]
346#[derive(Clone, Copy, Debug, PartialEq)]
347pub enum ACEN_A {
348 #[doc = "0: Analog comparator disabled."]
349 DIS = 0,
350 #[doc = "1: Analog comparator enabled."]
351 EN = 1,
352}
353impl From<ACEN_A> for bool {
354 #[inline(always)]
355 fn from(variant: ACEN_A) -> Self {
356 variant as u8 != 0
357 }
358}
359#[doc = "Field `ACEN` reader - Analog Comparator Enable"]
360pub struct ACEN_R(crate::FieldReader<bool, ACEN_A>);
361impl ACEN_R {
362 #[inline(always)]
363 pub(crate) fn new(bits: bool) -> Self {
364 ACEN_R(crate::FieldReader::new(bits))
365 }
366 #[doc = r"Get enumerated values variant"]
367 #[inline(always)]
368 pub fn variant(&self) -> ACEN_A {
369 match self.bits {
370 false => ACEN_A::DIS,
371 true => ACEN_A::EN,
372 }
373 }
374 #[doc = "Checks if the value of the field is `DIS`"]
375 #[inline(always)]
376 pub fn is_dis(&self) -> bool {
377 **self == ACEN_A::DIS
378 }
379 #[doc = "Checks if the value of the field is `EN`"]
380 #[inline(always)]
381 pub fn is_en(&self) -> bool {
382 **self == ACEN_A::EN
383 }
384}
385impl core::ops::Deref for ACEN_R {
386 type Target = crate::FieldReader<bool, ACEN_A>;
387 #[inline(always)]
388 fn deref(&self) -> &Self::Target {
389 &self.0
390 }
391}
392#[doc = "Field `ACEN` writer - Analog Comparator Enable"]
393pub struct ACEN_W<'a> {
394 w: &'a mut W,
395}
396impl<'a> ACEN_W<'a> {
397 #[doc = r"Writes `variant` to the field"]
398 #[inline(always)]
399 pub fn variant(self, variant: ACEN_A) -> &'a mut W {
400 self.bit(variant.into())
401 }
402 #[doc = "Analog comparator disabled."]
403 #[inline(always)]
404 pub fn dis(self) -> &'a mut W {
405 self.variant(ACEN_A::DIS)
406 }
407 #[doc = "Analog comparator enabled."]
408 #[inline(always)]
409 pub fn en(self) -> &'a mut W {
410 self.variant(ACEN_A::EN)
411 }
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 << 8)) | ((value as u32 & 0x01) << 8);
426 self.w
427 }
428}
429#[doc = "Edge Type\n\nValue on reset: 0"]
430#[derive(Clone, Copy, Debug, PartialEq)]
431#[repr(u8)]
432pub enum EDGETYP_A {
433 #[doc = "0: Only rising edge of comparator output"]
434 RISING = 0,
435 #[doc = "1: Falling edge of comparator output"]
436 FALLING = 1,
437 #[doc = "2: Any edge of comparator output"]
438 ANY = 2,
439}
440impl From<EDGETYP_A> for u8 {
441 #[inline(always)]
442 fn from(variant: EDGETYP_A) -> Self {
443 variant as _
444 }
445}
446#[doc = "Field `EDGETYP` reader - Edge Type"]
447pub struct EDGETYP_R(crate::FieldReader<u8, EDGETYP_A>);
448impl EDGETYP_R {
449 #[inline(always)]
450 pub(crate) fn new(bits: u8) -> Self {
451 EDGETYP_R(crate::FieldReader::new(bits))
452 }
453 #[doc = r"Get enumerated values variant"]
454 #[inline(always)]
455 pub fn variant(&self) -> Option<EDGETYP_A> {
456 match self.bits {
457 0 => Some(EDGETYP_A::RISING),
458 1 => Some(EDGETYP_A::FALLING),
459 2 => Some(EDGETYP_A::ANY),
460 _ => None,
461 }
462 }
463 #[doc = "Checks if the value of the field is `RISING`"]
464 #[inline(always)]
465 pub fn is_rising(&self) -> bool {
466 **self == EDGETYP_A::RISING
467 }
468 #[doc = "Checks if the value of the field is `FALLING`"]
469 #[inline(always)]
470 pub fn is_falling(&self) -> bool {
471 **self == EDGETYP_A::FALLING
472 }
473 #[doc = "Checks if the value of the field is `ANY`"]
474 #[inline(always)]
475 pub fn is_any(&self) -> bool {
476 **self == EDGETYP_A::ANY
477 }
478}
479impl core::ops::Deref for EDGETYP_R {
480 type Target = crate::FieldReader<u8, EDGETYP_A>;
481 #[inline(always)]
482 fn deref(&self) -> &Self::Target {
483 &self.0
484 }
485}
486#[doc = "Field `EDGETYP` writer - Edge Type"]
487pub struct EDGETYP_W<'a> {
488 w: &'a mut W,
489}
490impl<'a> EDGETYP_W<'a> {
491 #[doc = r"Writes `variant` to the field"]
492 #[inline(always)]
493 pub fn variant(self, variant: EDGETYP_A) -> &'a mut W {
494 unsafe { self.bits(variant.into()) }
495 }
496 #[doc = "Only rising edge of comparator output"]
497 #[inline(always)]
498 pub fn rising(self) -> &'a mut W {
499 self.variant(EDGETYP_A::RISING)
500 }
501 #[doc = "Falling edge of comparator output"]
502 #[inline(always)]
503 pub fn falling(self) -> &'a mut W {
504 self.variant(EDGETYP_A::FALLING)
505 }
506 #[doc = "Any edge of comparator output"]
507 #[inline(always)]
508 pub fn any(self) -> &'a mut W {
509 self.variant(EDGETYP_A::ANY)
510 }
511 #[doc = r"Writes raw bits to the field"]
512 #[inline(always)]
513 pub unsafe fn bits(self, value: u8) -> &'a mut W {
514 self.w.bits = (self.w.bits & !(0x03 << 9)) | ((value as u32 & 0x03) << 9);
515 self.w
516 }
517}
518#[doc = "Invert Comparator Output\n\nValue on reset: 0"]
519#[derive(Clone, Copy, Debug, PartialEq)]
520pub enum INV_A {
521 #[doc = "0: Analog comparator output is directly processed."]
522 DIS = 0,
523 #[doc = "1: Analog comparator output is inverted prior to being processed."]
524 EN = 1,
525}
526impl From<INV_A> for bool {
527 #[inline(always)]
528 fn from(variant: INV_A) -> Self {
529 variant as u8 != 0
530 }
531}
532#[doc = "Field `INV` reader - Invert Comparator Output"]
533pub struct INV_R(crate::FieldReader<bool, INV_A>);
534impl INV_R {
535 #[inline(always)]
536 pub(crate) fn new(bits: bool) -> Self {
537 INV_R(crate::FieldReader::new(bits))
538 }
539 #[doc = r"Get enumerated values variant"]
540 #[inline(always)]
541 pub fn variant(&self) -> INV_A {
542 match self.bits {
543 false => INV_A::DIS,
544 true => INV_A::EN,
545 }
546 }
547 #[doc = "Checks if the value of the field is `DIS`"]
548 #[inline(always)]
549 pub fn is_dis(&self) -> bool {
550 **self == INV_A::DIS
551 }
552 #[doc = "Checks if the value of the field is `EN`"]
553 #[inline(always)]
554 pub fn is_en(&self) -> bool {
555 **self == INV_A::EN
556 }
557}
558impl core::ops::Deref for INV_R {
559 type Target = crate::FieldReader<bool, INV_A>;
560 #[inline(always)]
561 fn deref(&self) -> &Self::Target {
562 &self.0
563 }
564}
565#[doc = "Field `INV` writer - Invert Comparator Output"]
566pub struct INV_W<'a> {
567 w: &'a mut W,
568}
569impl<'a> INV_W<'a> {
570 #[doc = r"Writes `variant` to the field"]
571 #[inline(always)]
572 pub fn variant(self, variant: INV_A) -> &'a mut W {
573 self.bit(variant.into())
574 }
575 #[doc = "Analog comparator output is directly processed."]
576 #[inline(always)]
577 pub fn dis(self) -> &'a mut W {
578 self.variant(INV_A::DIS)
579 }
580 #[doc = "Analog comparator output is inverted prior to being processed."]
581 #[inline(always)]
582 pub fn en(self) -> &'a mut W {
583 self.variant(INV_A::EN)
584 }
585 #[doc = r"Sets the field bit"]
586 #[inline(always)]
587 pub fn set_bit(self) -> &'a mut W {
588 self.bit(true)
589 }
590 #[doc = r"Clears the field bit"]
591 #[inline(always)]
592 pub fn clear_bit(self) -> &'a mut W {
593 self.bit(false)
594 }
595 #[doc = r"Writes raw bits to the field"]
596 #[inline(always)]
597 pub fn bit(self, value: bool) -> &'a mut W {
598 self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
599 self.w
600 }
601}
602#[doc = "Selection Of Fault Source\n\nValue on reset: 0"]
603#[derive(Clone, Copy, Debug, PartialEq)]
604pub enum SELFS_A {
605 #[doc = "0: The CE flag is used to drive the FAULT output."]
606 CE = 0,
607 #[doc = "1: The output of the analog comparator flag is used to drive the FAULT output."]
608 OUTPUT = 1,
609}
610impl From<SELFS_A> for bool {
611 #[inline(always)]
612 fn from(variant: SELFS_A) -> Self {
613 variant as u8 != 0
614 }
615}
616#[doc = "Field `SELFS` reader - Selection Of Fault Source"]
617pub struct SELFS_R(crate::FieldReader<bool, SELFS_A>);
618impl SELFS_R {
619 #[inline(always)]
620 pub(crate) fn new(bits: bool) -> Self {
621 SELFS_R(crate::FieldReader::new(bits))
622 }
623 #[doc = r"Get enumerated values variant"]
624 #[inline(always)]
625 pub fn variant(&self) -> SELFS_A {
626 match self.bits {
627 false => SELFS_A::CE,
628 true => SELFS_A::OUTPUT,
629 }
630 }
631 #[doc = "Checks if the value of the field is `CE`"]
632 #[inline(always)]
633 pub fn is_ce(&self) -> bool {
634 **self == SELFS_A::CE
635 }
636 #[doc = "Checks if the value of the field is `OUTPUT`"]
637 #[inline(always)]
638 pub fn is_output(&self) -> bool {
639 **self == SELFS_A::OUTPUT
640 }
641}
642impl core::ops::Deref for SELFS_R {
643 type Target = crate::FieldReader<bool, SELFS_A>;
644 #[inline(always)]
645 fn deref(&self) -> &Self::Target {
646 &self.0
647 }
648}
649#[doc = "Field `SELFS` writer - Selection Of Fault Source"]
650pub struct SELFS_W<'a> {
651 w: &'a mut W,
652}
653impl<'a> SELFS_W<'a> {
654 #[doc = r"Writes `variant` to the field"]
655 #[inline(always)]
656 pub fn variant(self, variant: SELFS_A) -> &'a mut W {
657 self.bit(variant.into())
658 }
659 #[doc = "The CE flag is used to drive the FAULT output."]
660 #[inline(always)]
661 pub fn ce(self) -> &'a mut W {
662 self.variant(SELFS_A::CE)
663 }
664 #[doc = "The output of the analog comparator flag is used to drive the FAULT output."]
665 #[inline(always)]
666 pub fn output(self) -> &'a mut W {
667 self.variant(SELFS_A::OUTPUT)
668 }
669 #[doc = r"Sets the field bit"]
670 #[inline(always)]
671 pub fn set_bit(self) -> &'a mut W {
672 self.bit(true)
673 }
674 #[doc = r"Clears the field bit"]
675 #[inline(always)]
676 pub fn clear_bit(self) -> &'a mut W {
677 self.bit(false)
678 }
679 #[doc = r"Writes raw bits to the field"]
680 #[inline(always)]
681 pub fn bit(self, value: bool) -> &'a mut W {
682 self.w.bits = (self.w.bits & !(0x01 << 13)) | ((value as u32 & 0x01) << 13);
683 self.w
684 }
685}
686#[doc = "Fault Enable\n\nValue on reset: 0"]
687#[derive(Clone, Copy, Debug, PartialEq)]
688pub enum FE_A {
689 #[doc = "0: The FAULT output is tied to 0."]
690 DIS = 0,
691 #[doc = "1: The FAULT output is driven by the signal defined by SELFS."]
692 EN = 1,
693}
694impl From<FE_A> for bool {
695 #[inline(always)]
696 fn from(variant: FE_A) -> Self {
697 variant as u8 != 0
698 }
699}
700#[doc = "Field `FE` reader - Fault Enable"]
701pub struct FE_R(crate::FieldReader<bool, FE_A>);
702impl FE_R {
703 #[inline(always)]
704 pub(crate) fn new(bits: bool) -> Self {
705 FE_R(crate::FieldReader::new(bits))
706 }
707 #[doc = r"Get enumerated values variant"]
708 #[inline(always)]
709 pub fn variant(&self) -> FE_A {
710 match self.bits {
711 false => FE_A::DIS,
712 true => FE_A::EN,
713 }
714 }
715 #[doc = "Checks if the value of the field is `DIS`"]
716 #[inline(always)]
717 pub fn is_dis(&self) -> bool {
718 **self == FE_A::DIS
719 }
720 #[doc = "Checks if the value of the field is `EN`"]
721 #[inline(always)]
722 pub fn is_en(&self) -> bool {
723 **self == FE_A::EN
724 }
725}
726impl core::ops::Deref for FE_R {
727 type Target = crate::FieldReader<bool, FE_A>;
728 #[inline(always)]
729 fn deref(&self) -> &Self::Target {
730 &self.0
731 }
732}
733#[doc = "Field `FE` writer - Fault Enable"]
734pub struct FE_W<'a> {
735 w: &'a mut W,
736}
737impl<'a> FE_W<'a> {
738 #[doc = r"Writes `variant` to the field"]
739 #[inline(always)]
740 pub fn variant(self, variant: FE_A) -> &'a mut W {
741 self.bit(variant.into())
742 }
743 #[doc = "The FAULT output is tied to 0."]
744 #[inline(always)]
745 pub fn dis(self) -> &'a mut W {
746 self.variant(FE_A::DIS)
747 }
748 #[doc = "The FAULT output is driven by the signal defined by SELFS."]
749 #[inline(always)]
750 pub fn en(self) -> &'a mut W {
751 self.variant(FE_A::EN)
752 }
753 #[doc = r"Sets the field bit"]
754 #[inline(always)]
755 pub fn set_bit(self) -> &'a mut W {
756 self.bit(true)
757 }
758 #[doc = r"Clears the field bit"]
759 #[inline(always)]
760 pub fn clear_bit(self) -> &'a mut W {
761 self.bit(false)
762 }
763 #[doc = r"Writes raw bits to the field"]
764 #[inline(always)]
765 pub fn bit(self, value: bool) -> &'a mut W {
766 self.w.bits = (self.w.bits & !(0x01 << 14)) | ((value as u32 & 0x01) << 14);
767 self.w
768 }
769}
770impl R {
771 #[doc = "Bits 0:2 - Selection for Minus Comparator Input"]
772 #[inline(always)]
773 pub fn selminus(&self) -> SELMINUS_R {
774 SELMINUS_R::new((self.bits & 0x07) as u8)
775 }
776 #[doc = "Bits 4:6 - Selection For Plus Comparator Input"]
777 #[inline(always)]
778 pub fn selplus(&self) -> SELPLUS_R {
779 SELPLUS_R::new(((self.bits >> 4) & 0x07) as u8)
780 }
781 #[doc = "Bit 8 - Analog Comparator Enable"]
782 #[inline(always)]
783 pub fn acen(&self) -> ACEN_R {
784 ACEN_R::new(((self.bits >> 8) & 0x01) != 0)
785 }
786 #[doc = "Bits 9:10 - Edge Type"]
787 #[inline(always)]
788 pub fn edgetyp(&self) -> EDGETYP_R {
789 EDGETYP_R::new(((self.bits >> 9) & 0x03) as u8)
790 }
791 #[doc = "Bit 12 - Invert Comparator Output"]
792 #[inline(always)]
793 pub fn inv(&self) -> INV_R {
794 INV_R::new(((self.bits >> 12) & 0x01) != 0)
795 }
796 #[doc = "Bit 13 - Selection Of Fault Source"]
797 #[inline(always)]
798 pub fn selfs(&self) -> SELFS_R {
799 SELFS_R::new(((self.bits >> 13) & 0x01) != 0)
800 }
801 #[doc = "Bit 14 - Fault Enable"]
802 #[inline(always)]
803 pub fn fe(&self) -> FE_R {
804 FE_R::new(((self.bits >> 14) & 0x01) != 0)
805 }
806}
807impl W {
808 #[doc = "Bits 0:2 - Selection for Minus Comparator Input"]
809 #[inline(always)]
810 pub fn selminus(&mut self) -> SELMINUS_W {
811 SELMINUS_W { w: self }
812 }
813 #[doc = "Bits 4:6 - Selection For Plus Comparator Input"]
814 #[inline(always)]
815 pub fn selplus(&mut self) -> SELPLUS_W {
816 SELPLUS_W { w: self }
817 }
818 #[doc = "Bit 8 - Analog Comparator Enable"]
819 #[inline(always)]
820 pub fn acen(&mut self) -> ACEN_W {
821 ACEN_W { w: self }
822 }
823 #[doc = "Bits 9:10 - Edge Type"]
824 #[inline(always)]
825 pub fn edgetyp(&mut self) -> EDGETYP_W {
826 EDGETYP_W { w: self }
827 }
828 #[doc = "Bit 12 - Invert Comparator Output"]
829 #[inline(always)]
830 pub fn inv(&mut self) -> INV_W {
831 INV_W { w: self }
832 }
833 #[doc = "Bit 13 - Selection Of Fault Source"]
834 #[inline(always)]
835 pub fn selfs(&mut self) -> SELFS_W {
836 SELFS_W { w: self }
837 }
838 #[doc = "Bit 14 - Fault Enable"]
839 #[inline(always)]
840 pub fn fe(&mut self) -> FE_W {
841 FE_W { w: self }
842 }
843 #[doc = "Writes raw bits to the register."]
844 #[inline(always)]
845 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
846 self.0.bits(bits);
847 self
848 }
849}
850#[doc = "Mode 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 [acc_mr](index.html) module"]
851pub struct ACC_MR_SPEC;
852impl crate::RegisterSpec for ACC_MR_SPEC {
853 type Ux = u32;
854}
855#[doc = "`read()` method returns [acc_mr::R](R) reader structure"]
856impl crate::Readable for ACC_MR_SPEC {
857 type Reader = R;
858}
859#[doc = "`write(|w| ..)` method takes [acc_mr::W](W) writer structure"]
860impl crate::Writable for ACC_MR_SPEC {
861 type Writer = W;
862}
863#[doc = "`reset()` method sets ACC_MR to value 0"]
864impl crate::Resettable for ACC_MR_SPEC {
865 #[inline(always)]
866 fn reset_value() -> Self::Ux {
867 0
868 }
869}