1#[doc = "Register `CMDH1` reader"]
2pub type R = crate::R<Cmdh1Spec>;
3#[doc = "Register `CMDH1` writer"]
4pub type W = crate::W<Cmdh1Spec>;
5#[doc = "Compare Function Enable\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Cmpen {
10 #[doc = "0: Compare disabled."]
11 DisabledAlwaysStoreResult = 0,
12 #[doc = "2: Compare enabled. Store on true."]
13 CompareResultStoreIfTrue = 2,
14 #[doc = "3: Compare enabled. Repeat channel acquisition (sample/convert/compare) until true."]
15 CompareResultKeepConvertingUntilTrueStoreIfTrue = 3,
16}
17impl From<Cmpen> for u8 {
18 #[inline(always)]
19 fn from(variant: Cmpen) -> Self {
20 variant as _
21 }
22}
23impl crate::FieldSpec for Cmpen {
24 type Ux = u8;
25}
26impl crate::IsEnum for Cmpen {}
27#[doc = "Field `CMPEN` reader - Compare Function Enable"]
28pub type CmpenR = crate::FieldReader<Cmpen>;
29impl CmpenR {
30 #[doc = "Get enumerated values variant"]
31 #[inline(always)]
32 pub const fn variant(&self) -> Option<Cmpen> {
33 match self.bits {
34 0 => Some(Cmpen::DisabledAlwaysStoreResult),
35 2 => Some(Cmpen::CompareResultStoreIfTrue),
36 3 => Some(Cmpen::CompareResultKeepConvertingUntilTrueStoreIfTrue),
37 _ => None,
38 }
39 }
40 #[doc = "Compare disabled."]
41 #[inline(always)]
42 pub fn is_disabled_always_store_result(&self) -> bool {
43 *self == Cmpen::DisabledAlwaysStoreResult
44 }
45 #[doc = "Compare enabled. Store on true."]
46 #[inline(always)]
47 pub fn is_compare_result_store_if_true(&self) -> bool {
48 *self == Cmpen::CompareResultStoreIfTrue
49 }
50 #[doc = "Compare enabled. Repeat channel acquisition (sample/convert/compare) until true."]
51 #[inline(always)]
52 pub fn is_compare_result_keep_converting_until_true_store_if_true(&self) -> bool {
53 *self == Cmpen::CompareResultKeepConvertingUntilTrueStoreIfTrue
54 }
55}
56#[doc = "Field `CMPEN` writer - Compare Function Enable"]
57pub type CmpenW<'a, REG> = crate::FieldWriter<'a, REG, 2, Cmpen>;
58impl<'a, REG> CmpenW<'a, REG>
59where
60 REG: crate::Writable + crate::RegisterSpec,
61 REG::Ux: From<u8>,
62{
63 #[doc = "Compare disabled."]
64 #[inline(always)]
65 pub fn disabled_always_store_result(self) -> &'a mut crate::W<REG> {
66 self.variant(Cmpen::DisabledAlwaysStoreResult)
67 }
68 #[doc = "Compare enabled. Store on true."]
69 #[inline(always)]
70 pub fn compare_result_store_if_true(self) -> &'a mut crate::W<REG> {
71 self.variant(Cmpen::CompareResultStoreIfTrue)
72 }
73 #[doc = "Compare enabled. Repeat channel acquisition (sample/convert/compare) until true."]
74 #[inline(always)]
75 pub fn compare_result_keep_converting_until_true_store_if_true(self) -> &'a mut crate::W<REG> {
76 self.variant(Cmpen::CompareResultKeepConvertingUntilTrueStoreIfTrue)
77 }
78}
79#[doc = "Wait for Trigger Assertion before Execution.\n\nValue on reset: 0"]
80#[cfg_attr(feature = "defmt", derive(defmt::Format))]
81#[derive(Clone, Copy, Debug, PartialEq, Eq)]
82pub enum WaitTrig {
83 #[doc = "0: This command will be automatically executed."]
84 Disabled = 0,
85 #[doc = "1: The active trigger must be asserted again before executing this command."]
86 Enabled = 1,
87}
88impl From<WaitTrig> for bool {
89 #[inline(always)]
90 fn from(variant: WaitTrig) -> Self {
91 variant as u8 != 0
92 }
93}
94#[doc = "Field `WAIT_TRIG` reader - Wait for Trigger Assertion before Execution."]
95pub type WaitTrigR = crate::BitReader<WaitTrig>;
96impl WaitTrigR {
97 #[doc = "Get enumerated values variant"]
98 #[inline(always)]
99 pub const fn variant(&self) -> WaitTrig {
100 match self.bits {
101 false => WaitTrig::Disabled,
102 true => WaitTrig::Enabled,
103 }
104 }
105 #[doc = "This command will be automatically executed."]
106 #[inline(always)]
107 pub fn is_disabled(&self) -> bool {
108 *self == WaitTrig::Disabled
109 }
110 #[doc = "The active trigger must be asserted again before executing this command."]
111 #[inline(always)]
112 pub fn is_enabled(&self) -> bool {
113 *self == WaitTrig::Enabled
114 }
115}
116#[doc = "Field `WAIT_TRIG` writer - Wait for Trigger Assertion before Execution."]
117pub type WaitTrigW<'a, REG> = crate::BitWriter<'a, REG, WaitTrig>;
118impl<'a, REG> WaitTrigW<'a, REG>
119where
120 REG: crate::Writable + crate::RegisterSpec,
121{
122 #[doc = "This command will be automatically executed."]
123 #[inline(always)]
124 pub fn disabled(self) -> &'a mut crate::W<REG> {
125 self.variant(WaitTrig::Disabled)
126 }
127 #[doc = "The active trigger must be asserted again before executing this command."]
128 #[inline(always)]
129 pub fn enabled(self) -> &'a mut crate::W<REG> {
130 self.variant(WaitTrig::Enabled)
131 }
132}
133#[doc = "Loop with Increment\n\nValue on reset: 0"]
134#[cfg_attr(feature = "defmt", derive(defmt::Format))]
135#[derive(Clone, Copy, Debug, PartialEq, Eq)]
136pub enum Lwi {
137 #[doc = "0: Auto channel increment disabled"]
138 Disabled = 0,
139 #[doc = "1: Auto channel increment enabled"]
140 Enabled = 1,
141}
142impl From<Lwi> for bool {
143 #[inline(always)]
144 fn from(variant: Lwi) -> Self {
145 variant as u8 != 0
146 }
147}
148#[doc = "Field `LWI` reader - Loop with Increment"]
149pub type LwiR = crate::BitReader<Lwi>;
150impl LwiR {
151 #[doc = "Get enumerated values variant"]
152 #[inline(always)]
153 pub const fn variant(&self) -> Lwi {
154 match self.bits {
155 false => Lwi::Disabled,
156 true => Lwi::Enabled,
157 }
158 }
159 #[doc = "Auto channel increment disabled"]
160 #[inline(always)]
161 pub fn is_disabled(&self) -> bool {
162 *self == Lwi::Disabled
163 }
164 #[doc = "Auto channel increment enabled"]
165 #[inline(always)]
166 pub fn is_enabled(&self) -> bool {
167 *self == Lwi::Enabled
168 }
169}
170#[doc = "Field `LWI` writer - Loop with Increment"]
171pub type LwiW<'a, REG> = crate::BitWriter<'a, REG, Lwi>;
172impl<'a, REG> LwiW<'a, REG>
173where
174 REG: crate::Writable + crate::RegisterSpec,
175{
176 #[doc = "Auto channel increment disabled"]
177 #[inline(always)]
178 pub fn disabled(self) -> &'a mut crate::W<REG> {
179 self.variant(Lwi::Disabled)
180 }
181 #[doc = "Auto channel increment enabled"]
182 #[inline(always)]
183 pub fn enabled(self) -> &'a mut crate::W<REG> {
184 self.variant(Lwi::Enabled)
185 }
186}
187#[doc = "Sample Time Select\n\nValue on reset: 0"]
188#[cfg_attr(feature = "defmt", derive(defmt::Format))]
189#[derive(Clone, Copy, Debug, PartialEq, Eq)]
190#[repr(u8)]
191pub enum Sts {
192 #[doc = "0: Minimum sample time of 3.5 ADCK cycles."]
193 Sample3p5 = 0,
194 #[doc = "1: 3.5 + 21 ADCK cycles; 5.5 ADCK cycles total sample time."]
195 Sample5p5 = 1,
196 #[doc = "2: 3.5 + 22 ADCK cycles; 7.5 ADCK cycles total sample time."]
197 Sample7p5 = 2,
198 #[doc = "3: 3.5 + 23 ADCK cycles; 11.5 ADCK cycles total sample time."]
199 Sample11p5 = 3,
200 #[doc = "4: 3.5 + 24 ADCK cycles; 19.5 ADCK cycles total sample time."]
201 Sample19p5 = 4,
202 #[doc = "5: 3.5 + 25 ADCK cycles; 35.5 ADCK cycles total sample time."]
203 Sample35p5 = 5,
204 #[doc = "6: 3.5 + 26 ADCK cycles; 67.5 ADCK cycles total sample time."]
205 Sample67p5 = 6,
206 #[doc = "7: 3.5 + 27 ADCK cycles; 131.5 ADCK cycles total sample time."]
207 Sample131p5 = 7,
208}
209impl From<Sts> for u8 {
210 #[inline(always)]
211 fn from(variant: Sts) -> Self {
212 variant as _
213 }
214}
215impl crate::FieldSpec for Sts {
216 type Ux = u8;
217}
218impl crate::IsEnum for Sts {}
219#[doc = "Field `STS` reader - Sample Time Select"]
220pub type StsR = crate::FieldReader<Sts>;
221impl StsR {
222 #[doc = "Get enumerated values variant"]
223 #[inline(always)]
224 pub const fn variant(&self) -> Sts {
225 match self.bits {
226 0 => Sts::Sample3p5,
227 1 => Sts::Sample5p5,
228 2 => Sts::Sample7p5,
229 3 => Sts::Sample11p5,
230 4 => Sts::Sample19p5,
231 5 => Sts::Sample35p5,
232 6 => Sts::Sample67p5,
233 7 => Sts::Sample131p5,
234 _ => unreachable!(),
235 }
236 }
237 #[doc = "Minimum sample time of 3.5 ADCK cycles."]
238 #[inline(always)]
239 pub fn is_sample_3p5(&self) -> bool {
240 *self == Sts::Sample3p5
241 }
242 #[doc = "3.5 + 21 ADCK cycles; 5.5 ADCK cycles total sample time."]
243 #[inline(always)]
244 pub fn is_sample_5p5(&self) -> bool {
245 *self == Sts::Sample5p5
246 }
247 #[doc = "3.5 + 22 ADCK cycles; 7.5 ADCK cycles total sample time."]
248 #[inline(always)]
249 pub fn is_sample_7p5(&self) -> bool {
250 *self == Sts::Sample7p5
251 }
252 #[doc = "3.5 + 23 ADCK cycles; 11.5 ADCK cycles total sample time."]
253 #[inline(always)]
254 pub fn is_sample_11p5(&self) -> bool {
255 *self == Sts::Sample11p5
256 }
257 #[doc = "3.5 + 24 ADCK cycles; 19.5 ADCK cycles total sample time."]
258 #[inline(always)]
259 pub fn is_sample_19p5(&self) -> bool {
260 *self == Sts::Sample19p5
261 }
262 #[doc = "3.5 + 25 ADCK cycles; 35.5 ADCK cycles total sample time."]
263 #[inline(always)]
264 pub fn is_sample_35p5(&self) -> bool {
265 *self == Sts::Sample35p5
266 }
267 #[doc = "3.5 + 26 ADCK cycles; 67.5 ADCK cycles total sample time."]
268 #[inline(always)]
269 pub fn is_sample_67p5(&self) -> bool {
270 *self == Sts::Sample67p5
271 }
272 #[doc = "3.5 + 27 ADCK cycles; 131.5 ADCK cycles total sample time."]
273 #[inline(always)]
274 pub fn is_sample_131p5(&self) -> bool {
275 *self == Sts::Sample131p5
276 }
277}
278#[doc = "Field `STS` writer - Sample Time Select"]
279pub type StsW<'a, REG> = crate::FieldWriter<'a, REG, 3, Sts, crate::Safe>;
280impl<'a, REG> StsW<'a, REG>
281where
282 REG: crate::Writable + crate::RegisterSpec,
283 REG::Ux: From<u8>,
284{
285 #[doc = "Minimum sample time of 3.5 ADCK cycles."]
286 #[inline(always)]
287 pub fn sample_3p5(self) -> &'a mut crate::W<REG> {
288 self.variant(Sts::Sample3p5)
289 }
290 #[doc = "3.5 + 21 ADCK cycles; 5.5 ADCK cycles total sample time."]
291 #[inline(always)]
292 pub fn sample_5p5(self) -> &'a mut crate::W<REG> {
293 self.variant(Sts::Sample5p5)
294 }
295 #[doc = "3.5 + 22 ADCK cycles; 7.5 ADCK cycles total sample time."]
296 #[inline(always)]
297 pub fn sample_7p5(self) -> &'a mut crate::W<REG> {
298 self.variant(Sts::Sample7p5)
299 }
300 #[doc = "3.5 + 23 ADCK cycles; 11.5 ADCK cycles total sample time."]
301 #[inline(always)]
302 pub fn sample_11p5(self) -> &'a mut crate::W<REG> {
303 self.variant(Sts::Sample11p5)
304 }
305 #[doc = "3.5 + 24 ADCK cycles; 19.5 ADCK cycles total sample time."]
306 #[inline(always)]
307 pub fn sample_19p5(self) -> &'a mut crate::W<REG> {
308 self.variant(Sts::Sample19p5)
309 }
310 #[doc = "3.5 + 25 ADCK cycles; 35.5 ADCK cycles total sample time."]
311 #[inline(always)]
312 pub fn sample_35p5(self) -> &'a mut crate::W<REG> {
313 self.variant(Sts::Sample35p5)
314 }
315 #[doc = "3.5 + 26 ADCK cycles; 67.5 ADCK cycles total sample time."]
316 #[inline(always)]
317 pub fn sample_67p5(self) -> &'a mut crate::W<REG> {
318 self.variant(Sts::Sample67p5)
319 }
320 #[doc = "3.5 + 27 ADCK cycles; 131.5 ADCK cycles total sample time."]
321 #[inline(always)]
322 pub fn sample_131p5(self) -> &'a mut crate::W<REG> {
323 self.variant(Sts::Sample131p5)
324 }
325}
326#[doc = "Hardware Average Select\n\nValue on reset: 0"]
327#[cfg_attr(feature = "defmt", derive(defmt::Format))]
328#[derive(Clone, Copy, Debug, PartialEq, Eq)]
329#[repr(u8)]
330pub enum Avgs {
331 #[doc = "0: Single conversion."]
332 NoAverage = 0,
333 #[doc = "1: 2 conversions averaged."]
334 Average2 = 1,
335 #[doc = "2: 4 conversions averaged."]
336 Average4 = 2,
337 #[doc = "3: 8 conversions averaged."]
338 Average8 = 3,
339 #[doc = "4: 16 conversions averaged."]
340 Average16 = 4,
341 #[doc = "5: 32 conversions averaged."]
342 Average32 = 5,
343 #[doc = "6: 64 conversions averaged."]
344 Average64 = 6,
345 #[doc = "7: 128 conversions averaged."]
346 Average128 = 7,
347 #[doc = "8: 256 conversions averaged."]
348 Average256 = 8,
349 #[doc = "9: 512 conversions averaged."]
350 Average512 = 9,
351 #[doc = "10: 1024 conversions averaged."]
352 Average1024 = 10,
353}
354impl From<Avgs> for u8 {
355 #[inline(always)]
356 fn from(variant: Avgs) -> Self {
357 variant as _
358 }
359}
360impl crate::FieldSpec for Avgs {
361 type Ux = u8;
362}
363impl crate::IsEnum for Avgs {}
364#[doc = "Field `AVGS` reader - Hardware Average Select"]
365pub type AvgsR = crate::FieldReader<Avgs>;
366impl AvgsR {
367 #[doc = "Get enumerated values variant"]
368 #[inline(always)]
369 pub const fn variant(&self) -> Option<Avgs> {
370 match self.bits {
371 0 => Some(Avgs::NoAverage),
372 1 => Some(Avgs::Average2),
373 2 => Some(Avgs::Average4),
374 3 => Some(Avgs::Average8),
375 4 => Some(Avgs::Average16),
376 5 => Some(Avgs::Average32),
377 6 => Some(Avgs::Average64),
378 7 => Some(Avgs::Average128),
379 8 => Some(Avgs::Average256),
380 9 => Some(Avgs::Average512),
381 10 => Some(Avgs::Average1024),
382 _ => None,
383 }
384 }
385 #[doc = "Single conversion."]
386 #[inline(always)]
387 pub fn is_no_average(&self) -> bool {
388 *self == Avgs::NoAverage
389 }
390 #[doc = "2 conversions averaged."]
391 #[inline(always)]
392 pub fn is_average_2(&self) -> bool {
393 *self == Avgs::Average2
394 }
395 #[doc = "4 conversions averaged."]
396 #[inline(always)]
397 pub fn is_average_4(&self) -> bool {
398 *self == Avgs::Average4
399 }
400 #[doc = "8 conversions averaged."]
401 #[inline(always)]
402 pub fn is_average_8(&self) -> bool {
403 *self == Avgs::Average8
404 }
405 #[doc = "16 conversions averaged."]
406 #[inline(always)]
407 pub fn is_average_16(&self) -> bool {
408 *self == Avgs::Average16
409 }
410 #[doc = "32 conversions averaged."]
411 #[inline(always)]
412 pub fn is_average_32(&self) -> bool {
413 *self == Avgs::Average32
414 }
415 #[doc = "64 conversions averaged."]
416 #[inline(always)]
417 pub fn is_average_64(&self) -> bool {
418 *self == Avgs::Average64
419 }
420 #[doc = "128 conversions averaged."]
421 #[inline(always)]
422 pub fn is_average_128(&self) -> bool {
423 *self == Avgs::Average128
424 }
425 #[doc = "256 conversions averaged."]
426 #[inline(always)]
427 pub fn is_average_256(&self) -> bool {
428 *self == Avgs::Average256
429 }
430 #[doc = "512 conversions averaged."]
431 #[inline(always)]
432 pub fn is_average_512(&self) -> bool {
433 *self == Avgs::Average512
434 }
435 #[doc = "1024 conversions averaged."]
436 #[inline(always)]
437 pub fn is_average_1024(&self) -> bool {
438 *self == Avgs::Average1024
439 }
440}
441#[doc = "Field `AVGS` writer - Hardware Average Select"]
442pub type AvgsW<'a, REG> = crate::FieldWriter<'a, REG, 4, Avgs>;
443impl<'a, REG> AvgsW<'a, REG>
444where
445 REG: crate::Writable + crate::RegisterSpec,
446 REG::Ux: From<u8>,
447{
448 #[doc = "Single conversion."]
449 #[inline(always)]
450 pub fn no_average(self) -> &'a mut crate::W<REG> {
451 self.variant(Avgs::NoAverage)
452 }
453 #[doc = "2 conversions averaged."]
454 #[inline(always)]
455 pub fn average_2(self) -> &'a mut crate::W<REG> {
456 self.variant(Avgs::Average2)
457 }
458 #[doc = "4 conversions averaged."]
459 #[inline(always)]
460 pub fn average_4(self) -> &'a mut crate::W<REG> {
461 self.variant(Avgs::Average4)
462 }
463 #[doc = "8 conversions averaged."]
464 #[inline(always)]
465 pub fn average_8(self) -> &'a mut crate::W<REG> {
466 self.variant(Avgs::Average8)
467 }
468 #[doc = "16 conversions averaged."]
469 #[inline(always)]
470 pub fn average_16(self) -> &'a mut crate::W<REG> {
471 self.variant(Avgs::Average16)
472 }
473 #[doc = "32 conversions averaged."]
474 #[inline(always)]
475 pub fn average_32(self) -> &'a mut crate::W<REG> {
476 self.variant(Avgs::Average32)
477 }
478 #[doc = "64 conversions averaged."]
479 #[inline(always)]
480 pub fn average_64(self) -> &'a mut crate::W<REG> {
481 self.variant(Avgs::Average64)
482 }
483 #[doc = "128 conversions averaged."]
484 #[inline(always)]
485 pub fn average_128(self) -> &'a mut crate::W<REG> {
486 self.variant(Avgs::Average128)
487 }
488 #[doc = "256 conversions averaged."]
489 #[inline(always)]
490 pub fn average_256(self) -> &'a mut crate::W<REG> {
491 self.variant(Avgs::Average256)
492 }
493 #[doc = "512 conversions averaged."]
494 #[inline(always)]
495 pub fn average_512(self) -> &'a mut crate::W<REG> {
496 self.variant(Avgs::Average512)
497 }
498 #[doc = "1024 conversions averaged."]
499 #[inline(always)]
500 pub fn average_1024(self) -> &'a mut crate::W<REG> {
501 self.variant(Avgs::Average1024)
502 }
503}
504#[doc = "Loop Count Select\n\nValue on reset: 0"]
505#[cfg_attr(feature = "defmt", derive(defmt::Format))]
506#[derive(Clone, Copy, Debug, PartialEq, Eq)]
507#[repr(u8)]
508pub enum Loop {
509 #[doc = "0: Looping not enabled. Command executes 1 time."]
510 CmdExec1x = 0,
511 #[doc = "1: Loop 1 time. Command executes 2 times."]
512 CmdExec2x = 1,
513 #[doc = "2: Loop 2 times. Command executes 3 times."]
514 CmdExec3x = 2,
515 #[doc = "3: Loop corresponding number of times. Command executes LOOP+1 times."]
516 CmdExecutesCorrespondingTimes3 = 3,
517 #[doc = "4: Loop corresponding number of times. Command executes LOOP+1 times."]
518 CmdExecutesCorrespondingTimes4 = 4,
519 #[doc = "5: Loop corresponding number of times. Command executes LOOP+1 times."]
520 CmdExecutesCorrespondingTimes5 = 5,
521 #[doc = "6: Loop corresponding number of times. Command executes LOOP+1 times."]
522 CmdExecutesCorrespondingTimes6 = 6,
523 #[doc = "7: Loop corresponding number of times. Command executes LOOP+1 times."]
524 CmdExecutesCorrespondingTimes7 = 7,
525 #[doc = "8: Loop corresponding number of times. Command executes LOOP+1 times."]
526 CmdExecutesCorrespondingTimes8 = 8,
527 #[doc = "9: Loop corresponding number of times. Command executes LOOP+1 times."]
528 CmdExecutesCorrespondingTimes9 = 9,
529 #[doc = "15: Loop 15 times. Command executes 16 times."]
530 CmdExec15x = 15,
531}
532impl From<Loop> for u8 {
533 #[inline(always)]
534 fn from(variant: Loop) -> Self {
535 variant as _
536 }
537}
538impl crate::FieldSpec for Loop {
539 type Ux = u8;
540}
541impl crate::IsEnum for Loop {}
542#[doc = "Field `LOOP` reader - Loop Count Select"]
543pub type LoopR = crate::FieldReader<Loop>;
544impl LoopR {
545 #[doc = "Get enumerated values variant"]
546 #[inline(always)]
547 pub const fn variant(&self) -> Option<Loop> {
548 match self.bits {
549 0 => Some(Loop::CmdExec1x),
550 1 => Some(Loop::CmdExec2x),
551 2 => Some(Loop::CmdExec3x),
552 3 => Some(Loop::CmdExecutesCorrespondingTimes3),
553 4 => Some(Loop::CmdExecutesCorrespondingTimes4),
554 5 => Some(Loop::CmdExecutesCorrespondingTimes5),
555 6 => Some(Loop::CmdExecutesCorrespondingTimes6),
556 7 => Some(Loop::CmdExecutesCorrespondingTimes7),
557 8 => Some(Loop::CmdExecutesCorrespondingTimes8),
558 9 => Some(Loop::CmdExecutesCorrespondingTimes9),
559 15 => Some(Loop::CmdExec15x),
560 _ => None,
561 }
562 }
563 #[doc = "Looping not enabled. Command executes 1 time."]
564 #[inline(always)]
565 pub fn is_cmd_exec_1x(&self) -> bool {
566 *self == Loop::CmdExec1x
567 }
568 #[doc = "Loop 1 time. Command executes 2 times."]
569 #[inline(always)]
570 pub fn is_cmd_exec_2x(&self) -> bool {
571 *self == Loop::CmdExec2x
572 }
573 #[doc = "Loop 2 times. Command executes 3 times."]
574 #[inline(always)]
575 pub fn is_cmd_exec_3x(&self) -> bool {
576 *self == Loop::CmdExec3x
577 }
578 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
579 #[inline(always)]
580 pub fn is_cmd_executes_corresponding_times_3(&self) -> bool {
581 *self == Loop::CmdExecutesCorrespondingTimes3
582 }
583 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
584 #[inline(always)]
585 pub fn is_cmd_executes_corresponding_times_4(&self) -> bool {
586 *self == Loop::CmdExecutesCorrespondingTimes4
587 }
588 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
589 #[inline(always)]
590 pub fn is_cmd_executes_corresponding_times_5(&self) -> bool {
591 *self == Loop::CmdExecutesCorrespondingTimes5
592 }
593 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
594 #[inline(always)]
595 pub fn is_cmd_executes_corresponding_times_6(&self) -> bool {
596 *self == Loop::CmdExecutesCorrespondingTimes6
597 }
598 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
599 #[inline(always)]
600 pub fn is_cmd_executes_corresponding_times_7(&self) -> bool {
601 *self == Loop::CmdExecutesCorrespondingTimes7
602 }
603 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
604 #[inline(always)]
605 pub fn is_cmd_executes_corresponding_times_8(&self) -> bool {
606 *self == Loop::CmdExecutesCorrespondingTimes8
607 }
608 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
609 #[inline(always)]
610 pub fn is_cmd_executes_corresponding_times_9(&self) -> bool {
611 *self == Loop::CmdExecutesCorrespondingTimes9
612 }
613 #[doc = "Loop 15 times. Command executes 16 times."]
614 #[inline(always)]
615 pub fn is_cmd_exec_15x(&self) -> bool {
616 *self == Loop::CmdExec15x
617 }
618}
619#[doc = "Field `LOOP` writer - Loop Count Select"]
620pub type LoopW<'a, REG> = crate::FieldWriter<'a, REG, 4, Loop>;
621impl<'a, REG> LoopW<'a, REG>
622where
623 REG: crate::Writable + crate::RegisterSpec,
624 REG::Ux: From<u8>,
625{
626 #[doc = "Looping not enabled. Command executes 1 time."]
627 #[inline(always)]
628 pub fn cmd_exec_1x(self) -> &'a mut crate::W<REG> {
629 self.variant(Loop::CmdExec1x)
630 }
631 #[doc = "Loop 1 time. Command executes 2 times."]
632 #[inline(always)]
633 pub fn cmd_exec_2x(self) -> &'a mut crate::W<REG> {
634 self.variant(Loop::CmdExec2x)
635 }
636 #[doc = "Loop 2 times. Command executes 3 times."]
637 #[inline(always)]
638 pub fn cmd_exec_3x(self) -> &'a mut crate::W<REG> {
639 self.variant(Loop::CmdExec3x)
640 }
641 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
642 #[inline(always)]
643 pub fn cmd_executes_corresponding_times_3(self) -> &'a mut crate::W<REG> {
644 self.variant(Loop::CmdExecutesCorrespondingTimes3)
645 }
646 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
647 #[inline(always)]
648 pub fn cmd_executes_corresponding_times_4(self) -> &'a mut crate::W<REG> {
649 self.variant(Loop::CmdExecutesCorrespondingTimes4)
650 }
651 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
652 #[inline(always)]
653 pub fn cmd_executes_corresponding_times_5(self) -> &'a mut crate::W<REG> {
654 self.variant(Loop::CmdExecutesCorrespondingTimes5)
655 }
656 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
657 #[inline(always)]
658 pub fn cmd_executes_corresponding_times_6(self) -> &'a mut crate::W<REG> {
659 self.variant(Loop::CmdExecutesCorrespondingTimes6)
660 }
661 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
662 #[inline(always)]
663 pub fn cmd_executes_corresponding_times_7(self) -> &'a mut crate::W<REG> {
664 self.variant(Loop::CmdExecutesCorrespondingTimes7)
665 }
666 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
667 #[inline(always)]
668 pub fn cmd_executes_corresponding_times_8(self) -> &'a mut crate::W<REG> {
669 self.variant(Loop::CmdExecutesCorrespondingTimes8)
670 }
671 #[doc = "Loop corresponding number of times. Command executes LOOP+1 times."]
672 #[inline(always)]
673 pub fn cmd_executes_corresponding_times_9(self) -> &'a mut crate::W<REG> {
674 self.variant(Loop::CmdExecutesCorrespondingTimes9)
675 }
676 #[doc = "Loop 15 times. Command executes 16 times."]
677 #[inline(always)]
678 pub fn cmd_exec_15x(self) -> &'a mut crate::W<REG> {
679 self.variant(Loop::CmdExec15x)
680 }
681}
682#[doc = "Next Command Select\n\nValue on reset: 0"]
683#[cfg_attr(feature = "defmt", derive(defmt::Format))]
684#[derive(Clone, Copy, Debug, PartialEq, Eq)]
685#[repr(u8)]
686pub enum Next {
687 #[doc = "0: No next command defined. Terminate conversions at completion of current command. If lower priority trigger pending, begin command associated with lower priority trigger."]
688 NoNextCmdTerminateOnFinish = 0,
689 #[doc = "1: Select CMD1 command buffer register as next command."]
690 DoCmd1Next = 1,
691 #[doc = "2: Select corresponding CMD command buffer register as next command"]
692 DoCorrespondingCmdNext2 = 2,
693 #[doc = "3: Select corresponding CMD command buffer register as next command"]
694 DoCorrespondingCmdNext3 = 3,
695 #[doc = "4: Select corresponding CMD command buffer register as next command"]
696 DoCorrespondingCmdNext4 = 4,
697 #[doc = "5: Select corresponding CMD command buffer register as next command"]
698 DoCorrespondingCmdNext5 = 5,
699 #[doc = "6: Select corresponding CMD command buffer register as next command"]
700 DoCorrespondingCmdNext6 = 6,
701 #[doc = "7: Select CMD7 command buffer register as next command."]
702 DoCmd7Next = 7,
703}
704impl From<Next> for u8 {
705 #[inline(always)]
706 fn from(variant: Next) -> Self {
707 variant as _
708 }
709}
710impl crate::FieldSpec for Next {
711 type Ux = u8;
712}
713impl crate::IsEnum for Next {}
714#[doc = "Field `NEXT` reader - Next Command Select"]
715pub type NextR = crate::FieldReader<Next>;
716impl NextR {
717 #[doc = "Get enumerated values variant"]
718 #[inline(always)]
719 pub const fn variant(&self) -> Next {
720 match self.bits {
721 0 => Next::NoNextCmdTerminateOnFinish,
722 1 => Next::DoCmd1Next,
723 2 => Next::DoCorrespondingCmdNext2,
724 3 => Next::DoCorrespondingCmdNext3,
725 4 => Next::DoCorrespondingCmdNext4,
726 5 => Next::DoCorrespondingCmdNext5,
727 6 => Next::DoCorrespondingCmdNext6,
728 7 => Next::DoCmd7Next,
729 _ => unreachable!(),
730 }
731 }
732 #[doc = "No next command defined. Terminate conversions at completion of current command. If lower priority trigger pending, begin command associated with lower priority trigger."]
733 #[inline(always)]
734 pub fn is_no_next_cmd_terminate_on_finish(&self) -> bool {
735 *self == Next::NoNextCmdTerminateOnFinish
736 }
737 #[doc = "Select CMD1 command buffer register as next command."]
738 #[inline(always)]
739 pub fn is_do_cmd1_next(&self) -> bool {
740 *self == Next::DoCmd1Next
741 }
742 #[doc = "Select corresponding CMD command buffer register as next command"]
743 #[inline(always)]
744 pub fn is_do_corresponding_cmd_next_2(&self) -> bool {
745 *self == Next::DoCorrespondingCmdNext2
746 }
747 #[doc = "Select corresponding CMD command buffer register as next command"]
748 #[inline(always)]
749 pub fn is_do_corresponding_cmd_next_3(&self) -> bool {
750 *self == Next::DoCorrespondingCmdNext3
751 }
752 #[doc = "Select corresponding CMD command buffer register as next command"]
753 #[inline(always)]
754 pub fn is_do_corresponding_cmd_next_4(&self) -> bool {
755 *self == Next::DoCorrespondingCmdNext4
756 }
757 #[doc = "Select corresponding CMD command buffer register as next command"]
758 #[inline(always)]
759 pub fn is_do_corresponding_cmd_next_5(&self) -> bool {
760 *self == Next::DoCorrespondingCmdNext5
761 }
762 #[doc = "Select corresponding CMD command buffer register as next command"]
763 #[inline(always)]
764 pub fn is_do_corresponding_cmd_next_6(&self) -> bool {
765 *self == Next::DoCorrespondingCmdNext6
766 }
767 #[doc = "Select CMD7 command buffer register as next command."]
768 #[inline(always)]
769 pub fn is_do_cmd7_next(&self) -> bool {
770 *self == Next::DoCmd7Next
771 }
772}
773#[doc = "Field `NEXT` writer - Next Command Select"]
774pub type NextW<'a, REG> = crate::FieldWriter<'a, REG, 3, Next, crate::Safe>;
775impl<'a, REG> NextW<'a, REG>
776where
777 REG: crate::Writable + crate::RegisterSpec,
778 REG::Ux: From<u8>,
779{
780 #[doc = "No next command defined. Terminate conversions at completion of current command. If lower priority trigger pending, begin command associated with lower priority trigger."]
781 #[inline(always)]
782 pub fn no_next_cmd_terminate_on_finish(self) -> &'a mut crate::W<REG> {
783 self.variant(Next::NoNextCmdTerminateOnFinish)
784 }
785 #[doc = "Select CMD1 command buffer register as next command."]
786 #[inline(always)]
787 pub fn do_cmd1_next(self) -> &'a mut crate::W<REG> {
788 self.variant(Next::DoCmd1Next)
789 }
790 #[doc = "Select corresponding CMD command buffer register as next command"]
791 #[inline(always)]
792 pub fn do_corresponding_cmd_next_2(self) -> &'a mut crate::W<REG> {
793 self.variant(Next::DoCorrespondingCmdNext2)
794 }
795 #[doc = "Select corresponding CMD command buffer register as next command"]
796 #[inline(always)]
797 pub fn do_corresponding_cmd_next_3(self) -> &'a mut crate::W<REG> {
798 self.variant(Next::DoCorrespondingCmdNext3)
799 }
800 #[doc = "Select corresponding CMD command buffer register as next command"]
801 #[inline(always)]
802 pub fn do_corresponding_cmd_next_4(self) -> &'a mut crate::W<REG> {
803 self.variant(Next::DoCorrespondingCmdNext4)
804 }
805 #[doc = "Select corresponding CMD command buffer register as next command"]
806 #[inline(always)]
807 pub fn do_corresponding_cmd_next_5(self) -> &'a mut crate::W<REG> {
808 self.variant(Next::DoCorrespondingCmdNext5)
809 }
810 #[doc = "Select corresponding CMD command buffer register as next command"]
811 #[inline(always)]
812 pub fn do_corresponding_cmd_next_6(self) -> &'a mut crate::W<REG> {
813 self.variant(Next::DoCorrespondingCmdNext6)
814 }
815 #[doc = "Select CMD7 command buffer register as next command."]
816 #[inline(always)]
817 pub fn do_cmd7_next(self) -> &'a mut crate::W<REG> {
818 self.variant(Next::DoCmd7Next)
819 }
820}
821impl R {
822 #[doc = "Bits 0:1 - Compare Function Enable"]
823 #[inline(always)]
824 pub fn cmpen(&self) -> CmpenR {
825 CmpenR::new((self.bits & 3) as u8)
826 }
827 #[doc = "Bit 2 - Wait for Trigger Assertion before Execution."]
828 #[inline(always)]
829 pub fn wait_trig(&self) -> WaitTrigR {
830 WaitTrigR::new(((self.bits >> 2) & 1) != 0)
831 }
832 #[doc = "Bit 7 - Loop with Increment"]
833 #[inline(always)]
834 pub fn lwi(&self) -> LwiR {
835 LwiR::new(((self.bits >> 7) & 1) != 0)
836 }
837 #[doc = "Bits 8:10 - Sample Time Select"]
838 #[inline(always)]
839 pub fn sts(&self) -> StsR {
840 StsR::new(((self.bits >> 8) & 7) as u8)
841 }
842 #[doc = "Bits 12:15 - Hardware Average Select"]
843 #[inline(always)]
844 pub fn avgs(&self) -> AvgsR {
845 AvgsR::new(((self.bits >> 12) & 0x0f) as u8)
846 }
847 #[doc = "Bits 16:19 - Loop Count Select"]
848 #[inline(always)]
849 pub fn loop_(&self) -> LoopR {
850 LoopR::new(((self.bits >> 16) & 0x0f) as u8)
851 }
852 #[doc = "Bits 24:26 - Next Command Select"]
853 #[inline(always)]
854 pub fn next(&self) -> NextR {
855 NextR::new(((self.bits >> 24) & 7) as u8)
856 }
857}
858#[cfg(feature = "debug")]
859impl core::fmt::Debug for R {
860 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
861 f.debug_struct("CMDH1")
862 .field("cmpen", &self.cmpen())
863 .field("wait_trig", &self.wait_trig())
864 .field("lwi", &self.lwi())
865 .field("sts", &self.sts())
866 .field("avgs", &self.avgs())
867 .field("loop_", &self.loop_())
868 .field("next", &self.next())
869 .finish()
870 }
871}
872impl W {
873 #[doc = "Bits 0:1 - Compare Function Enable"]
874 #[inline(always)]
875 pub fn cmpen(&mut self) -> CmpenW<'_, Cmdh1Spec> {
876 CmpenW::new(self, 0)
877 }
878 #[doc = "Bit 2 - Wait for Trigger Assertion before Execution."]
879 #[inline(always)]
880 pub fn wait_trig(&mut self) -> WaitTrigW<'_, Cmdh1Spec> {
881 WaitTrigW::new(self, 2)
882 }
883 #[doc = "Bit 7 - Loop with Increment"]
884 #[inline(always)]
885 pub fn lwi(&mut self) -> LwiW<'_, Cmdh1Spec> {
886 LwiW::new(self, 7)
887 }
888 #[doc = "Bits 8:10 - Sample Time Select"]
889 #[inline(always)]
890 pub fn sts(&mut self) -> StsW<'_, Cmdh1Spec> {
891 StsW::new(self, 8)
892 }
893 #[doc = "Bits 12:15 - Hardware Average Select"]
894 #[inline(always)]
895 pub fn avgs(&mut self) -> AvgsW<'_, Cmdh1Spec> {
896 AvgsW::new(self, 12)
897 }
898 #[doc = "Bits 16:19 - Loop Count Select"]
899 #[inline(always)]
900 pub fn loop_(&mut self) -> LoopW<'_, Cmdh1Spec> {
901 LoopW::new(self, 16)
902 }
903 #[doc = "Bits 24:26 - Next Command Select"]
904 #[inline(always)]
905 pub fn next(&mut self) -> NextW<'_, Cmdh1Spec> {
906 NextW::new(self, 24)
907 }
908}
909#[doc = "Command High Buffer Register\n\nYou can [`read`](crate::Reg::read) this register and get [`cmdh1::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cmdh1::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
910pub struct Cmdh1Spec;
911impl crate::RegisterSpec for Cmdh1Spec {
912 type Ux = u32;
913}
914#[doc = "`read()` method returns [`cmdh1::R`](R) reader structure"]
915impl crate::Readable for Cmdh1Spec {}
916#[doc = "`write(|w| ..)` method takes [`cmdh1::W`](W) writer structure"]
917impl crate::Writable for Cmdh1Spec {
918 type Safety = crate::Unsafe;
919}
920#[doc = "`reset()` method sets CMDH1 to value 0"]
921impl crate::Resettable for Cmdh1Spec {}