1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
#[doc = "Register `CHCTRLB` reader"]
pub struct R(crate::R<CHCTRLB_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<CHCTRLB_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<CHCTRLB_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<CHCTRLB_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `CHCTRLB` writer"]
pub struct W(crate::W<CHCTRLB_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<CHCTRLB_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<CHCTRLB_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<CHCTRLB_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Event Input Action\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum EVACT_A {
#[doc = "0: No action"]
NOACT = 0,
#[doc = "1: Transfer and periodic transfer trigger"]
TRIG = 1,
#[doc = "2: Conditional transfer trigger"]
CTRIG = 2,
#[doc = "3: Conditional block transfer"]
CBLOCK = 3,
#[doc = "4: Channel suspend operation"]
SUSPEND = 4,
#[doc = "5: Channel resume operation"]
RESUME = 5,
#[doc = "6: Skip next block suspend action"]
SSKIP = 6,
}
impl From<EVACT_A> for u8 {
#[inline(always)]
fn from(variant: EVACT_A) -> Self {
variant as _
}
}
#[doc = "Field `EVACT` reader - Event Input Action"]
pub struct EVACT_R(crate::FieldReader<u8, EVACT_A>);
impl EVACT_R {
#[inline(always)]
pub(crate) fn new(bits: u8) -> Self {
EVACT_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<EVACT_A> {
match self.bits {
0 => Some(EVACT_A::NOACT),
1 => Some(EVACT_A::TRIG),
2 => Some(EVACT_A::CTRIG),
3 => Some(EVACT_A::CBLOCK),
4 => Some(EVACT_A::SUSPEND),
5 => Some(EVACT_A::RESUME),
6 => Some(EVACT_A::SSKIP),
_ => None,
}
}
#[doc = "Checks if the value of the field is `NOACT`"]
#[inline(always)]
pub fn is_noact(&self) -> bool {
**self == EVACT_A::NOACT
}
#[doc = "Checks if the value of the field is `TRIG`"]
#[inline(always)]
pub fn is_trig(&self) -> bool {
**self == EVACT_A::TRIG
}
#[doc = "Checks if the value of the field is `CTRIG`"]
#[inline(always)]
pub fn is_ctrig(&self) -> bool {
**self == EVACT_A::CTRIG
}
#[doc = "Checks if the value of the field is `CBLOCK`"]
#[inline(always)]
pub fn is_cblock(&self) -> bool {
**self == EVACT_A::CBLOCK
}
#[doc = "Checks if the value of the field is `SUSPEND`"]
#[inline(always)]
pub fn is_suspend(&self) -> bool {
**self == EVACT_A::SUSPEND
}
#[doc = "Checks if the value of the field is `RESUME`"]
#[inline(always)]
pub fn is_resume(&self) -> bool {
**self == EVACT_A::RESUME
}
#[doc = "Checks if the value of the field is `SSKIP`"]
#[inline(always)]
pub fn is_sskip(&self) -> bool {
**self == EVACT_A::SSKIP
}
}
impl core::ops::Deref for EVACT_R {
type Target = crate::FieldReader<u8, EVACT_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `EVACT` writer - Event Input Action"]
pub struct EVACT_W<'a> {
w: &'a mut W,
}
impl<'a> EVACT_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: EVACT_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "No action"]
#[inline(always)]
pub fn noact(self) -> &'a mut W {
self.variant(EVACT_A::NOACT)
}
#[doc = "Transfer and periodic transfer trigger"]
#[inline(always)]
pub fn trig(self) -> &'a mut W {
self.variant(EVACT_A::TRIG)
}
#[doc = "Conditional transfer trigger"]
#[inline(always)]
pub fn ctrig(self) -> &'a mut W {
self.variant(EVACT_A::CTRIG)
}
#[doc = "Conditional block transfer"]
#[inline(always)]
pub fn cblock(self) -> &'a mut W {
self.variant(EVACT_A::CBLOCK)
}
#[doc = "Channel suspend operation"]
#[inline(always)]
pub fn suspend(self) -> &'a mut W {
self.variant(EVACT_A::SUSPEND)
}
#[doc = "Channel resume operation"]
#[inline(always)]
pub fn resume(self) -> &'a mut W {
self.variant(EVACT_A::RESUME)
}
#[doc = "Skip next block suspend action"]
#[inline(always)]
pub fn sskip(self) -> &'a mut W {
self.variant(EVACT_A::SSKIP)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x07) | (value as u32 & 0x07);
self.w
}
}
#[doc = "Field `EVIE` reader - Channel Event Input Enable"]
pub struct EVIE_R(crate::FieldReader<bool, bool>);
impl EVIE_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
EVIE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for EVIE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `EVIE` writer - Channel Event Input Enable"]
pub struct EVIE_W<'a> {
w: &'a mut W,
}
impl<'a> EVIE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3);
self.w
}
}
#[doc = "Field `EVOE` reader - Channel Event Output Enable"]
pub struct EVOE_R(crate::FieldReader<bool, bool>);
impl EVOE_R {
#[inline(always)]
pub(crate) fn new(bits: bool) -> Self {
EVOE_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for EVOE_R {
type Target = crate::FieldReader<bool, bool>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `EVOE` writer - Channel Event Output Enable"]
pub struct EVOE_W<'a> {
w: &'a mut W,
}
impl<'a> EVOE_W<'a> {
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4);
self.w
}
}
#[doc = "Channel Arbitration Level\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum LVL_A {
#[doc = "0: Channel Priority Level 0"]
LVL0 = 0,
#[doc = "1: Channel Priority Level 1"]
LVL1 = 1,
#[doc = "2: Channel Priority Level 2"]
LVL2 = 2,
#[doc = "3: Channel Priority Level 3"]
LVL3 = 3,
}
impl From<LVL_A> for u8 {
#[inline(always)]
fn from(variant: LVL_A) -> Self {
variant as _
}
}
#[doc = "Field `LVL` reader - Channel Arbitration Level"]
pub struct LVL_R(crate::FieldReader<u8, LVL_A>);
impl LVL_R {
#[inline(always)]
pub(crate) fn new(bits: u8) -> Self {
LVL_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> LVL_A {
match self.bits {
0 => LVL_A::LVL0,
1 => LVL_A::LVL1,
2 => LVL_A::LVL2,
3 => LVL_A::LVL3,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `LVL0`"]
#[inline(always)]
pub fn is_lvl0(&self) -> bool {
**self == LVL_A::LVL0
}
#[doc = "Checks if the value of the field is `LVL1`"]
#[inline(always)]
pub fn is_lvl1(&self) -> bool {
**self == LVL_A::LVL1
}
#[doc = "Checks if the value of the field is `LVL2`"]
#[inline(always)]
pub fn is_lvl2(&self) -> bool {
**self == LVL_A::LVL2
}
#[doc = "Checks if the value of the field is `LVL3`"]
#[inline(always)]
pub fn is_lvl3(&self) -> bool {
**self == LVL_A::LVL3
}
}
impl core::ops::Deref for LVL_R {
type Target = crate::FieldReader<u8, LVL_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `LVL` writer - Channel Arbitration Level"]
pub struct LVL_W<'a> {
w: &'a mut W,
}
impl<'a> LVL_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: LVL_A) -> &'a mut W {
self.bits(variant.into())
}
#[doc = "Channel Priority Level 0"]
#[inline(always)]
pub fn lvl0(self) -> &'a mut W {
self.variant(LVL_A::LVL0)
}
#[doc = "Channel Priority Level 1"]
#[inline(always)]
pub fn lvl1(self) -> &'a mut W {
self.variant(LVL_A::LVL1)
}
#[doc = "Channel Priority Level 2"]
#[inline(always)]
pub fn lvl2(self) -> &'a mut W {
self.variant(LVL_A::LVL2)
}
#[doc = "Channel Priority Level 3"]
#[inline(always)]
pub fn lvl3(self) -> &'a mut W {
self.variant(LVL_A::LVL3)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 5)) | ((value as u32 & 0x03) << 5);
self.w
}
}
#[doc = "Trigger Source\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum TRIGSRC_A {
#[doc = "0: Only software/event triggers"]
DISABLE = 0,
#[doc = "1: SERCOM0 RX Trigger"]
SERCOM0_RX = 1,
#[doc = "2: SERCOM0 TX Trigger"]
SERCOM0_TX = 2,
#[doc = "3: SERCOM1 RX Trigger"]
SERCOM1_RX = 3,
#[doc = "4: SERCOM1 TX Trigger"]
SERCOM1_TX = 4,
#[doc = "5: SERCOM2 RX Trigger"]
SERCOM2_RX = 5,
#[doc = "6: SERCOM2 TX Trigger"]
SERCOM2_TX = 6,
#[doc = "7: TCC0 Overflow Trigger"]
TCC0_OVF = 7,
#[doc = "8: TCC0 Match/Compare 0 Trigger"]
TCC0_MC0 = 8,
#[doc = "9: TCC0 Match/Compare 1 Trigger"]
TCC0_MC1 = 9,
#[doc = "10: TCC0 Match/Compare 2 Trigger"]
TCC0_MC2 = 10,
#[doc = "11: TCC0 Match/Compare 3 Trigger"]
TCC0_MC3 = 11,
#[doc = "12: TC1 Overflow Trigger"]
TC1_OVF = 12,
#[doc = "13: TC1 Match/Compare 0 Trigger"]
TC1_MC0 = 13,
#[doc = "14: TC1 Match/Compare 1 Trigger"]
TC1_MC1 = 14,
#[doc = "15: TC2 Overflow Trigger"]
TC2_OVF = 15,
#[doc = "16: TC2 Match/Compare 0 Trigger"]
TC2_MC0 = 16,
#[doc = "17: TC2 Match/Compare 1 Trigger"]
TC2_MC1 = 17,
#[doc = "18: ADC Result Ready Trigger"]
ADC_RESRDY = 18,
#[doc = "19: DAC Empty Trigger"]
DAC_EMPTY = 19,
}
impl From<TRIGSRC_A> for u8 {
#[inline(always)]
fn from(variant: TRIGSRC_A) -> Self {
variant as _
}
}
#[doc = "Field `TRIGSRC` reader - Trigger Source"]
pub struct TRIGSRC_R(crate::FieldReader<u8, TRIGSRC_A>);
impl TRIGSRC_R {
#[inline(always)]
pub(crate) fn new(bits: u8) -> Self {
TRIGSRC_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<TRIGSRC_A> {
match self.bits {
0 => Some(TRIGSRC_A::DISABLE),
1 => Some(TRIGSRC_A::SERCOM0_RX),
2 => Some(TRIGSRC_A::SERCOM0_TX),
3 => Some(TRIGSRC_A::SERCOM1_RX),
4 => Some(TRIGSRC_A::SERCOM1_TX),
5 => Some(TRIGSRC_A::SERCOM2_RX),
6 => Some(TRIGSRC_A::SERCOM2_TX),
7 => Some(TRIGSRC_A::TCC0_OVF),
8 => Some(TRIGSRC_A::TCC0_MC0),
9 => Some(TRIGSRC_A::TCC0_MC1),
10 => Some(TRIGSRC_A::TCC0_MC2),
11 => Some(TRIGSRC_A::TCC0_MC3),
12 => Some(TRIGSRC_A::TC1_OVF),
13 => Some(TRIGSRC_A::TC1_MC0),
14 => Some(TRIGSRC_A::TC1_MC1),
15 => Some(TRIGSRC_A::TC2_OVF),
16 => Some(TRIGSRC_A::TC2_MC0),
17 => Some(TRIGSRC_A::TC2_MC1),
18 => Some(TRIGSRC_A::ADC_RESRDY),
19 => Some(TRIGSRC_A::DAC_EMPTY),
_ => None,
}
}
#[doc = "Checks if the value of the field is `DISABLE`"]
#[inline(always)]
pub fn is_disable(&self) -> bool {
**self == TRIGSRC_A::DISABLE
}
#[doc = "Checks if the value of the field is `SERCOM0_RX`"]
#[inline(always)]
pub fn is_sercom0_rx(&self) -> bool {
**self == TRIGSRC_A::SERCOM0_RX
}
#[doc = "Checks if the value of the field is `SERCOM0_TX`"]
#[inline(always)]
pub fn is_sercom0_tx(&self) -> bool {
**self == TRIGSRC_A::SERCOM0_TX
}
#[doc = "Checks if the value of the field is `SERCOM1_RX`"]
#[inline(always)]
pub fn is_sercom1_rx(&self) -> bool {
**self == TRIGSRC_A::SERCOM1_RX
}
#[doc = "Checks if the value of the field is `SERCOM1_TX`"]
#[inline(always)]
pub fn is_sercom1_tx(&self) -> bool {
**self == TRIGSRC_A::SERCOM1_TX
}
#[doc = "Checks if the value of the field is `SERCOM2_RX`"]
#[inline(always)]
pub fn is_sercom2_rx(&self) -> bool {
**self == TRIGSRC_A::SERCOM2_RX
}
#[doc = "Checks if the value of the field is `SERCOM2_TX`"]
#[inline(always)]
pub fn is_sercom2_tx(&self) -> bool {
**self == TRIGSRC_A::SERCOM2_TX
}
#[doc = "Checks if the value of the field is `TCC0_OVF`"]
#[inline(always)]
pub fn is_tcc0_ovf(&self) -> bool {
**self == TRIGSRC_A::TCC0_OVF
}
#[doc = "Checks if the value of the field is `TCC0_MC0`"]
#[inline(always)]
pub fn is_tcc0_mc0(&self) -> bool {
**self == TRIGSRC_A::TCC0_MC0
}
#[doc = "Checks if the value of the field is `TCC0_MC1`"]
#[inline(always)]
pub fn is_tcc0_mc1(&self) -> bool {
**self == TRIGSRC_A::TCC0_MC1
}
#[doc = "Checks if the value of the field is `TCC0_MC2`"]
#[inline(always)]
pub fn is_tcc0_mc2(&self) -> bool {
**self == TRIGSRC_A::TCC0_MC2
}
#[doc = "Checks if the value of the field is `TCC0_MC3`"]
#[inline(always)]
pub fn is_tcc0_mc3(&self) -> bool {
**self == TRIGSRC_A::TCC0_MC3
}
#[doc = "Checks if the value of the field is `TC1_OVF`"]
#[inline(always)]
pub fn is_tc1_ovf(&self) -> bool {
**self == TRIGSRC_A::TC1_OVF
}
#[doc = "Checks if the value of the field is `TC1_MC0`"]
#[inline(always)]
pub fn is_tc1_mc0(&self) -> bool {
**self == TRIGSRC_A::TC1_MC0
}
#[doc = "Checks if the value of the field is `TC1_MC1`"]
#[inline(always)]
pub fn is_tc1_mc1(&self) -> bool {
**self == TRIGSRC_A::TC1_MC1
}
#[doc = "Checks if the value of the field is `TC2_OVF`"]
#[inline(always)]
pub fn is_tc2_ovf(&self) -> bool {
**self == TRIGSRC_A::TC2_OVF
}
#[doc = "Checks if the value of the field is `TC2_MC0`"]
#[inline(always)]
pub fn is_tc2_mc0(&self) -> bool {
**self == TRIGSRC_A::TC2_MC0
}
#[doc = "Checks if the value of the field is `TC2_MC1`"]
#[inline(always)]
pub fn is_tc2_mc1(&self) -> bool {
**self == TRIGSRC_A::TC2_MC1
}
#[doc = "Checks if the value of the field is `ADC_RESRDY`"]
#[inline(always)]
pub fn is_adc_resrdy(&self) -> bool {
**self == TRIGSRC_A::ADC_RESRDY
}
#[doc = "Checks if the value of the field is `DAC_EMPTY`"]
#[inline(always)]
pub fn is_dac_empty(&self) -> bool {
**self == TRIGSRC_A::DAC_EMPTY
}
}
impl core::ops::Deref for TRIGSRC_R {
type Target = crate::FieldReader<u8, TRIGSRC_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TRIGSRC` writer - Trigger Source"]
pub struct TRIGSRC_W<'a> {
w: &'a mut W,
}
impl<'a> TRIGSRC_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TRIGSRC_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "Only software/event triggers"]
#[inline(always)]
pub fn disable(self) -> &'a mut W {
self.variant(TRIGSRC_A::DISABLE)
}
#[doc = "SERCOM0 RX Trigger"]
#[inline(always)]
pub fn sercom0_rx(self) -> &'a mut W {
self.variant(TRIGSRC_A::SERCOM0_RX)
}
#[doc = "SERCOM0 TX Trigger"]
#[inline(always)]
pub fn sercom0_tx(self) -> &'a mut W {
self.variant(TRIGSRC_A::SERCOM0_TX)
}
#[doc = "SERCOM1 RX Trigger"]
#[inline(always)]
pub fn sercom1_rx(self) -> &'a mut W {
self.variant(TRIGSRC_A::SERCOM1_RX)
}
#[doc = "SERCOM1 TX Trigger"]
#[inline(always)]
pub fn sercom1_tx(self) -> &'a mut W {
self.variant(TRIGSRC_A::SERCOM1_TX)
}
#[doc = "SERCOM2 RX Trigger"]
#[inline(always)]
pub fn sercom2_rx(self) -> &'a mut W {
self.variant(TRIGSRC_A::SERCOM2_RX)
}
#[doc = "SERCOM2 TX Trigger"]
#[inline(always)]
pub fn sercom2_tx(self) -> &'a mut W {
self.variant(TRIGSRC_A::SERCOM2_TX)
}
#[doc = "TCC0 Overflow Trigger"]
#[inline(always)]
pub fn tcc0_ovf(self) -> &'a mut W {
self.variant(TRIGSRC_A::TCC0_OVF)
}
#[doc = "TCC0 Match/Compare 0 Trigger"]
#[inline(always)]
pub fn tcc0_mc0(self) -> &'a mut W {
self.variant(TRIGSRC_A::TCC0_MC0)
}
#[doc = "TCC0 Match/Compare 1 Trigger"]
#[inline(always)]
pub fn tcc0_mc1(self) -> &'a mut W {
self.variant(TRIGSRC_A::TCC0_MC1)
}
#[doc = "TCC0 Match/Compare 2 Trigger"]
#[inline(always)]
pub fn tcc0_mc2(self) -> &'a mut W {
self.variant(TRIGSRC_A::TCC0_MC2)
}
#[doc = "TCC0 Match/Compare 3 Trigger"]
#[inline(always)]
pub fn tcc0_mc3(self) -> &'a mut W {
self.variant(TRIGSRC_A::TCC0_MC3)
}
#[doc = "TC1 Overflow Trigger"]
#[inline(always)]
pub fn tc1_ovf(self) -> &'a mut W {
self.variant(TRIGSRC_A::TC1_OVF)
}
#[doc = "TC1 Match/Compare 0 Trigger"]
#[inline(always)]
pub fn tc1_mc0(self) -> &'a mut W {
self.variant(TRIGSRC_A::TC1_MC0)
}
#[doc = "TC1 Match/Compare 1 Trigger"]
#[inline(always)]
pub fn tc1_mc1(self) -> &'a mut W {
self.variant(TRIGSRC_A::TC1_MC1)
}
#[doc = "TC2 Overflow Trigger"]
#[inline(always)]
pub fn tc2_ovf(self) -> &'a mut W {
self.variant(TRIGSRC_A::TC2_OVF)
}
#[doc = "TC2 Match/Compare 0 Trigger"]
#[inline(always)]
pub fn tc2_mc0(self) -> &'a mut W {
self.variant(TRIGSRC_A::TC2_MC0)
}
#[doc = "TC2 Match/Compare 1 Trigger"]
#[inline(always)]
pub fn tc2_mc1(self) -> &'a mut W {
self.variant(TRIGSRC_A::TC2_MC1)
}
#[doc = "ADC Result Ready Trigger"]
#[inline(always)]
pub fn adc_resrdy(self) -> &'a mut W {
self.variant(TRIGSRC_A::ADC_RESRDY)
}
#[doc = "DAC Empty Trigger"]
#[inline(always)]
pub fn dac_empty(self) -> &'a mut W {
self.variant(TRIGSRC_A::DAC_EMPTY)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x1f << 8)) | ((value as u32 & 0x1f) << 8);
self.w
}
}
#[doc = "Trigger Action\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum TRIGACT_A {
#[doc = "0: One trigger required for each block transfer"]
BLOCK = 0,
#[doc = "2: One trigger required for each beat transfer"]
BEAT = 2,
#[doc = "3: One trigger required for each transaction"]
TRANSACTION = 3,
}
impl From<TRIGACT_A> for u8 {
#[inline(always)]
fn from(variant: TRIGACT_A) -> Self {
variant as _
}
}
#[doc = "Field `TRIGACT` reader - Trigger Action"]
pub struct TRIGACT_R(crate::FieldReader<u8, TRIGACT_A>);
impl TRIGACT_R {
#[inline(always)]
pub(crate) fn new(bits: u8) -> Self {
TRIGACT_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<TRIGACT_A> {
match self.bits {
0 => Some(TRIGACT_A::BLOCK),
2 => Some(TRIGACT_A::BEAT),
3 => Some(TRIGACT_A::TRANSACTION),
_ => None,
}
}
#[doc = "Checks if the value of the field is `BLOCK`"]
#[inline(always)]
pub fn is_block(&self) -> bool {
**self == TRIGACT_A::BLOCK
}
#[doc = "Checks if the value of the field is `BEAT`"]
#[inline(always)]
pub fn is_beat(&self) -> bool {
**self == TRIGACT_A::BEAT
}
#[doc = "Checks if the value of the field is `TRANSACTION`"]
#[inline(always)]
pub fn is_transaction(&self) -> bool {
**self == TRIGACT_A::TRANSACTION
}
}
impl core::ops::Deref for TRIGACT_R {
type Target = crate::FieldReader<u8, TRIGACT_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `TRIGACT` writer - Trigger Action"]
pub struct TRIGACT_W<'a> {
w: &'a mut W,
}
impl<'a> TRIGACT_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TRIGACT_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "One trigger required for each block transfer"]
#[inline(always)]
pub fn block(self) -> &'a mut W {
self.variant(TRIGACT_A::BLOCK)
}
#[doc = "One trigger required for each beat transfer"]
#[inline(always)]
pub fn beat(self) -> &'a mut W {
self.variant(TRIGACT_A::BEAT)
}
#[doc = "One trigger required for each transaction"]
#[inline(always)]
pub fn transaction(self) -> &'a mut W {
self.variant(TRIGACT_A::TRANSACTION)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 22)) | ((value as u32 & 0x03) << 22);
self.w
}
}
#[doc = "Software Command\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum CMD_A {
#[doc = "0: No action"]
NOACT = 0,
#[doc = "1: Channel suspend operation"]
SUSPEND = 1,
#[doc = "2: Channel resume operation"]
RESUME = 2,
}
impl From<CMD_A> for u8 {
#[inline(always)]
fn from(variant: CMD_A) -> Self {
variant as _
}
}
#[doc = "Field `CMD` reader - Software Command"]
pub struct CMD_R(crate::FieldReader<u8, CMD_A>);
impl CMD_R {
#[inline(always)]
pub(crate) fn new(bits: u8) -> Self {
CMD_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> Option<CMD_A> {
match self.bits {
0 => Some(CMD_A::NOACT),
1 => Some(CMD_A::SUSPEND),
2 => Some(CMD_A::RESUME),
_ => None,
}
}
#[doc = "Checks if the value of the field is `NOACT`"]
#[inline(always)]
pub fn is_noact(&self) -> bool {
**self == CMD_A::NOACT
}
#[doc = "Checks if the value of the field is `SUSPEND`"]
#[inline(always)]
pub fn is_suspend(&self) -> bool {
**self == CMD_A::SUSPEND
}
#[doc = "Checks if the value of the field is `RESUME`"]
#[inline(always)]
pub fn is_resume(&self) -> bool {
**self == CMD_A::RESUME
}
}
impl core::ops::Deref for CMD_R {
type Target = crate::FieldReader<u8, CMD_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `CMD` writer - Software Command"]
pub struct CMD_W<'a> {
w: &'a mut W,
}
impl<'a> CMD_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CMD_A) -> &'a mut W {
unsafe { self.bits(variant.into()) }
}
#[doc = "No action"]
#[inline(always)]
pub fn noact(self) -> &'a mut W {
self.variant(CMD_A::NOACT)
}
#[doc = "Channel suspend operation"]
#[inline(always)]
pub fn suspend(self) -> &'a mut W {
self.variant(CMD_A::SUSPEND)
}
#[doc = "Channel resume operation"]
#[inline(always)]
pub fn resume(self) -> &'a mut W {
self.variant(CMD_A::RESUME)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 24)) | ((value as u32 & 0x03) << 24);
self.w
}
}
impl R {
#[doc = "Bits 0:2 - Event Input Action"]
#[inline(always)]
pub fn evact(&self) -> EVACT_R {
EVACT_R::new((self.bits & 0x07) as u8)
}
#[doc = "Bit 3 - Channel Event Input Enable"]
#[inline(always)]
pub fn evie(&self) -> EVIE_R {
EVIE_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - Channel Event Output Enable"]
#[inline(always)]
pub fn evoe(&self) -> EVOE_R {
EVOE_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bits 5:6 - Channel Arbitration Level"]
#[inline(always)]
pub fn lvl(&self) -> LVL_R {
LVL_R::new(((self.bits >> 5) & 0x03) as u8)
}
#[doc = "Bits 8:12 - Trigger Source"]
#[inline(always)]
pub fn trigsrc(&self) -> TRIGSRC_R {
TRIGSRC_R::new(((self.bits >> 8) & 0x1f) as u8)
}
#[doc = "Bits 22:23 - Trigger Action"]
#[inline(always)]
pub fn trigact(&self) -> TRIGACT_R {
TRIGACT_R::new(((self.bits >> 22) & 0x03) as u8)
}
#[doc = "Bits 24:25 - Software Command"]
#[inline(always)]
pub fn cmd(&self) -> CMD_R {
CMD_R::new(((self.bits >> 24) & 0x03) as u8)
}
}
impl W {
#[doc = "Bits 0:2 - Event Input Action"]
#[inline(always)]
pub fn evact(&mut self) -> EVACT_W {
EVACT_W { w: self }
}
#[doc = "Bit 3 - Channel Event Input Enable"]
#[inline(always)]
pub fn evie(&mut self) -> EVIE_W {
EVIE_W { w: self }
}
#[doc = "Bit 4 - Channel Event Output Enable"]
#[inline(always)]
pub fn evoe(&mut self) -> EVOE_W {
EVOE_W { w: self }
}
#[doc = "Bits 5:6 - Channel Arbitration Level"]
#[inline(always)]
pub fn lvl(&mut self) -> LVL_W {
LVL_W { w: self }
}
#[doc = "Bits 8:12 - Trigger Source"]
#[inline(always)]
pub fn trigsrc(&mut self) -> TRIGSRC_W {
TRIGSRC_W { w: self }
}
#[doc = "Bits 22:23 - Trigger Action"]
#[inline(always)]
pub fn trigact(&mut self) -> TRIGACT_W {
TRIGACT_W { w: self }
}
#[doc = "Bits 24:25 - Software Command"]
#[inline(always)]
pub fn cmd(&mut self) -> CMD_W {
CMD_W { w: self }
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "Channel Control B\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 [chctrlb](index.html) module"]
pub struct CHCTRLB_SPEC;
impl crate::RegisterSpec for CHCTRLB_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [chctrlb::R](R) reader structure"]
impl crate::Readable for CHCTRLB_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [chctrlb::W](W) writer structure"]
impl crate::Writable for CHCTRLB_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets CHCTRLB to value 0"]
impl crate::Resettable for CHCTRLB_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}