1#[doc = "Register `AFEC_MR` reader"]
2pub struct R(crate::R<AFEC_MR_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<AFEC_MR_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<AFEC_MR_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<AFEC_MR_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `AFEC_MR` writer"]
17pub struct W(crate::W<AFEC_MR_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<AFEC_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<AFEC_MR_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<AFEC_MR_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Trigger Enable\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum TRGEN_A {
40 #[doc = "0: Hardware triggers are disabled. Starting a conversion is only possible by software."]
41 DIS = 0,
42 #[doc = "1: Hardware trigger selected by TRGSEL field is enabled."]
43 EN = 1,
44}
45impl From<TRGEN_A> for bool {
46 #[inline(always)]
47 fn from(variant: TRGEN_A) -> Self {
48 variant as u8 != 0
49 }
50}
51#[doc = "Field `TRGEN` reader - Trigger Enable"]
52pub struct TRGEN_R(crate::FieldReader<bool, TRGEN_A>);
53impl TRGEN_R {
54 #[inline(always)]
55 pub(crate) fn new(bits: bool) -> Self {
56 TRGEN_R(crate::FieldReader::new(bits))
57 }
58 #[doc = r"Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> TRGEN_A {
61 match self.bits {
62 false => TRGEN_A::DIS,
63 true => TRGEN_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 == TRGEN_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 == TRGEN_A::EN
75 }
76}
77impl core::ops::Deref for TRGEN_R {
78 type Target = crate::FieldReader<bool, TRGEN_A>;
79 #[inline(always)]
80 fn deref(&self) -> &Self::Target {
81 &self.0
82 }
83}
84#[doc = "Field `TRGEN` writer - Trigger Enable"]
85pub struct TRGEN_W<'a> {
86 w: &'a mut W,
87}
88impl<'a> TRGEN_W<'a> {
89 #[doc = r"Writes `variant` to the field"]
90 #[inline(always)]
91 pub fn variant(self, variant: TRGEN_A) -> &'a mut W {
92 self.bit(variant.into())
93 }
94 #[doc = "Hardware triggers are disabled. Starting a conversion is only possible by software."]
95 #[inline(always)]
96 pub fn dis(self) -> &'a mut W {
97 self.variant(TRGEN_A::DIS)
98 }
99 #[doc = "Hardware trigger selected by TRGSEL field is enabled."]
100 #[inline(always)]
101 pub fn en(self) -> &'a mut W {
102 self.variant(TRGEN_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 = "Trigger Selection\n\nValue on reset: 0"]
122#[derive(Clone, Copy, Debug, PartialEq)]
123#[repr(u8)]
124pub enum TRGSEL_A {
125 #[doc = "0: AFE0_ADTRG for AFEC0 / AFE1_ADTRG for AFEC1"]
126 AFEC_TRIG0 = 0,
127 #[doc = "1: TIOA Output of the Timer Counter Channel 0 for AFEC0/TIOA Output of the Timer Counter Channel 3 for AFEC1"]
128 AFEC_TRIG1 = 1,
129 #[doc = "2: TIOA Output of the Timer Counter Channel 1 for AFEC0/TIOA Output of the Timer Counter Channel 4 for AFEC1"]
130 AFEC_TRIG2 = 2,
131 #[doc = "3: TIOA Output of the Timer Counter Channel 2 for AFEC0/TIOA Output of the Timer Counter Channel 5 for AFEC1"]
132 AFEC_TRIG3 = 3,
133 #[doc = "4: PWM0 event line 0 for AFEC0 / PWM1 event line 0 for AFEC1"]
134 AFEC_TRIG4 = 4,
135 #[doc = "5: PWM0 event line 1 for AFEC0 / PWM1 event line 1 for AFEC1"]
136 AFEC_TRIG5 = 5,
137 #[doc = "6: Analog Comparator"]
138 AFEC_TRIG6 = 6,
139}
140impl From<TRGSEL_A> for u8 {
141 #[inline(always)]
142 fn from(variant: TRGSEL_A) -> Self {
143 variant as _
144 }
145}
146#[doc = "Field `TRGSEL` reader - Trigger Selection"]
147pub struct TRGSEL_R(crate::FieldReader<u8, TRGSEL_A>);
148impl TRGSEL_R {
149 #[inline(always)]
150 pub(crate) fn new(bits: u8) -> Self {
151 TRGSEL_R(crate::FieldReader::new(bits))
152 }
153 #[doc = r"Get enumerated values variant"]
154 #[inline(always)]
155 pub fn variant(&self) -> Option<TRGSEL_A> {
156 match self.bits {
157 0 => Some(TRGSEL_A::AFEC_TRIG0),
158 1 => Some(TRGSEL_A::AFEC_TRIG1),
159 2 => Some(TRGSEL_A::AFEC_TRIG2),
160 3 => Some(TRGSEL_A::AFEC_TRIG3),
161 4 => Some(TRGSEL_A::AFEC_TRIG4),
162 5 => Some(TRGSEL_A::AFEC_TRIG5),
163 6 => Some(TRGSEL_A::AFEC_TRIG6),
164 _ => None,
165 }
166 }
167 #[doc = "Checks if the value of the field is `AFEC_TRIG0`"]
168 #[inline(always)]
169 pub fn is_afec_trig0(&self) -> bool {
170 **self == TRGSEL_A::AFEC_TRIG0
171 }
172 #[doc = "Checks if the value of the field is `AFEC_TRIG1`"]
173 #[inline(always)]
174 pub fn is_afec_trig1(&self) -> bool {
175 **self == TRGSEL_A::AFEC_TRIG1
176 }
177 #[doc = "Checks if the value of the field is `AFEC_TRIG2`"]
178 #[inline(always)]
179 pub fn is_afec_trig2(&self) -> bool {
180 **self == TRGSEL_A::AFEC_TRIG2
181 }
182 #[doc = "Checks if the value of the field is `AFEC_TRIG3`"]
183 #[inline(always)]
184 pub fn is_afec_trig3(&self) -> bool {
185 **self == TRGSEL_A::AFEC_TRIG3
186 }
187 #[doc = "Checks if the value of the field is `AFEC_TRIG4`"]
188 #[inline(always)]
189 pub fn is_afec_trig4(&self) -> bool {
190 **self == TRGSEL_A::AFEC_TRIG4
191 }
192 #[doc = "Checks if the value of the field is `AFEC_TRIG5`"]
193 #[inline(always)]
194 pub fn is_afec_trig5(&self) -> bool {
195 **self == TRGSEL_A::AFEC_TRIG5
196 }
197 #[doc = "Checks if the value of the field is `AFEC_TRIG6`"]
198 #[inline(always)]
199 pub fn is_afec_trig6(&self) -> bool {
200 **self == TRGSEL_A::AFEC_TRIG6
201 }
202}
203impl core::ops::Deref for TRGSEL_R {
204 type Target = crate::FieldReader<u8, TRGSEL_A>;
205 #[inline(always)]
206 fn deref(&self) -> &Self::Target {
207 &self.0
208 }
209}
210#[doc = "Field `TRGSEL` writer - Trigger Selection"]
211pub struct TRGSEL_W<'a> {
212 w: &'a mut W,
213}
214impl<'a> TRGSEL_W<'a> {
215 #[doc = r"Writes `variant` to the field"]
216 #[inline(always)]
217 pub fn variant(self, variant: TRGSEL_A) -> &'a mut W {
218 unsafe { self.bits(variant.into()) }
219 }
220 #[doc = "AFE0_ADTRG for AFEC0 / AFE1_ADTRG for AFEC1"]
221 #[inline(always)]
222 pub fn afec_trig0(self) -> &'a mut W {
223 self.variant(TRGSEL_A::AFEC_TRIG0)
224 }
225 #[doc = "TIOA Output of the Timer Counter Channel 0 for AFEC0/TIOA Output of the Timer Counter Channel 3 for AFEC1"]
226 #[inline(always)]
227 pub fn afec_trig1(self) -> &'a mut W {
228 self.variant(TRGSEL_A::AFEC_TRIG1)
229 }
230 #[doc = "TIOA Output of the Timer Counter Channel 1 for AFEC0/TIOA Output of the Timer Counter Channel 4 for AFEC1"]
231 #[inline(always)]
232 pub fn afec_trig2(self) -> &'a mut W {
233 self.variant(TRGSEL_A::AFEC_TRIG2)
234 }
235 #[doc = "TIOA Output of the Timer Counter Channel 2 for AFEC0/TIOA Output of the Timer Counter Channel 5 for AFEC1"]
236 #[inline(always)]
237 pub fn afec_trig3(self) -> &'a mut W {
238 self.variant(TRGSEL_A::AFEC_TRIG3)
239 }
240 #[doc = "PWM0 event line 0 for AFEC0 / PWM1 event line 0 for AFEC1"]
241 #[inline(always)]
242 pub fn afec_trig4(self) -> &'a mut W {
243 self.variant(TRGSEL_A::AFEC_TRIG4)
244 }
245 #[doc = "PWM0 event line 1 for AFEC0 / PWM1 event line 1 for AFEC1"]
246 #[inline(always)]
247 pub fn afec_trig5(self) -> &'a mut W {
248 self.variant(TRGSEL_A::AFEC_TRIG5)
249 }
250 #[doc = "Analog Comparator"]
251 #[inline(always)]
252 pub fn afec_trig6(self) -> &'a mut W {
253 self.variant(TRGSEL_A::AFEC_TRIG6)
254 }
255 #[doc = r"Writes raw bits to the field"]
256 #[inline(always)]
257 pub unsafe fn bits(self, value: u8) -> &'a mut W {
258 self.w.bits = (self.w.bits & !(0x07 << 1)) | ((value as u32 & 0x07) << 1);
259 self.w
260 }
261}
262#[doc = "Sleep Mode\n\nValue on reset: 0"]
263#[derive(Clone, Copy, Debug, PartialEq)]
264pub enum SLEEP_A {
265 #[doc = "0: Normal mode: The AFE and reference voltage circuitry are kept ON between conversions."]
266 NORMAL = 0,
267 #[doc = "1: Sleep mode: The AFE and reference voltage circuitry are OFF between conversions."]
268 SLEEP = 1,
269}
270impl From<SLEEP_A> for bool {
271 #[inline(always)]
272 fn from(variant: SLEEP_A) -> Self {
273 variant as u8 != 0
274 }
275}
276#[doc = "Field `SLEEP` reader - Sleep Mode"]
277pub struct SLEEP_R(crate::FieldReader<bool, SLEEP_A>);
278impl SLEEP_R {
279 #[inline(always)]
280 pub(crate) fn new(bits: bool) -> Self {
281 SLEEP_R(crate::FieldReader::new(bits))
282 }
283 #[doc = r"Get enumerated values variant"]
284 #[inline(always)]
285 pub fn variant(&self) -> SLEEP_A {
286 match self.bits {
287 false => SLEEP_A::NORMAL,
288 true => SLEEP_A::SLEEP,
289 }
290 }
291 #[doc = "Checks if the value of the field is `NORMAL`"]
292 #[inline(always)]
293 pub fn is_normal(&self) -> bool {
294 **self == SLEEP_A::NORMAL
295 }
296 #[doc = "Checks if the value of the field is `SLEEP`"]
297 #[inline(always)]
298 pub fn is_sleep(&self) -> bool {
299 **self == SLEEP_A::SLEEP
300 }
301}
302impl core::ops::Deref for SLEEP_R {
303 type Target = crate::FieldReader<bool, SLEEP_A>;
304 #[inline(always)]
305 fn deref(&self) -> &Self::Target {
306 &self.0
307 }
308}
309#[doc = "Field `SLEEP` writer - Sleep Mode"]
310pub struct SLEEP_W<'a> {
311 w: &'a mut W,
312}
313impl<'a> SLEEP_W<'a> {
314 #[doc = r"Writes `variant` to the field"]
315 #[inline(always)]
316 pub fn variant(self, variant: SLEEP_A) -> &'a mut W {
317 self.bit(variant.into())
318 }
319 #[doc = "Normal mode: The AFE and reference voltage circuitry are kept ON between conversions."]
320 #[inline(always)]
321 pub fn normal(self) -> &'a mut W {
322 self.variant(SLEEP_A::NORMAL)
323 }
324 #[doc = "Sleep mode: The AFE and reference voltage circuitry are OFF between conversions."]
325 #[inline(always)]
326 pub fn sleep(self) -> &'a mut W {
327 self.variant(SLEEP_A::SLEEP)
328 }
329 #[doc = r"Sets the field bit"]
330 #[inline(always)]
331 pub fn set_bit(self) -> &'a mut W {
332 self.bit(true)
333 }
334 #[doc = r"Clears the field bit"]
335 #[inline(always)]
336 pub fn clear_bit(self) -> &'a mut W {
337 self.bit(false)
338 }
339 #[doc = r"Writes raw bits to the field"]
340 #[inline(always)]
341 pub fn bit(self, value: bool) -> &'a mut W {
342 self.w.bits = (self.w.bits & !(0x01 << 5)) | ((value as u32 & 0x01) << 5);
343 self.w
344 }
345}
346#[doc = "Fast Wake-up\n\nValue on reset: 0"]
347#[derive(Clone, Copy, Debug, PartialEq)]
348pub enum FWUP_A {
349 #[doc = "0: Normal Sleep mode: The sleep mode is defined by the SLEEP bit."]
350 OFF = 0,
351 #[doc = "1: Fast wake-up Sleep mode: The voltage reference is ON between conversions and AFE is OFF."]
352 ON = 1,
353}
354impl From<FWUP_A> for bool {
355 #[inline(always)]
356 fn from(variant: FWUP_A) -> Self {
357 variant as u8 != 0
358 }
359}
360#[doc = "Field `FWUP` reader - Fast Wake-up"]
361pub struct FWUP_R(crate::FieldReader<bool, FWUP_A>);
362impl FWUP_R {
363 #[inline(always)]
364 pub(crate) fn new(bits: bool) -> Self {
365 FWUP_R(crate::FieldReader::new(bits))
366 }
367 #[doc = r"Get enumerated values variant"]
368 #[inline(always)]
369 pub fn variant(&self) -> FWUP_A {
370 match self.bits {
371 false => FWUP_A::OFF,
372 true => FWUP_A::ON,
373 }
374 }
375 #[doc = "Checks if the value of the field is `OFF`"]
376 #[inline(always)]
377 pub fn is_off(&self) -> bool {
378 **self == FWUP_A::OFF
379 }
380 #[doc = "Checks if the value of the field is `ON`"]
381 #[inline(always)]
382 pub fn is_on(&self) -> bool {
383 **self == FWUP_A::ON
384 }
385}
386impl core::ops::Deref for FWUP_R {
387 type Target = crate::FieldReader<bool, FWUP_A>;
388 #[inline(always)]
389 fn deref(&self) -> &Self::Target {
390 &self.0
391 }
392}
393#[doc = "Field `FWUP` writer - Fast Wake-up"]
394pub struct FWUP_W<'a> {
395 w: &'a mut W,
396}
397impl<'a> FWUP_W<'a> {
398 #[doc = r"Writes `variant` to the field"]
399 #[inline(always)]
400 pub fn variant(self, variant: FWUP_A) -> &'a mut W {
401 self.bit(variant.into())
402 }
403 #[doc = "Normal Sleep mode: The sleep mode is defined by the SLEEP bit."]
404 #[inline(always)]
405 pub fn off(self) -> &'a mut W {
406 self.variant(FWUP_A::OFF)
407 }
408 #[doc = "Fast wake-up Sleep mode: The voltage reference is ON between conversions and AFE is OFF."]
409 #[inline(always)]
410 pub fn on(self) -> &'a mut W {
411 self.variant(FWUP_A::ON)
412 }
413 #[doc = r"Sets the field bit"]
414 #[inline(always)]
415 pub fn set_bit(self) -> &'a mut W {
416 self.bit(true)
417 }
418 #[doc = r"Clears the field bit"]
419 #[inline(always)]
420 pub fn clear_bit(self) -> &'a mut W {
421 self.bit(false)
422 }
423 #[doc = r"Writes raw bits to the field"]
424 #[inline(always)]
425 pub fn bit(self, value: bool) -> &'a mut W {
426 self.w.bits = (self.w.bits & !(0x01 << 6)) | ((value as u32 & 0x01) << 6);
427 self.w
428 }
429}
430#[doc = "Free Run Mode\n\nValue on reset: 0"]
431#[derive(Clone, Copy, Debug, PartialEq)]
432pub enum FREERUN_A {
433 #[doc = "0: Normal mode"]
434 OFF = 0,
435 #[doc = "1: Free Run mode: Never wait for any trigger."]
436 ON = 1,
437}
438impl From<FREERUN_A> for bool {
439 #[inline(always)]
440 fn from(variant: FREERUN_A) -> Self {
441 variant as u8 != 0
442 }
443}
444#[doc = "Field `FREERUN` reader - Free Run Mode"]
445pub struct FREERUN_R(crate::FieldReader<bool, FREERUN_A>);
446impl FREERUN_R {
447 #[inline(always)]
448 pub(crate) fn new(bits: bool) -> Self {
449 FREERUN_R(crate::FieldReader::new(bits))
450 }
451 #[doc = r"Get enumerated values variant"]
452 #[inline(always)]
453 pub fn variant(&self) -> FREERUN_A {
454 match self.bits {
455 false => FREERUN_A::OFF,
456 true => FREERUN_A::ON,
457 }
458 }
459 #[doc = "Checks if the value of the field is `OFF`"]
460 #[inline(always)]
461 pub fn is_off(&self) -> bool {
462 **self == FREERUN_A::OFF
463 }
464 #[doc = "Checks if the value of the field is `ON`"]
465 #[inline(always)]
466 pub fn is_on(&self) -> bool {
467 **self == FREERUN_A::ON
468 }
469}
470impl core::ops::Deref for FREERUN_R {
471 type Target = crate::FieldReader<bool, FREERUN_A>;
472 #[inline(always)]
473 fn deref(&self) -> &Self::Target {
474 &self.0
475 }
476}
477#[doc = "Field `FREERUN` writer - Free Run Mode"]
478pub struct FREERUN_W<'a> {
479 w: &'a mut W,
480}
481impl<'a> FREERUN_W<'a> {
482 #[doc = r"Writes `variant` to the field"]
483 #[inline(always)]
484 pub fn variant(self, variant: FREERUN_A) -> &'a mut W {
485 self.bit(variant.into())
486 }
487 #[doc = "Normal mode"]
488 #[inline(always)]
489 pub fn off(self) -> &'a mut W {
490 self.variant(FREERUN_A::OFF)
491 }
492 #[doc = "Free Run mode: Never wait for any trigger."]
493 #[inline(always)]
494 pub fn on(self) -> &'a mut W {
495 self.variant(FREERUN_A::ON)
496 }
497 #[doc = r"Sets the field bit"]
498 #[inline(always)]
499 pub fn set_bit(self) -> &'a mut W {
500 self.bit(true)
501 }
502 #[doc = r"Clears the field bit"]
503 #[inline(always)]
504 pub fn clear_bit(self) -> &'a mut W {
505 self.bit(false)
506 }
507 #[doc = r"Writes raw bits to the field"]
508 #[inline(always)]
509 pub fn bit(self, value: bool) -> &'a mut W {
510 self.w.bits = (self.w.bits & !(0x01 << 7)) | ((value as u32 & 0x01) << 7);
511 self.w
512 }
513}
514#[doc = "Field `PRESCAL` reader - Prescaler Rate Selection"]
515pub struct PRESCAL_R(crate::FieldReader<u8, u8>);
516impl PRESCAL_R {
517 #[inline(always)]
518 pub(crate) fn new(bits: u8) -> Self {
519 PRESCAL_R(crate::FieldReader::new(bits))
520 }
521}
522impl core::ops::Deref for PRESCAL_R {
523 type Target = crate::FieldReader<u8, u8>;
524 #[inline(always)]
525 fn deref(&self) -> &Self::Target {
526 &self.0
527 }
528}
529#[doc = "Field `PRESCAL` writer - Prescaler Rate Selection"]
530pub struct PRESCAL_W<'a> {
531 w: &'a mut W,
532}
533impl<'a> PRESCAL_W<'a> {
534 #[doc = r"Writes raw bits to the field"]
535 #[inline(always)]
536 pub unsafe fn bits(self, value: u8) -> &'a mut W {
537 self.w.bits = (self.w.bits & !(0xff << 8)) | ((value as u32 & 0xff) << 8);
538 self.w
539 }
540}
541#[doc = "Start-up Time\n\nValue on reset: 0"]
542#[derive(Clone, Copy, Debug, PartialEq)]
543#[repr(u8)]
544pub enum STARTUP_A {
545 #[doc = "0: 0 periods of AFE clock"]
546 SUT0 = 0,
547 #[doc = "1: 8 periods of AFE clock"]
548 SUT8 = 1,
549 #[doc = "2: 16 periods of AFE clock"]
550 SUT16 = 2,
551 #[doc = "3: 24 periods of AFE clock"]
552 SUT24 = 3,
553 #[doc = "4: 64 periods of AFE clock"]
554 SUT64 = 4,
555 #[doc = "5: 80 periods of AFE clock"]
556 SUT80 = 5,
557 #[doc = "6: 96 periods of AFE clock"]
558 SUT96 = 6,
559 #[doc = "7: 112 periods of AFE clock"]
560 SUT112 = 7,
561 #[doc = "8: 512 periods of AFE clock"]
562 SUT512 = 8,
563 #[doc = "9: 576 periods of AFE clock"]
564 SUT576 = 9,
565 #[doc = "10: 640 periods of AFE clock"]
566 SUT640 = 10,
567 #[doc = "11: 704 periods of AFE clock"]
568 SUT704 = 11,
569 #[doc = "12: 768 periods of AFE clock"]
570 SUT768 = 12,
571 #[doc = "13: 832 periods of AFE clock"]
572 SUT832 = 13,
573 #[doc = "14: 896 periods of AFE clock"]
574 SUT896 = 14,
575 #[doc = "15: 960 periods of AFE clock"]
576 SUT960 = 15,
577}
578impl From<STARTUP_A> for u8 {
579 #[inline(always)]
580 fn from(variant: STARTUP_A) -> Self {
581 variant as _
582 }
583}
584#[doc = "Field `STARTUP` reader - Start-up Time"]
585pub struct STARTUP_R(crate::FieldReader<u8, STARTUP_A>);
586impl STARTUP_R {
587 #[inline(always)]
588 pub(crate) fn new(bits: u8) -> Self {
589 STARTUP_R(crate::FieldReader::new(bits))
590 }
591 #[doc = r"Get enumerated values variant"]
592 #[inline(always)]
593 pub fn variant(&self) -> STARTUP_A {
594 match self.bits {
595 0 => STARTUP_A::SUT0,
596 1 => STARTUP_A::SUT8,
597 2 => STARTUP_A::SUT16,
598 3 => STARTUP_A::SUT24,
599 4 => STARTUP_A::SUT64,
600 5 => STARTUP_A::SUT80,
601 6 => STARTUP_A::SUT96,
602 7 => STARTUP_A::SUT112,
603 8 => STARTUP_A::SUT512,
604 9 => STARTUP_A::SUT576,
605 10 => STARTUP_A::SUT640,
606 11 => STARTUP_A::SUT704,
607 12 => STARTUP_A::SUT768,
608 13 => STARTUP_A::SUT832,
609 14 => STARTUP_A::SUT896,
610 15 => STARTUP_A::SUT960,
611 _ => unreachable!(),
612 }
613 }
614 #[doc = "Checks if the value of the field is `SUT0`"]
615 #[inline(always)]
616 pub fn is_sut0(&self) -> bool {
617 **self == STARTUP_A::SUT0
618 }
619 #[doc = "Checks if the value of the field is `SUT8`"]
620 #[inline(always)]
621 pub fn is_sut8(&self) -> bool {
622 **self == STARTUP_A::SUT8
623 }
624 #[doc = "Checks if the value of the field is `SUT16`"]
625 #[inline(always)]
626 pub fn is_sut16(&self) -> bool {
627 **self == STARTUP_A::SUT16
628 }
629 #[doc = "Checks if the value of the field is `SUT24`"]
630 #[inline(always)]
631 pub fn is_sut24(&self) -> bool {
632 **self == STARTUP_A::SUT24
633 }
634 #[doc = "Checks if the value of the field is `SUT64`"]
635 #[inline(always)]
636 pub fn is_sut64(&self) -> bool {
637 **self == STARTUP_A::SUT64
638 }
639 #[doc = "Checks if the value of the field is `SUT80`"]
640 #[inline(always)]
641 pub fn is_sut80(&self) -> bool {
642 **self == STARTUP_A::SUT80
643 }
644 #[doc = "Checks if the value of the field is `SUT96`"]
645 #[inline(always)]
646 pub fn is_sut96(&self) -> bool {
647 **self == STARTUP_A::SUT96
648 }
649 #[doc = "Checks if the value of the field is `SUT112`"]
650 #[inline(always)]
651 pub fn is_sut112(&self) -> bool {
652 **self == STARTUP_A::SUT112
653 }
654 #[doc = "Checks if the value of the field is `SUT512`"]
655 #[inline(always)]
656 pub fn is_sut512(&self) -> bool {
657 **self == STARTUP_A::SUT512
658 }
659 #[doc = "Checks if the value of the field is `SUT576`"]
660 #[inline(always)]
661 pub fn is_sut576(&self) -> bool {
662 **self == STARTUP_A::SUT576
663 }
664 #[doc = "Checks if the value of the field is `SUT640`"]
665 #[inline(always)]
666 pub fn is_sut640(&self) -> bool {
667 **self == STARTUP_A::SUT640
668 }
669 #[doc = "Checks if the value of the field is `SUT704`"]
670 #[inline(always)]
671 pub fn is_sut704(&self) -> bool {
672 **self == STARTUP_A::SUT704
673 }
674 #[doc = "Checks if the value of the field is `SUT768`"]
675 #[inline(always)]
676 pub fn is_sut768(&self) -> bool {
677 **self == STARTUP_A::SUT768
678 }
679 #[doc = "Checks if the value of the field is `SUT832`"]
680 #[inline(always)]
681 pub fn is_sut832(&self) -> bool {
682 **self == STARTUP_A::SUT832
683 }
684 #[doc = "Checks if the value of the field is `SUT896`"]
685 #[inline(always)]
686 pub fn is_sut896(&self) -> bool {
687 **self == STARTUP_A::SUT896
688 }
689 #[doc = "Checks if the value of the field is `SUT960`"]
690 #[inline(always)]
691 pub fn is_sut960(&self) -> bool {
692 **self == STARTUP_A::SUT960
693 }
694}
695impl core::ops::Deref for STARTUP_R {
696 type Target = crate::FieldReader<u8, STARTUP_A>;
697 #[inline(always)]
698 fn deref(&self) -> &Self::Target {
699 &self.0
700 }
701}
702#[doc = "Field `STARTUP` writer - Start-up Time"]
703pub struct STARTUP_W<'a> {
704 w: &'a mut W,
705}
706impl<'a> STARTUP_W<'a> {
707 #[doc = r"Writes `variant` to the field"]
708 #[inline(always)]
709 pub fn variant(self, variant: STARTUP_A) -> &'a mut W {
710 self.bits(variant.into())
711 }
712 #[doc = "0 periods of AFE clock"]
713 #[inline(always)]
714 pub fn sut0(self) -> &'a mut W {
715 self.variant(STARTUP_A::SUT0)
716 }
717 #[doc = "8 periods of AFE clock"]
718 #[inline(always)]
719 pub fn sut8(self) -> &'a mut W {
720 self.variant(STARTUP_A::SUT8)
721 }
722 #[doc = "16 periods of AFE clock"]
723 #[inline(always)]
724 pub fn sut16(self) -> &'a mut W {
725 self.variant(STARTUP_A::SUT16)
726 }
727 #[doc = "24 periods of AFE clock"]
728 #[inline(always)]
729 pub fn sut24(self) -> &'a mut W {
730 self.variant(STARTUP_A::SUT24)
731 }
732 #[doc = "64 periods of AFE clock"]
733 #[inline(always)]
734 pub fn sut64(self) -> &'a mut W {
735 self.variant(STARTUP_A::SUT64)
736 }
737 #[doc = "80 periods of AFE clock"]
738 #[inline(always)]
739 pub fn sut80(self) -> &'a mut W {
740 self.variant(STARTUP_A::SUT80)
741 }
742 #[doc = "96 periods of AFE clock"]
743 #[inline(always)]
744 pub fn sut96(self) -> &'a mut W {
745 self.variant(STARTUP_A::SUT96)
746 }
747 #[doc = "112 periods of AFE clock"]
748 #[inline(always)]
749 pub fn sut112(self) -> &'a mut W {
750 self.variant(STARTUP_A::SUT112)
751 }
752 #[doc = "512 periods of AFE clock"]
753 #[inline(always)]
754 pub fn sut512(self) -> &'a mut W {
755 self.variant(STARTUP_A::SUT512)
756 }
757 #[doc = "576 periods of AFE clock"]
758 #[inline(always)]
759 pub fn sut576(self) -> &'a mut W {
760 self.variant(STARTUP_A::SUT576)
761 }
762 #[doc = "640 periods of AFE clock"]
763 #[inline(always)]
764 pub fn sut640(self) -> &'a mut W {
765 self.variant(STARTUP_A::SUT640)
766 }
767 #[doc = "704 periods of AFE clock"]
768 #[inline(always)]
769 pub fn sut704(self) -> &'a mut W {
770 self.variant(STARTUP_A::SUT704)
771 }
772 #[doc = "768 periods of AFE clock"]
773 #[inline(always)]
774 pub fn sut768(self) -> &'a mut W {
775 self.variant(STARTUP_A::SUT768)
776 }
777 #[doc = "832 periods of AFE clock"]
778 #[inline(always)]
779 pub fn sut832(self) -> &'a mut W {
780 self.variant(STARTUP_A::SUT832)
781 }
782 #[doc = "896 periods of AFE clock"]
783 #[inline(always)]
784 pub fn sut896(self) -> &'a mut W {
785 self.variant(STARTUP_A::SUT896)
786 }
787 #[doc = "960 periods of AFE clock"]
788 #[inline(always)]
789 pub fn sut960(self) -> &'a mut W {
790 self.variant(STARTUP_A::SUT960)
791 }
792 #[doc = r"Writes raw bits to the field"]
793 #[inline(always)]
794 pub fn bits(self, value: u8) -> &'a mut W {
795 self.w.bits = (self.w.bits & !(0x0f << 16)) | ((value as u32 & 0x0f) << 16);
796 self.w
797 }
798}
799#[doc = "Field `ONE` reader - One"]
800pub struct ONE_R(crate::FieldReader<bool, bool>);
801impl ONE_R {
802 #[inline(always)]
803 pub(crate) fn new(bits: bool) -> Self {
804 ONE_R(crate::FieldReader::new(bits))
805 }
806}
807impl core::ops::Deref for ONE_R {
808 type Target = crate::FieldReader<bool, bool>;
809 #[inline(always)]
810 fn deref(&self) -> &Self::Target {
811 &self.0
812 }
813}
814#[doc = "Field `ONE` writer - One"]
815pub struct ONE_W<'a> {
816 w: &'a mut W,
817}
818impl<'a> ONE_W<'a> {
819 #[doc = r"Sets the field bit"]
820 #[inline(always)]
821 pub fn set_bit(self) -> &'a mut W {
822 self.bit(true)
823 }
824 #[doc = r"Clears the field bit"]
825 #[inline(always)]
826 pub fn clear_bit(self) -> &'a mut W {
827 self.bit(false)
828 }
829 #[doc = r"Writes raw bits to the field"]
830 #[inline(always)]
831 pub fn bit(self, value: bool) -> &'a mut W {
832 self.w.bits = (self.w.bits & !(0x01 << 23)) | ((value as u32 & 0x01) << 23);
833 self.w
834 }
835}
836#[doc = "Field `TRACKTIM` reader - Tracking Time"]
837pub struct TRACKTIM_R(crate::FieldReader<u8, u8>);
838impl TRACKTIM_R {
839 #[inline(always)]
840 pub(crate) fn new(bits: u8) -> Self {
841 TRACKTIM_R(crate::FieldReader::new(bits))
842 }
843}
844impl core::ops::Deref for TRACKTIM_R {
845 type Target = crate::FieldReader<u8, u8>;
846 #[inline(always)]
847 fn deref(&self) -> &Self::Target {
848 &self.0
849 }
850}
851#[doc = "Field `TRACKTIM` writer - Tracking Time"]
852pub struct TRACKTIM_W<'a> {
853 w: &'a mut W,
854}
855impl<'a> TRACKTIM_W<'a> {
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 & !(0x0f << 24)) | ((value as u32 & 0x0f) << 24);
860 self.w
861 }
862}
863#[doc = "Field `TRANSFER` reader - Transfer Period"]
864pub struct TRANSFER_R(crate::FieldReader<u8, u8>);
865impl TRANSFER_R {
866 #[inline(always)]
867 pub(crate) fn new(bits: u8) -> Self {
868 TRANSFER_R(crate::FieldReader::new(bits))
869 }
870}
871impl core::ops::Deref for TRANSFER_R {
872 type Target = crate::FieldReader<u8, u8>;
873 #[inline(always)]
874 fn deref(&self) -> &Self::Target {
875 &self.0
876 }
877}
878#[doc = "Field `TRANSFER` writer - Transfer Period"]
879pub struct TRANSFER_W<'a> {
880 w: &'a mut W,
881}
882impl<'a> TRANSFER_W<'a> {
883 #[doc = r"Writes raw bits to the field"]
884 #[inline(always)]
885 pub unsafe fn bits(self, value: u8) -> &'a mut W {
886 self.w.bits = (self.w.bits & !(0x03 << 28)) | ((value as u32 & 0x03) << 28);
887 self.w
888 }
889}
890#[doc = "User Sequence Enable\n\nValue on reset: 0"]
891#[derive(Clone, Copy, Debug, PartialEq)]
892pub enum USEQ_A {
893 #[doc = "0: Normal mode: The controller converts channels in a simple numeric order."]
894 NUM_ORDER = 0,
895 #[doc = "1: User Sequence mode: The sequence respects what is defined in AFEC_SEQ1R and AFEC_SEQ1R."]
896 REG_ORDER = 1,
897}
898impl From<USEQ_A> for bool {
899 #[inline(always)]
900 fn from(variant: USEQ_A) -> Self {
901 variant as u8 != 0
902 }
903}
904#[doc = "Field `USEQ` reader - User Sequence Enable"]
905pub struct USEQ_R(crate::FieldReader<bool, USEQ_A>);
906impl USEQ_R {
907 #[inline(always)]
908 pub(crate) fn new(bits: bool) -> Self {
909 USEQ_R(crate::FieldReader::new(bits))
910 }
911 #[doc = r"Get enumerated values variant"]
912 #[inline(always)]
913 pub fn variant(&self) -> USEQ_A {
914 match self.bits {
915 false => USEQ_A::NUM_ORDER,
916 true => USEQ_A::REG_ORDER,
917 }
918 }
919 #[doc = "Checks if the value of the field is `NUM_ORDER`"]
920 #[inline(always)]
921 pub fn is_num_order(&self) -> bool {
922 **self == USEQ_A::NUM_ORDER
923 }
924 #[doc = "Checks if the value of the field is `REG_ORDER`"]
925 #[inline(always)]
926 pub fn is_reg_order(&self) -> bool {
927 **self == USEQ_A::REG_ORDER
928 }
929}
930impl core::ops::Deref for USEQ_R {
931 type Target = crate::FieldReader<bool, USEQ_A>;
932 #[inline(always)]
933 fn deref(&self) -> &Self::Target {
934 &self.0
935 }
936}
937#[doc = "Field `USEQ` writer - User Sequence Enable"]
938pub struct USEQ_W<'a> {
939 w: &'a mut W,
940}
941impl<'a> USEQ_W<'a> {
942 #[doc = r"Writes `variant` to the field"]
943 #[inline(always)]
944 pub fn variant(self, variant: USEQ_A) -> &'a mut W {
945 self.bit(variant.into())
946 }
947 #[doc = "Normal mode: The controller converts channels in a simple numeric order."]
948 #[inline(always)]
949 pub fn num_order(self) -> &'a mut W {
950 self.variant(USEQ_A::NUM_ORDER)
951 }
952 #[doc = "User Sequence mode: The sequence respects what is defined in AFEC_SEQ1R and AFEC_SEQ1R."]
953 #[inline(always)]
954 pub fn reg_order(self) -> &'a mut W {
955 self.variant(USEQ_A::REG_ORDER)
956 }
957 #[doc = r"Sets the field bit"]
958 #[inline(always)]
959 pub fn set_bit(self) -> &'a mut W {
960 self.bit(true)
961 }
962 #[doc = r"Clears the field bit"]
963 #[inline(always)]
964 pub fn clear_bit(self) -> &'a mut W {
965 self.bit(false)
966 }
967 #[doc = r"Writes raw bits to the field"]
968 #[inline(always)]
969 pub fn bit(self, value: bool) -> &'a mut W {
970 self.w.bits = (self.w.bits & !(0x01 << 31)) | ((value as u32 & 0x01) << 31);
971 self.w
972 }
973}
974impl R {
975 #[doc = "Bit 0 - Trigger Enable"]
976 #[inline(always)]
977 pub fn trgen(&self) -> TRGEN_R {
978 TRGEN_R::new((self.bits & 0x01) != 0)
979 }
980 #[doc = "Bits 1:3 - Trigger Selection"]
981 #[inline(always)]
982 pub fn trgsel(&self) -> TRGSEL_R {
983 TRGSEL_R::new(((self.bits >> 1) & 0x07) as u8)
984 }
985 #[doc = "Bit 5 - Sleep Mode"]
986 #[inline(always)]
987 pub fn sleep(&self) -> SLEEP_R {
988 SLEEP_R::new(((self.bits >> 5) & 0x01) != 0)
989 }
990 #[doc = "Bit 6 - Fast Wake-up"]
991 #[inline(always)]
992 pub fn fwup(&self) -> FWUP_R {
993 FWUP_R::new(((self.bits >> 6) & 0x01) != 0)
994 }
995 #[doc = "Bit 7 - Free Run Mode"]
996 #[inline(always)]
997 pub fn freerun(&self) -> FREERUN_R {
998 FREERUN_R::new(((self.bits >> 7) & 0x01) != 0)
999 }
1000 #[doc = "Bits 8:15 - Prescaler Rate Selection"]
1001 #[inline(always)]
1002 pub fn prescal(&self) -> PRESCAL_R {
1003 PRESCAL_R::new(((self.bits >> 8) & 0xff) as u8)
1004 }
1005 #[doc = "Bits 16:19 - Start-up Time"]
1006 #[inline(always)]
1007 pub fn startup(&self) -> STARTUP_R {
1008 STARTUP_R::new(((self.bits >> 16) & 0x0f) as u8)
1009 }
1010 #[doc = "Bit 23 - One"]
1011 #[inline(always)]
1012 pub fn one(&self) -> ONE_R {
1013 ONE_R::new(((self.bits >> 23) & 0x01) != 0)
1014 }
1015 #[doc = "Bits 24:27 - Tracking Time"]
1016 #[inline(always)]
1017 pub fn tracktim(&self) -> TRACKTIM_R {
1018 TRACKTIM_R::new(((self.bits >> 24) & 0x0f) as u8)
1019 }
1020 #[doc = "Bits 28:29 - Transfer Period"]
1021 #[inline(always)]
1022 pub fn transfer(&self) -> TRANSFER_R {
1023 TRANSFER_R::new(((self.bits >> 28) & 0x03) as u8)
1024 }
1025 #[doc = "Bit 31 - User Sequence Enable"]
1026 #[inline(always)]
1027 pub fn useq(&self) -> USEQ_R {
1028 USEQ_R::new(((self.bits >> 31) & 0x01) != 0)
1029 }
1030}
1031impl W {
1032 #[doc = "Bit 0 - Trigger Enable"]
1033 #[inline(always)]
1034 pub fn trgen(&mut self) -> TRGEN_W {
1035 TRGEN_W { w: self }
1036 }
1037 #[doc = "Bits 1:3 - Trigger Selection"]
1038 #[inline(always)]
1039 pub fn trgsel(&mut self) -> TRGSEL_W {
1040 TRGSEL_W { w: self }
1041 }
1042 #[doc = "Bit 5 - Sleep Mode"]
1043 #[inline(always)]
1044 pub fn sleep(&mut self) -> SLEEP_W {
1045 SLEEP_W { w: self }
1046 }
1047 #[doc = "Bit 6 - Fast Wake-up"]
1048 #[inline(always)]
1049 pub fn fwup(&mut self) -> FWUP_W {
1050 FWUP_W { w: self }
1051 }
1052 #[doc = "Bit 7 - Free Run Mode"]
1053 #[inline(always)]
1054 pub fn freerun(&mut self) -> FREERUN_W {
1055 FREERUN_W { w: self }
1056 }
1057 #[doc = "Bits 8:15 - Prescaler Rate Selection"]
1058 #[inline(always)]
1059 pub fn prescal(&mut self) -> PRESCAL_W {
1060 PRESCAL_W { w: self }
1061 }
1062 #[doc = "Bits 16:19 - Start-up Time"]
1063 #[inline(always)]
1064 pub fn startup(&mut self) -> STARTUP_W {
1065 STARTUP_W { w: self }
1066 }
1067 #[doc = "Bit 23 - One"]
1068 #[inline(always)]
1069 pub fn one(&mut self) -> ONE_W {
1070 ONE_W { w: self }
1071 }
1072 #[doc = "Bits 24:27 - Tracking Time"]
1073 #[inline(always)]
1074 pub fn tracktim(&mut self) -> TRACKTIM_W {
1075 TRACKTIM_W { w: self }
1076 }
1077 #[doc = "Bits 28:29 - Transfer Period"]
1078 #[inline(always)]
1079 pub fn transfer(&mut self) -> TRANSFER_W {
1080 TRANSFER_W { w: self }
1081 }
1082 #[doc = "Bit 31 - User Sequence Enable"]
1083 #[inline(always)]
1084 pub fn useq(&mut self) -> USEQ_W {
1085 USEQ_W { w: self }
1086 }
1087 #[doc = "Writes raw bits to the register."]
1088 #[inline(always)]
1089 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
1090 self.0.bits(bits);
1091 self
1092 }
1093}
1094#[doc = "AFEC 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 [afec_mr](index.html) module"]
1095pub struct AFEC_MR_SPEC;
1096impl crate::RegisterSpec for AFEC_MR_SPEC {
1097 type Ux = u32;
1098}
1099#[doc = "`read()` method returns [afec_mr::R](R) reader structure"]
1100impl crate::Readable for AFEC_MR_SPEC {
1101 type Reader = R;
1102}
1103#[doc = "`write(|w| ..)` method takes [afec_mr::W](W) writer structure"]
1104impl crate::Writable for AFEC_MR_SPEC {
1105 type Writer = W;
1106}
1107#[doc = "`reset()` method sets AFEC_MR to value 0"]
1108impl crate::Resettable for AFEC_MR_SPEC {
1109 #[inline(always)]
1110 fn reset_value() -> Self::Ux {
1111 0
1112 }
1113}