hk32f005-pac 0.1.0

HK32F005 PAC, Generate by Chiptool
Documentation
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
#[doc = "ARR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Arr(pub u32);
impl Arr {
    #[doc = "Auto reload value"]
    #[must_use]
    #[inline(always)]
    pub const fn arr(&self) -> u16 {
        let val = (self.0 >> 0usize) & 0xffff;
        val as u16
    }
    #[doc = "Auto reload value"]
    #[inline(always)]
    pub const fn set_arr(&mut self, val: u16) {
        self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
    }
}
impl Default for Arr {
    #[inline(always)]
    fn default() -> Arr {
        Arr(0)
    }
}
impl core::fmt::Debug for Arr {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Arr").field("arr", &self.arr()).finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Arr {
    fn format(&self, f: defmt::Formatter) {
        defmt::write!(f, "Arr {{ arr: {=u16:?} }}", self.arr())
    }
}
#[doc = "CFGR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cfgr(pub u32);
impl Cfgr {
    #[doc = "Clock source selection"]
    #[must_use]
    #[inline(always)]
    pub const fn cksel(&self) -> bool {
        let val = (self.0 >> 0usize) & 0x01;
        val != 0
    }
    #[doc = "Clock source selection"]
    #[inline(always)]
    pub const fn set_cksel(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
    }
    #[doc = "Clock polarity"]
    #[must_use]
    #[inline(always)]
    pub const fn ckpol(&self) -> u8 {
        let val = (self.0 >> 1usize) & 0x03;
        val as u8
    }
    #[doc = "Clock polarity"]
    #[inline(always)]
    pub const fn set_ckpol(&mut self, val: u8) {
        self.0 = (self.0 & !(0x03 << 1usize)) | (((val as u32) & 0x03) << 1usize);
    }
    #[doc = "Digital filter for external clock"]
    #[must_use]
    #[inline(always)]
    pub const fn ckflt(&self) -> u8 {
        let val = (self.0 >> 3usize) & 0x03;
        val as u8
    }
    #[doc = "Digital filter for external clock"]
    #[inline(always)]
    pub const fn set_ckflt(&mut self, val: u8) {
        self.0 = (self.0 & !(0x03 << 3usize)) | (((val as u32) & 0x03) << 3usize);
    }
    #[doc = "Digital filter for trigger"]
    #[must_use]
    #[inline(always)]
    pub const fn trgflt(&self) -> u8 {
        let val = (self.0 >> 6usize) & 0x03;
        val as u8
    }
    #[doc = "Digital filter for trigger"]
    #[inline(always)]
    pub const fn set_trgflt(&mut self, val: u8) {
        self.0 = (self.0 & !(0x03 << 6usize)) | (((val as u32) & 0x03) << 6usize);
    }
    #[doc = "Clock prescaler"]
    #[must_use]
    #[inline(always)]
    pub const fn presc(&self) -> u8 {
        let val = (self.0 >> 9usize) & 0x07;
        val as u8
    }
    #[doc = "Clock prescaler"]
    #[inline(always)]
    pub const fn set_presc(&mut self, val: u8) {
        self.0 = (self.0 & !(0x07 << 9usize)) | (((val as u32) & 0x07) << 9usize);
    }
    #[doc = "Trigger seletion"]
    #[must_use]
    #[inline(always)]
    pub const fn trigsel(&self) -> u8 {
        let val = (self.0 >> 13usize) & 0x07;
        val as u8
    }
    #[doc = "Trigger seletion"]
    #[inline(always)]
    pub const fn set_trigsel(&mut self, val: u8) {
        self.0 = (self.0 & !(0x07 << 13usize)) | (((val as u32) & 0x07) << 13usize);
    }
    #[doc = "Trigger enable"]
    #[must_use]
    #[inline(always)]
    pub const fn trigen(&self) -> u8 {
        let val = (self.0 >> 17usize) & 0x03;
        val as u8
    }
    #[doc = "Trigger enable"]
    #[inline(always)]
    pub const fn set_trigen(&mut self, val: u8) {
        self.0 = (self.0 & !(0x03 << 17usize)) | (((val as u32) & 0x03) << 17usize);
    }
    #[doc = "Enable timeout"]
    #[must_use]
    #[inline(always)]
    pub const fn timout(&self) -> bool {
        let val = (self.0 >> 19usize) & 0x01;
        val != 0
    }
    #[doc = "Enable timeout"]
    #[inline(always)]
    pub const fn set_timout(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 19usize)) | (((val as u32) & 0x01) << 19usize);
    }
    #[doc = "Wave shape"]
    #[must_use]
    #[inline(always)]
    pub const fn wave(&self) -> bool {
        let val = (self.0 >> 20usize) & 0x01;
        val != 0
    }
    #[doc = "Wave shape"]
    #[inline(always)]
    pub const fn set_wave(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 20usize)) | (((val as u32) & 0x01) << 20usize);
    }
    #[doc = "Wave polarity"]
    #[must_use]
    #[inline(always)]
    pub const fn wavpol(&self) -> bool {
        let val = (self.0 >> 21usize) & 0x01;
        val != 0
    }
    #[doc = "Wave polarity"]
    #[inline(always)]
    pub const fn set_wavpol(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 21usize)) | (((val as u32) & 0x01) << 21usize);
    }
    #[doc = "Register update mode"]
    #[must_use]
    #[inline(always)]
    pub const fn preload(&self) -> bool {
        let val = (self.0 >> 22usize) & 0x01;
        val != 0
    }
    #[doc = "Register update mode"]
    #[inline(always)]
    pub const fn set_preload(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 22usize)) | (((val as u32) & 0x01) << 22usize);
    }
    #[doc = "Counter mode enable"]
    #[must_use]
    #[inline(always)]
    pub const fn countmode(&self) -> bool {
        let val = (self.0 >> 23usize) & 0x01;
        val != 0
    }
    #[doc = "Counter mode enable"]
    #[inline(always)]
    pub const fn set_countmode(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
    }
    #[doc = "Counter mode enable"]
    #[must_use]
    #[inline(always)]
    pub const fn enc(&self) -> bool {
        let val = (self.0 >> 24usize) & 0x01;
        val != 0
    }
    #[doc = "Counter mode enable"]
    #[inline(always)]
    pub const fn set_enc(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 24usize)) | (((val as u32) & 0x01) << 24usize);
    }
    #[doc = "Trigger out seletion"]
    #[must_use]
    #[inline(always)]
    pub const fn trgosel(&self) -> u8 {
        let val = (self.0 >> 25usize) & 0x03;
        val as u8
    }
    #[doc = "Trigger out seletion"]
    #[inline(always)]
    pub const fn set_trgosel(&mut self, val: u8) {
        self.0 = (self.0 & !(0x03 << 25usize)) | (((val as u32) & 0x03) << 25usize);
    }
}
impl Default for Cfgr {
    #[inline(always)]
    fn default() -> Cfgr {
        Cfgr(0)
    }
}
impl core::fmt::Debug for Cfgr {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Cfgr")
            .field("cksel", &self.cksel())
            .field("ckpol", &self.ckpol())
            .field("ckflt", &self.ckflt())
            .field("trgflt", &self.trgflt())
            .field("presc", &self.presc())
            .field("trigsel", &self.trigsel())
            .field("trigen", &self.trigen())
            .field("timout", &self.timout())
            .field("wave", &self.wave())
            .field("wavpol", &self.wavpol())
            .field("preload", &self.preload())
            .field("countmode", &self.countmode())
            .field("enc", &self.enc())
            .field("trgosel", &self.trgosel())
            .finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cfgr {
    fn format(&self, f: defmt::Formatter) {
        defmt :: write ! (f , "Cfgr {{ cksel: {=bool:?}, ckpol: {=u8:?}, ckflt: {=u8:?}, trgflt: {=u8:?}, presc: {=u8:?}, trigsel: {=u8:?}, trigen: {=u8:?}, timout: {=bool:?}, wave: {=bool:?}, wavpol: {=bool:?}, preload: {=bool:?}, countmode: {=bool:?}, enc: {=bool:?}, trgosel: {=u8:?} }}" , self . cksel () , self . ckpol () , self . ckflt () , self . trgflt () , self . presc () , self . trigsel () , self . trigen () , self . timout () , self . wave () , self . wavpol () , self . preload () , self . countmode () , self . enc () , self . trgosel ())
    }
}
#[doc = "CFGR2"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cfgr2(pub u32);
impl Cfgr2 {
    #[doc = "LPTIM input1 selection"]
    #[must_use]
    #[inline(always)]
    pub const fn in1sel(&self) -> u8 {
        let val = (self.0 >> 0usize) & 0x03;
        val as u8
    }
    #[doc = "LPTIM input1 selection"]
    #[inline(always)]
    pub const fn set_in1sel(&mut self, val: u8) {
        self.0 = (self.0 & !(0x03 << 0usize)) | (((val as u32) & 0x03) << 0usize);
    }
    #[doc = "LPTIM input2 selection"]
    #[must_use]
    #[inline(always)]
    pub const fn in2sel(&self) -> u8 {
        let val = (self.0 >> 4usize) & 0x03;
        val as u8
    }
    #[doc = "LPTIM input2 selection"]
    #[inline(always)]
    pub const fn set_in2sel(&mut self, val: u8) {
        self.0 = (self.0 & !(0x03 << 4usize)) | (((val as u32) & 0x03) << 4usize);
    }
}
impl Default for Cfgr2 {
    #[inline(always)]
    fn default() -> Cfgr2 {
        Cfgr2(0)
    }
}
impl core::fmt::Debug for Cfgr2 {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Cfgr2")
            .field("in1sel", &self.in1sel())
            .field("in2sel", &self.in2sel())
            .finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cfgr2 {
    fn format(&self, f: defmt::Formatter) {
        defmt::write!(
            f,
            "Cfgr2 {{ in1sel: {=u8:?}, in2sel: {=u8:?} }}",
            self.in1sel(),
            self.in2sel()
        )
    }
}
#[doc = "CMP"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cmp(pub u32);
impl Cmp {
    #[doc = "Compare value"]
    #[must_use]
    #[inline(always)]
    pub const fn cmp(&self) -> u16 {
        let val = (self.0 >> 0usize) & 0xffff;
        val as u16
    }
    #[doc = "Compare value"]
    #[inline(always)]
    pub const fn set_cmp(&mut self, val: u16) {
        self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
    }
}
impl Default for Cmp {
    #[inline(always)]
    fn default() -> Cmp {
        Cmp(0)
    }
}
impl core::fmt::Debug for Cmp {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Cmp").field("cmp", &self.cmp()).finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cmp {
    fn format(&self, f: defmt::Formatter) {
        defmt::write!(f, "Cmp {{ cmp: {=u16:?} }}", self.cmp())
    }
}
#[doc = "CNT"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cnt(pub u32);
impl Cnt {
    #[doc = "Counter value"]
    #[must_use]
    #[inline(always)]
    pub const fn cnt(&self) -> u16 {
        let val = (self.0 >> 0usize) & 0xffff;
        val as u16
    }
    #[doc = "Counter value"]
    #[inline(always)]
    pub const fn set_cnt(&mut self, val: u16) {
        self.0 = (self.0 & !(0xffff << 0usize)) | (((val as u32) & 0xffff) << 0usize);
    }
}
impl Default for Cnt {
    #[inline(always)]
    fn default() -> Cnt {
        Cnt(0)
    }
}
impl core::fmt::Debug for Cnt {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Cnt").field("cnt", &self.cnt()).finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cnt {
    fn format(&self, f: defmt::Formatter) {
        defmt::write!(f, "Cnt {{ cnt: {=u16:?} }}", self.cnt())
    }
}
#[doc = "CR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr(pub u32);
impl Cr {
    #[doc = "LPTIM enable"]
    #[must_use]
    #[inline(always)]
    pub const fn enable(&self) -> bool {
        let val = (self.0 >> 0usize) & 0x01;
        val != 0
    }
    #[doc = "LPTIM enable"]
    #[inline(always)]
    pub const fn set_enable(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
    }
    #[doc = "Counter starts in single mode"]
    #[must_use]
    #[inline(always)]
    pub const fn sngstrt(&self) -> bool {
        let val = (self.0 >> 1usize) & 0x01;
        val != 0
    }
    #[doc = "Counter starts in single mode"]
    #[inline(always)]
    pub const fn set_sngstrt(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
    }
    #[doc = "Counter starts in consecutive mode"]
    #[must_use]
    #[inline(always)]
    pub const fn cntstrt(&self) -> bool {
        let val = (self.0 >> 2usize) & 0x01;
        val != 0
    }
    #[doc = "Counter starts in consecutive mode"]
    #[inline(always)]
    pub const fn set_cntstrt(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
    }
    #[doc = "Counter reset"]
    #[must_use]
    #[inline(always)]
    pub const fn countrst(&self) -> bool {
        let val = (self.0 >> 3usize) & 0x01;
        val != 0
    }
    #[doc = "Counter reset"]
    #[inline(always)]
    pub const fn set_countrst(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
    }
    #[doc = "Reset the LPTIM_CNT register by reading"]
    #[must_use]
    #[inline(always)]
    pub const fn rstare(&self) -> bool {
        let val = (self.0 >> 4usize) & 0x01;
        val != 0
    }
    #[doc = "Reset the LPTIM_CNT register by reading"]
    #[inline(always)]
    pub const fn set_rstare(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
    }
}
impl Default for Cr {
    #[inline(always)]
    fn default() -> Cr {
        Cr(0)
    }
}
impl core::fmt::Debug for Cr {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Cr")
            .field("enable", &self.enable())
            .field("sngstrt", &self.sngstrt())
            .field("cntstrt", &self.cntstrt())
            .field("countrst", &self.countrst())
            .field("rstare", &self.rstare())
            .finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr {
    fn format(&self, f: defmt::Formatter) {
        defmt :: write ! (f , "Cr {{ enable: {=bool:?}, sngstrt: {=bool:?}, cntstrt: {=bool:?}, countrst: {=bool:?}, rstare: {=bool:?} }}" , self . enable () , self . sngstrt () , self . cntstrt () , self . countrst () , self . rstare ())
    }
}
#[doc = "ICR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Icr(pub u32);
impl Icr {
    #[doc = "CMPM clear flag"]
    #[must_use]
    #[inline(always)]
    pub const fn cmpmcf(&self) -> bool {
        let val = (self.0 >> 0usize) & 0x01;
        val != 0
    }
    #[doc = "CMPM clear flag"]
    #[inline(always)]
    pub const fn set_cmpmcf(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
    }
    #[doc = "ARRM clear flag"]
    #[must_use]
    #[inline(always)]
    pub const fn arrmcf(&self) -> bool {
        let val = (self.0 >> 1usize) & 0x01;
        val != 0
    }
    #[doc = "ARRM clear flag"]
    #[inline(always)]
    pub const fn set_arrmcf(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
    }
    #[doc = "EXTTRIG clear flag"]
    #[must_use]
    #[inline(always)]
    pub const fn exttrigcf(&self) -> bool {
        let val = (self.0 >> 2usize) & 0x01;
        val != 0
    }
    #[doc = "EXTTRIG clear flag"]
    #[inline(always)]
    pub const fn set_exttrigcf(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
    }
    #[doc = "CMPOK clear flag"]
    #[must_use]
    #[inline(always)]
    pub const fn cmpokcf(&self) -> bool {
        let val = (self.0 >> 3usize) & 0x01;
        val != 0
    }
    #[doc = "CMPOK clear flag"]
    #[inline(always)]
    pub const fn set_cmpokcf(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
    }
    #[doc = "ARROK clear flag"]
    #[must_use]
    #[inline(always)]
    pub const fn arrokcf(&self) -> bool {
        let val = (self.0 >> 4usize) & 0x01;
        val != 0
    }
    #[doc = "ARROK clear flag"]
    #[inline(always)]
    pub const fn set_arrokcf(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
    }
    #[doc = "UP clear flag"]
    #[must_use]
    #[inline(always)]
    pub const fn upcf(&self) -> bool {
        let val = (self.0 >> 5usize) & 0x01;
        val != 0
    }
    #[doc = "UP clear flag"]
    #[inline(always)]
    pub const fn set_upcf(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
    }
    #[doc = "DOWN clear flag"]
    #[must_use]
    #[inline(always)]
    pub const fn downcf(&self) -> bool {
        let val = (self.0 >> 6usize) & 0x01;
        val != 0
    }
    #[doc = "DOWN clear flag"]
    #[inline(always)]
    pub const fn set_downcf(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
    }
}
impl Default for Icr {
    #[inline(always)]
    fn default() -> Icr {
        Icr(0)
    }
}
impl core::fmt::Debug for Icr {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Icr")
            .field("cmpmcf", &self.cmpmcf())
            .field("arrmcf", &self.arrmcf())
            .field("exttrigcf", &self.exttrigcf())
            .field("cmpokcf", &self.cmpokcf())
            .field("arrokcf", &self.arrokcf())
            .field("upcf", &self.upcf())
            .field("downcf", &self.downcf())
            .finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Icr {
    fn format(&self, f: defmt::Formatter) {
        defmt :: write ! (f , "Icr {{ cmpmcf: {=bool:?}, arrmcf: {=bool:?}, exttrigcf: {=bool:?}, cmpokcf: {=bool:?}, arrokcf: {=bool:?}, upcf: {=bool:?}, downcf: {=bool:?} }}" , self . cmpmcf () , self . arrmcf () , self . exttrigcf () , self . cmpokcf () , self . arrokcf () , self . upcf () , self . downcf ())
    }
}
#[doc = "IER"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ier(pub u32);
impl Ier {
    #[doc = "CMPM interrupt enable"]
    #[must_use]
    #[inline(always)]
    pub const fn cmpmie(&self) -> bool {
        let val = (self.0 >> 0usize) & 0x01;
        val != 0
    }
    #[doc = "CMPM interrupt enable"]
    #[inline(always)]
    pub const fn set_cmpmie(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
    }
    #[doc = "ARRM interrupt enable"]
    #[must_use]
    #[inline(always)]
    pub const fn arrmie(&self) -> bool {
        let val = (self.0 >> 1usize) & 0x01;
        val != 0
    }
    #[doc = "ARRM interrupt enable"]
    #[inline(always)]
    pub const fn set_arrmie(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
    }
    #[doc = "EXTTRIG interrupt enable"]
    #[must_use]
    #[inline(always)]
    pub const fn exttrigie(&self) -> bool {
        let val = (self.0 >> 2usize) & 0x01;
        val != 0
    }
    #[doc = "EXTTRIG interrupt enable"]
    #[inline(always)]
    pub const fn set_exttrigie(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
    }
    #[doc = "CMPOK interrupt enable"]
    #[must_use]
    #[inline(always)]
    pub const fn cmpokie(&self) -> bool {
        let val = (self.0 >> 3usize) & 0x01;
        val != 0
    }
    #[doc = "CMPOK interrupt enable"]
    #[inline(always)]
    pub const fn set_cmpokie(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
    }
    #[doc = "ARROK interrupt enable"]
    #[must_use]
    #[inline(always)]
    pub const fn arrokie(&self) -> bool {
        let val = (self.0 >> 4usize) & 0x01;
        val != 0
    }
    #[doc = "ARROK interrupt enable"]
    #[inline(always)]
    pub const fn set_arrokie(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
    }
    #[doc = "UP interrupt enable"]
    #[must_use]
    #[inline(always)]
    pub const fn upie(&self) -> bool {
        let val = (self.0 >> 5usize) & 0x01;
        val != 0
    }
    #[doc = "UP interrupt enable"]
    #[inline(always)]
    pub const fn set_upie(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
    }
    #[doc = "DOWN interrupt enable"]
    #[must_use]
    #[inline(always)]
    pub const fn downie(&self) -> bool {
        let val = (self.0 >> 6usize) & 0x01;
        val != 0
    }
    #[doc = "DOWN interrupt enable"]
    #[inline(always)]
    pub const fn set_downie(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
    }
}
impl Default for Ier {
    #[inline(always)]
    fn default() -> Ier {
        Ier(0)
    }
}
impl core::fmt::Debug for Ier {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Ier")
            .field("cmpmie", &self.cmpmie())
            .field("arrmie", &self.arrmie())
            .field("exttrigie", &self.exttrigie())
            .field("cmpokie", &self.cmpokie())
            .field("arrokie", &self.arrokie())
            .field("upie", &self.upie())
            .field("downie", &self.downie())
            .finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ier {
    fn format(&self, f: defmt::Formatter) {
        defmt :: write ! (f , "Ier {{ cmpmie: {=bool:?}, arrmie: {=bool:?}, exttrigie: {=bool:?}, cmpokie: {=bool:?}, arrokie: {=bool:?}, upie: {=bool:?}, downie: {=bool:?} }}" , self . cmpmie () , self . arrmie () , self . exttrigie () , self . cmpokie () , self . arrokie () , self . upie () , self . downie ())
    }
}
#[doc = "ISR"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Isr(pub u32);
impl Isr {
    #[doc = "Compare match"]
    #[must_use]
    #[inline(always)]
    pub const fn cmpm(&self) -> bool {
        let val = (self.0 >> 0usize) & 0x01;
        val != 0
    }
    #[doc = "Compare match"]
    #[inline(always)]
    pub const fn set_cmpm(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 0usize)) | (((val as u32) & 0x01) << 0usize);
    }
    #[doc = "Auto reload"]
    #[must_use]
    #[inline(always)]
    pub const fn arrm(&self) -> bool {
        let val = (self.0 >> 1usize) & 0x01;
        val != 0
    }
    #[doc = "Auto reload"]
    #[inline(always)]
    pub const fn set_arrm(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
    }
    #[doc = "External trigger event"]
    #[must_use]
    #[inline(always)]
    pub const fn exttrig(&self) -> bool {
        let val = (self.0 >> 2usize) & 0x01;
        val != 0
    }
    #[doc = "External trigger event"]
    #[inline(always)]
    pub const fn set_exttrig(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
    }
    #[doc = "Compare register is written done"]
    #[must_use]
    #[inline(always)]
    pub const fn cmpok(&self) -> bool {
        let val = (self.0 >> 3usize) & 0x01;
        val != 0
    }
    #[doc = "Compare register is written done"]
    #[inline(always)]
    pub const fn set_cmpok(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
    }
    #[doc = "Auto reload register is written done"]
    #[must_use]
    #[inline(always)]
    pub const fn arrok(&self) -> bool {
        let val = (self.0 >> 4usize) & 0x01;
        val != 0
    }
    #[doc = "Auto reload register is written done"]
    #[inline(always)]
    pub const fn set_arrok(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 4usize)) | (((val as u32) & 0x01) << 4usize);
    }
    #[doc = "Counter direction change down to up"]
    #[must_use]
    #[inline(always)]
    pub const fn up(&self) -> bool {
        let val = (self.0 >> 5usize) & 0x01;
        val != 0
    }
    #[doc = "Counter direction change down to up"]
    #[inline(always)]
    pub const fn set_up(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 5usize)) | (((val as u32) & 0x01) << 5usize);
    }
    #[doc = "Counter direction change up to down"]
    #[must_use]
    #[inline(always)]
    pub const fn down(&self) -> bool {
        let val = (self.0 >> 6usize) & 0x01;
        val != 0
    }
    #[doc = "Counter direction change up to down"]
    #[inline(always)]
    pub const fn set_down(&mut self, val: bool) {
        self.0 = (self.0 & !(0x01 << 6usize)) | (((val as u32) & 0x01) << 6usize);
    }
}
impl Default for Isr {
    #[inline(always)]
    fn default() -> Isr {
        Isr(0)
    }
}
impl core::fmt::Debug for Isr {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("Isr")
            .field("cmpm", &self.cmpm())
            .field("arrm", &self.arrm())
            .field("exttrig", &self.exttrig())
            .field("cmpok", &self.cmpok())
            .field("arrok", &self.arrok())
            .field("up", &self.up())
            .field("down", &self.down())
            .finish()
    }
}
#[cfg(feature = "defmt")]
impl defmt::Format for Isr {
    fn format(&self, f: defmt::Formatter) {
        defmt :: write ! (f , "Isr {{ cmpm: {=bool:?}, arrm: {=bool:?}, exttrig: {=bool:?}, cmpok: {=bool:?}, arrok: {=bool:?}, up: {=bool:?}, down: {=bool:?} }}" , self . cmpm () , self . arrm () , self . exttrig () , self . cmpok () , self . arrok () , self . up () , self . down ())
    }
}