imxrt-ral 0.6.2

Register access layer for all NXP i.MX RT microcontrollers
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
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
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
#[doc = "Quadrature_Decoder"]
#[repr(C)]
pub struct RegisterBlock {
    #[doc = "Control Register"]
    pub CTRL: crate::RWRegister<u16>,
    #[doc = "Control 2 Register"]
    pub CTRL2: crate::RWRegister<u16>,
    #[doc = "Input Filter Register"]
    pub FILT: crate::RWRegister<u16>,
    #[doc = "Last Edge Time Register"]
    pub LASTEDGE: crate::RORegister<u16>,
    #[doc = "Position Difference Period Counter Register"]
    pub POSDPER: crate::RORegister<u16>,
    #[doc = "Position Difference Period Buffer Register"]
    pub POSDPERBFR: crate::RORegister<u16>,
    #[doc = "Upper Position Counter Register"]
    pub UPOS: crate::RWRegister<u16>,
    #[doc = "Lower Position Counter Register"]
    pub LPOS: crate::RWRegister<u16>,
    #[doc = "Position Difference Counter Register"]
    pub POSD: crate::RWRegister<u16>,
    #[doc = "Position Difference Hold Register"]
    pub POSDH: crate::RORegister<u16>,
    #[doc = "Upper Position Hold Register"]
    pub UPOSH: crate::RORegister<u16>,
    #[doc = "Lower Position Hold Register"]
    pub LPOSH: crate::RORegister<u16>,
    #[doc = "Last Edge Time Hold Register"]
    pub LASTEDGEH: crate::RORegister<u16>,
    #[doc = "Position Difference Period Hold Register"]
    pub POSDPERH: crate::RORegister<u16>,
    #[doc = "Revolution Hold Register"]
    pub REVH: crate::RORegister<u16>,
    #[doc = "Revolution Counter Register"]
    pub REV: crate::RWRegister<u16>,
    #[doc = "Upper Initialization Register"]
    pub UINIT: crate::RWRegister<u16>,
    #[doc = "Lower Initialization Register"]
    pub LINIT: crate::RWRegister<u16>,
    #[doc = "Upper Modulus Register"]
    pub UMOD: crate::RWRegister<u16>,
    #[doc = "Lower Modulus Register"]
    pub LMOD: crate::RWRegister<u16>,
    #[doc = "Upper Position Compare Register 0"]
    pub UCOMP0: crate::RWRegister<u16>,
    #[doc = "Lower Position Compare Register 0"]
    pub LCOMP0: crate::RWRegister<u16>,
    #[doc = "Upper Position Holder Register 1"]
    pub UPOSH1: crate::RORegister<u16>,
    #[doc = "Lower Position Holder Register 1"]
    pub LPOSH1: crate::RORegister<u16>,
    #[doc = "Upper Position Holder Register 3"]
    pub UPOSH2: crate::RORegister<u16>,
    #[doc = "Lower Position Holder Register 2"]
    pub LPOSH2: crate::RORegister<u16>,
    #[doc = "Upper Position Holder Register 3"]
    pub UPOSH3: crate::RORegister<u16>,
    #[doc = "Lower Position Holder Register 3"]
    pub LPOSH3: crate::RORegister<u16>,
    #[doc = "Interrupt Control Register"]
    pub INTCTRL: crate::RWRegister<u16>,
    #[doc = "Watchdog Timeout Register"]
    pub WTR: crate::RWRegister<u16>,
    #[doc = "Input Monitor Register"]
    pub IMR: crate::RWRegister<u16>,
    #[doc = "Test Register"]
    pub TST: crate::RWRegister<u16>,
    _reserved0: [u8; 0x10],
    #[doc = "Upper VERID"]
    pub UVERID: crate::RORegister<u16>,
    #[doc = "Lower VERID"]
    pub LVERID: crate::RORegister<u16>,
}
#[doc = "Control Register"]
pub mod CTRL {
    #[doc = "Load Okay"]
    pub mod LDOK {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No loading action taken. Users can write new values to buffered registers (writing into outer-set of these buffered registers)"]
            pub const LDOK0: u16 = 0;
            #[doc = "Outer-set values are ready to be loaded into inner-set and take effect. The loading time point depends on CTRL2\\[LDMOD\\]."]
            pub const LDOK1: u16 = 0x01;
        }
    }
    #[doc = "DMA Enable"]
    pub mod DMAEN {
        pub const offset: u16 = 1;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "DMA is disabled"]
            pub const DMAEN_0: u16 = 0;
            #[doc = "DMA is enabled. DMA request asserts automatically when the values in the outer-set of buffered compare registers (UCOMP0/LCOMP0;UCOMP1/LCOMP1;UCOMP2/LCOMP2;UCOMP3/LCOMP3), initial registers(UINIT/LINIT) and modulus registers (UMOD/LMOD) are loaded into the inner-set of buffer and then LDOK is cleared automatically. After the completion of this DMA transfer, LDOK is set automatically, it ensures outer-set values can be loaded into inner-set which in turn triggers DMA again."]
            pub const DMAEN_1: u16 = 0x01;
        }
    }
    #[doc = "Watchdog Enable"]
    pub mod WDE {
        pub const offset: u16 = 2;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const WDE0: u16 = 0;
            #[doc = "Enabled"]
            pub const WDE1: u16 = 0x01;
        }
    }
    #[doc = "Watchdog Timeout Interrupt Enable"]
    pub mod WDIE {
        pub const offset: u16 = 3;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const WDIE0: u16 = 0;
            #[doc = "Enabled"]
            pub const WDIE1: u16 = 0x01;
        }
    }
    #[doc = "Watchdog Timeout Interrupt Request"]
    pub mod WDIRQ {
        pub const offset: u16 = 4;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No Watchdog timeout interrupt has occurred"]
            pub const WDIRQ0: u16 = 0;
            #[doc = "Watchdog timeout interrupt has occurred"]
            pub const WDIRQ1: u16 = 0x01;
        }
    }
    #[doc = "Select Positive/Negative Edge of INDEX/PRESET Pulse"]
    pub mod XNE {
        pub const offset: u16 = 5;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Use positive edge of INDEX/PRESET pulse"]
            pub const XNE0: u16 = 0;
            #[doc = "Use negative edge of INDEX/PRESET pulse"]
            pub const XNE1: u16 = 0x01;
        }
    }
    #[doc = "INDEX Triggered Initialization of Position Counters UPOS and LPOS"]
    pub mod XIP {
        pub const offset: u16 = 6;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "INDEX pulse does not initialize the position counter"]
            pub const XIP0: u16 = 0;
            #[doc = "INDEX pulse initializes the position counter"]
            pub const XIP1: u16 = 0x01;
        }
    }
    #[doc = "INDEX/PRESET Pulse Interrupt Enable"]
    pub mod XIE {
        pub const offset: u16 = 7;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const XIE0: u16 = 0;
            #[doc = "Enabled"]
            pub const XIE1: u16 = 0x01;
        }
    }
    #[doc = "INDEX/PRESET Pulse Interrupt Request"]
    pub mod XIRQ {
        pub const offset: u16 = 8;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "INDEX/PRESET pulse has not occurred"]
            pub const XIRQ0: u16 = 0;
            #[doc = "INDEX/PRESET pulse has occurred"]
            pub const XIRQ1: u16 = 0x01;
        }
    }
    #[doc = "Enable Single Phase Mode"]
    pub mod PH1 {
        pub const offset: u16 = 9;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Standard quadrature decoder, where PHASEA and PHASEB represent a two-phase quadrature signal."]
            pub const PH10: u16 = 0;
            #[doc = "Single phase mode, bypass the quadrature decoder, refer to CTRL2\\[CMODE\\] description"]
            pub const PH11: u16 = 0x01;
        }
    }
    #[doc = "Enable Reverse Direction Counting"]
    pub mod REV {
        pub const offset: u16 = 10;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Count normally and the position counter initialization uses upper/lower initialization register UINIT/LINIT"]
            pub const REV0: u16 = 0;
            #[doc = "Count in the reverse direction and the position counter initialization uses upper/lower modulus register UMOD/LMOD"]
            pub const REV1: u16 = 0x01;
        }
    }
    #[doc = "Software-Triggered Initialization of Position Counters UPOS and LPOS"]
    pub mod SWIP {
        pub const offset: u16 = 11;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No action"]
            pub const SWIP0: u16 = 0;
            #[doc = "Initialize position counter"]
            pub const SWIP1: u16 = 0x01;
        }
    }
    #[doc = "Use Negative Edge of HOME/ENABLE Input"]
    pub mod HNE {
        pub const offset: u16 = 12;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "When CTRL\\[OPMODE\\] = 0,use HOME positive edge to trigger initialization of position counters. When CTRL\\[OPMODE\\] = 1,use ENABLE high level to enable POS/POSD/WDG/REV counters"]
            pub const HNE0: u16 = 0;
            #[doc = "When CTRL\\[OPMODE\\] = 0,use HOME negative edge to trigger initialization of position counters. When CTRL\\[OPMODE\\] = 1,use ENABLE low level to enable POS/POSD/WDG/REV counters"]
            pub const HNE1: u16 = 0x01;
        }
    }
    #[doc = "Enable HOME to Initialize Position Counter UPOS/LPOS"]
    pub mod HIP {
        pub const offset: u16 = 13;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No action"]
            pub const HIP0: u16 = 0;
            #[doc = "HOME signal initializes the position counter"]
            pub const HIP1: u16 = 0x01;
        }
    }
    #[doc = "HOME/ENABLE Interrupt Enable"]
    pub mod HIE {
        pub const offset: u16 = 14;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const HIE0: u16 = 0;
            #[doc = "Enabled"]
            pub const HIE1: u16 = 0x01;
        }
    }
    #[doc = "HOME/ENABLE Signal Transition Interrupt Request"]
    pub mod HIRQ {
        pub const offset: u16 = 15;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No transition on the HOME/ENABLE signal has occurred"]
            pub const HIRQ0: u16 = 0;
            #[doc = "A transition on the HOME/ENABLE signal has occurred"]
            pub const HIRQ1: u16 = 0x01;
        }
    }
}
#[doc = "Control 2 Register"]
pub mod CTRL2 {
    #[doc = "Update Hold Registers"]
    pub mod UPDHLD {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "Update Position Registers"]
    pub mod UPDPOS {
        pub const offset: u16 = 1;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "Operation Mode Select"]
    pub mod OPMODE {
        pub const offset: u16 = 2;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Decode Mode: Input nodes INDEX/PRESET and HOME/ENABLE are assigned to function of INDEX and HOME."]
            pub const OPMODE0: u16 = 0;
            #[doc = "Count Mode: Input nodes INDEX/PRESET and HOME/ENABLE are assigned to functions of PRESET and ENABLE. In this mode: (1)only when ENABLE=1, all counters (position/position difference/revolution/watchdog) can run, when ENABLE=0, all counters (position/position difference/revolution/watchdog) can't run. (2) the rising edge of PRESET input can initialize position/revolution/watchdog counters (position counter initialization also need referring to bit CTRL\\[REV\\])."]
            pub const OPMODE1: u16 = 0x01;
        }
    }
    #[doc = "Buffered Register Load (Update) Mode Select"]
    pub mod LDMOD {
        pub const offset: u16 = 3;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Buffered registers are loaded and take effect immediately upon CTRL\\[LDOK\\] is set."]
            pub const LDMOD0: u16 = 0;
            #[doc = "Buffered registers are loaded and take effect at the next roll-over or roll-under if CTRL\\[LDOK\\] is set."]
            pub const LDMOD1: u16 = 0x01;
        }
    }
    #[doc = "Revolution Counter Modulus Enable"]
    pub mod REVMOD {
        pub const offset: u16 = 8;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Use INDEX pulse to increment/decrement revolution counter (REV)"]
            pub const REVMOD0: u16 = 0;
            #[doc = "Use modulus counting roll-over/under to increment/decrement revolution counter (REV)"]
            pub const REVMOD1: u16 = 0x01;
        }
    }
    #[doc = "Output Control"]
    pub mod OUTCTL {
        pub const offset: u16 = 9;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "POS_MATCH\\[x\\](x range is 0-3) is asserted when the Position Counter is equal to according compare value (UCOMPx/LCOMPx)(x range is 0-3), and de-asserted when the Position Counter not equal to the compare value (UCOMPx/LCOMPx)(x range is 0-3)"]
            pub const OUTCTL0: u16 = 0;
            #[doc = "All POS_MATCH\\[x\\](x range is 0-3) are asserted a pulse, when the UPOS, LPOS, REV, or POSD registers are read"]
            pub const OUTCTL1: u16 = 0x01;
        }
    }
    #[doc = "Period measurement function enable"]
    pub mod PMEN {
        pub const offset: u16 = 10;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Period measurement functions are not used. POSD is loaded to POSDH and then cleared whenever POSD, UPOS, LPOS or REV is read."]
            pub const PMEN0: u16 = 0;
            #[doc = "Period measurement functions are used. POSD is loaded into POSDH and then cleared only when POSD is read."]
            pub const PMEN1: u16 = 0x01;
        }
    }
    #[doc = "Initial Position Register"]
    pub mod INITPOS {
        pub const offset: u16 = 12;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Don't initialize position counter on rising edge of TRIGGER"]
            pub const INITPOS0: u16 = 0;
            #[doc = "Initialize position counter on rising edge of TRIGGER"]
            pub const INITPOS1: u16 = 0x01;
        }
    }
    #[doc = "Count Once"]
    pub mod ONCE {
        pub const offset: u16 = 13;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Position counter counts repeatedly"]
            pub const ONCE0: u16 = 0;
            #[doc = "Position counter counts until roll-over or roll-under, then stop."]
            pub const ONCE1: u16 = 0x01;
        }
    }
    #[doc = "Counting Mode"]
    pub mod CMODE {
        pub const offset: u16 = 14;
        pub const mask: u16 = 0x03 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Input Filter Register"]
pub mod FILT {
    #[doc = "Input Filter Sample Period"]
    pub mod FILT_PER {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "Input Filter Sample Count"]
    pub mod FILT_CNT {
        pub const offset: u16 = 8;
        pub const mask: u16 = 0x07 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "Filter Clock Source selection"]
    pub mod FILT_CS {
        pub const offset: u16 = 11;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Peripheral Clock"]
            pub const FILT_CS0: u16 = 0;
            #[doc = "Prescaled peripheral clock by PRSC"]
            pub const FILT_CS1: u16 = 0x01;
        }
    }
    #[doc = "Prescaler"]
    pub mod PRSC {
        pub const offset: u16 = 12;
        pub const mask: u16 = 0x0f << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Last Edge Time Register"]
pub mod LASTEDGE {
    #[doc = "Last Edge Time Counter"]
    pub mod LASTEDGE {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Position Difference Period Counter Register"]
pub mod POSDPER {
    #[doc = "Position difference period"]
    pub mod POSDPER {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Position Difference Period Buffer Register"]
pub mod POSDPERBFR {
    #[doc = "Position difference period buffer"]
    pub mod POSDPERBFR {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Upper Position Counter Register"]
pub mod UPOS {
    #[doc = "POS"]
    pub mod POS {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Lower Position Counter Register"]
pub mod LPOS {
    #[doc = "POS"]
    pub mod POS {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Position Difference Counter Register"]
pub mod POSD {
    #[doc = "POSD"]
    pub mod POSD {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Position Difference Hold Register"]
pub mod POSDH {
    #[doc = "POSDH"]
    pub mod POSDH {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Upper Position Hold Register"]
pub mod UPOSH {
    #[doc = "POSH"]
    pub mod POSH {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Lower Position Hold Register"]
pub mod LPOSH {
    #[doc = "POSH"]
    pub mod LPOSH {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Last Edge Time Hold Register"]
pub mod LASTEDGEH {
    #[doc = "Last Edge Time Hold"]
    pub mod LASTEDGEH {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Position Difference Period Hold Register"]
pub mod POSDPERH {
    #[doc = "Position difference period hold"]
    pub mod POSDPERH {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Revolution Hold Register"]
pub mod REVH {
    #[doc = "REVH"]
    pub mod REVH {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Revolution Counter Register"]
pub mod REV {
    #[doc = "REV"]
    pub mod REV {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Upper Initialization Register"]
pub mod UINIT {
    #[doc = "INIT"]
    pub mod INIT {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Lower Initialization Register"]
pub mod LINIT {
    #[doc = "INIT"]
    pub mod INIT {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Upper Modulus Register"]
pub mod UMOD {
    #[doc = "MOD"]
    pub mod MOD {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Lower Modulus Register"]
pub mod LMOD {
    #[doc = "MOD"]
    pub mod MOD {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Upper Position Compare Register 0"]
pub mod UCOMP0 {
    #[doc = "UCOMP0"]
    pub mod UCOMP0 {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Lower Position Compare Register 0"]
pub mod LCOMP0 {
    #[doc = "LCOMP0"]
    pub mod LCOMP0 {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Upper Position Holder Register 1"]
pub mod UPOSH1 {
    #[doc = "UPOSH1"]
    pub mod UPOSH1 {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Lower Position Holder Register 1"]
pub mod LPOSH1 {
    #[doc = "LPOSH1"]
    pub mod LPOSH1 {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Upper Position Holder Register 3"]
pub mod UPOSH2 {
    #[doc = "UPOSH2"]
    pub mod UPOSH2 {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Lower Position Holder Register 2"]
pub mod LPOSH2 {
    #[doc = "LPOSH2"]
    pub mod LPOSH2 {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Upper Position Holder Register 3"]
pub mod UPOSH3 {
    #[doc = "UPOSH3"]
    pub mod UPOSH3 {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Lower Position Holder Register 3"]
pub mod LPOSH3 {
    #[doc = "LPOSH3"]
    pub mod LPOSH3 {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Interrupt Control Register"]
pub mod INTCTRL {
    #[doc = "Simultaneous PHASEA and PHASEB Change Interrupt Enable"]
    pub mod SABIE {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const SABIE0: u16 = 0;
            #[doc = "Enabled"]
            pub const SABIE1: u16 = 0x01;
        }
    }
    #[doc = "Simultaneous PHASEA and PHASEB Change Interrupt Request"]
    pub mod SABIRQ {
        pub const offset: u16 = 1;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No simultaneous change of PHASEA and PHASEB has occurred"]
            pub const SABIRQ0: u16 = 0;
            #[doc = "A simultaneous change of PHASEA and PHASEB has occurred"]
            pub const SABIRQ1: u16 = 0x01;
        }
    }
    #[doc = "Count direction change interrupt enable"]
    pub mod DIRIE {
        pub const offset: u16 = 2;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const DIRIE0: u16 = 0;
            #[doc = "Enabled"]
            pub const DIRIE1: u16 = 0x01;
        }
    }
    #[doc = "Count direction change interrupt"]
    pub mod DIRIRQ {
        pub const offset: u16 = 3;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Count direction unchanged"]
            pub const DIRIRQ0: u16 = 0;
            #[doc = "Count direction changed"]
            pub const DIRIRQ1: u16 = 0x01;
        }
    }
    #[doc = "Roll-under Interrupt Enable"]
    pub mod RUIE {
        pub const offset: u16 = 4;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const RUIE0: u16 = 0;
            #[doc = "Enabled"]
            pub const RUIE1: u16 = 0x01;
        }
    }
    #[doc = "Roll-under Interrupt Request"]
    pub mod RUIRQ {
        pub const offset: u16 = 5;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No roll-under has occurred"]
            pub const RUIRQ0: u16 = 0;
            #[doc = "Roll-under has occurred"]
            pub const RUIRQ1: u16 = 0x01;
        }
    }
    #[doc = "Roll-over Interrupt Enable"]
    pub mod ROIE {
        pub const offset: u16 = 6;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const ROIE: u16 = 0;
            #[doc = "Enabled"]
            pub const ROIE1: u16 = 0x01;
        }
    }
    #[doc = "Roll-over Interrupt Request"]
    pub mod ROIRQ {
        pub const offset: u16 = 7;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No roll-over has occurred"]
            pub const ROIRQ0: u16 = 0;
            #[doc = "Roll-over has occurred"]
            pub const ROIRQ1: u16 = 0x01;
        }
    }
    #[doc = "Compare 0 Interrupt Request"]
    pub mod CMP0IRQ {
        pub const offset: u16 = 9;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No match has occurred (the position counter does not match the COMP0 value)"]
            pub const CMP0IRQ0: u16 = 0;
            #[doc = "COMP match has occurred (the position counter matches the COMP0 value)"]
            pub const CMP0IRQ1: u16 = 0x01;
        }
    }
    #[doc = "Compare1 Interrupt Request"]
    pub mod CMP1IRQ {
        pub const offset: u16 = 11;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No match has occurred (the position counter does not match the COMP1 value)"]
            pub const CMP1IRQ0: u16 = 0;
            #[doc = "COMP1 match has occurred (the position counter matches the COMP1 value)"]
            pub const CMP1IRQ1: u16 = 0x01;
        }
    }
    #[doc = "Compare2 Interrupt Request"]
    pub mod CMP2IRQ {
        pub const offset: u16 = 13;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No match has occurred (the position counter does not match the COMP2 value)"]
            pub const CMP2IRQ0: u16 = 0;
            #[doc = "COMP2 match has occurred (the position counter matches the COMP2 value)"]
            pub const CMP2IRQ1: u16 = 0x01;
        }
    }
    #[doc = "Compare3 Interrupt Request"]
    pub mod CMP3IRQ {
        pub const offset: u16 = 15;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "No match has occurred (the position counter does not match the COMP3 value)"]
            pub const CMP3IRQ0: u16 = 0;
            #[doc = "COMP3 match has occurred (the position counter matches the COMP3 value)"]
            pub const CMP3IRQ1: u16 = 0x01;
        }
    }
}
#[doc = "Watchdog Timeout Register"]
pub mod WTR {
    #[doc = "WDOG"]
    pub mod WDOG {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Input Monitor Register"]
pub mod IMR {
    #[doc = "HOME_ENABLE"]
    pub mod HOME_ENABLE {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "INDEX_PRESET"]
    pub mod INDEX_PRESET {
        pub const offset: u16 = 1;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "PHB"]
    pub mod PHB {
        pub const offset: u16 = 2;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "PHA"]
    pub mod PHA {
        pub const offset: u16 = 3;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "filter operation on HOME/ENABLE input"]
    pub mod FHOM_ENA {
        pub const offset: u16 = 4;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "filter operation on INDEX/PRESET input"]
    pub mod FIND_PRE {
        pub const offset: u16 = 5;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "filter operation on PHASEB input"]
    pub mod FPHB {
        pub const offset: u16 = 6;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "filter operation on PHASEA input"]
    pub mod FPHA {
        pub const offset: u16 = 7;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "Position Compare 0 Flag Output"]
    pub mod CMPF0 {
        pub const offset: u16 = 8;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "When the position counter is less than value of COMP0 register"]
            pub const CMPF00: u16 = 0;
            #[doc = "When the position counter is greater or equal than value of COMP0 register"]
            pub const CMPF01: u16 = 0x01;
        }
    }
    #[doc = "Position Compare1 Flag Output"]
    pub mod CMP1F {
        pub const offset: u16 = 9;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "When the position counter is less than value of COMP1 register"]
            pub const CMP1F0: u16 = 0;
            #[doc = "When the position counter is greater or equal than value of COMP1 register"]
            pub const CMP1F1: u16 = 0x01;
        }
    }
    #[doc = "Position Compare2 Flag Output"]
    pub mod CMP2F {
        pub const offset: u16 = 10;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "When the position counter is less than value of COMP2 register"]
            pub const CMP2F0: u16 = 0;
            #[doc = "When the position counter is greater or equal than value of COMP2 register"]
            pub const CMP2F1: u16 = 0x01;
        }
    }
    #[doc = "Position Compare3 Flag Output"]
    pub mod CMP3F {
        pub const offset: u16 = 11;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "When the position counter value is less than value of COMP3 register"]
            pub const CMP3F0: u16 = 0;
            #[doc = "When the position counter is greater or equal than value of COMP3 register"]
            pub const CMP3F1: u16 = 0x01;
        }
    }
    #[doc = "Count Direction Flag Hold"]
    pub mod DIRH {
        pub const offset: u16 = 14;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "Count Direction Flag Output"]
    pub mod DIR {
        pub const offset: u16 = 15;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Current count was in the down direction"]
            pub const DIR0: u16 = 0;
            #[doc = "Current count was in the up direction"]
            pub const DIR1: u16 = 0x01;
        }
    }
}
#[doc = "Test Register"]
pub mod TST {
    #[doc = "TEST_COUNT"]
    pub mod TEST_COUNT {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "TEST_PERIOD"]
    pub mod TEST_PERIOD {
        pub const offset: u16 = 8;
        pub const mask: u16 = 0x1f << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
    #[doc = "Quadrature Decoder Negative Signal"]
    pub mod QDN {
        pub const offset: u16 = 13;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Generates a positive quadrature decoder signal"]
            pub const QDN0: u16 = 0;
            #[doc = "Generates a negative quadrature decoder signal"]
            pub const QDN1: u16 = 0x01;
        }
    }
    #[doc = "Test Counter Enable"]
    pub mod TCE {
        pub const offset: u16 = 14;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const TCE0: u16 = 0;
            #[doc = "Enabled"]
            pub const TCE1: u16 = 0x01;
        }
    }
    #[doc = "Test Mode Enable"]
    pub mod TEN {
        pub const offset: u16 = 15;
        pub const mask: u16 = 0x01 << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {
            #[doc = "Disabled"]
            pub const TEN0: u16 = 0;
            #[doc = "Enabled"]
            pub const TEN1: u16 = 0x01;
        }
    }
}
#[doc = "Upper VERID"]
pub mod UVERID {
    #[doc = "UVERID"]
    pub mod UVERID {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}
#[doc = "Lower VERID"]
pub mod LVERID {
    #[doc = "LVERID"]
    pub mod LVERID {
        pub const offset: u16 = 0;
        pub const mask: u16 = 0xffff << offset;
        pub mod R {}
        pub mod W {}
        pub mod RW {}
    }
}