stm32l476 0.2.0

Peripheral access API for the STM32L476 microcontroller
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
#[doc = "Register `LCD_FCR` reader"]
pub type R = crate::R<LcdFcrSpec>;
#[doc = "Register `LCD_FCR` writer"]
pub type W = crate::W<LcdFcrSpec>;
#[doc = "High drive enable This bit is written by software to enable a low resistance divider. Displays with high internal resistance may need a longer drive time to achieve satisfactory contrast. This bit is useful in this case if some additional power consumption can be tolerated.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Hd {
    #[doc = "0: Permanent high drive disabled"]
    B0x0 = 0,
    #[doc = "1: Permanent high drive enabled. When HD=1, then the PON bits have to be programmed tom001."]
    B0x1 = 1,
}
impl From<Hd> for bool {
    #[inline(always)]
    fn from(variant: Hd) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `HD` reader - High drive enable This bit is written by software to enable a low resistance divider. Displays with high internal resistance may need a longer drive time to achieve satisfactory contrast. This bit is useful in this case if some additional power consumption can be tolerated."]
pub type HdR = crate::BitReader<Hd>;
impl HdR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Hd {
        match self.bits {
            false => Hd::B0x0,
            true => Hd::B0x1,
        }
    }
    #[doc = "Permanent high drive disabled"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Hd::B0x0
    }
    #[doc = "Permanent high drive enabled. When HD=1, then the PON bits have to be programmed tom001."]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Hd::B0x1
    }
}
#[doc = "Field `HD` writer - High drive enable This bit is written by software to enable a low resistance divider. Displays with high internal resistance may need a longer drive time to achieve satisfactory contrast. This bit is useful in this case if some additional power consumption can be tolerated."]
pub type HdW<'a, REG> = crate::BitWriter<'a, REG, Hd>;
impl<'a, REG> HdW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "Permanent high drive disabled"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Hd::B0x0)
    }
    #[doc = "Permanent high drive enabled. When HD=1, then the PON bits have to be programmed tom001."]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Hd::B0x1)
    }
}
#[doc = "Start of frame interrupt enable This bit is set and cleared by software.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Sofie {
    #[doc = "0: LCD start-of-frame interrupt disabled"]
    B0x0 = 0,
    #[doc = "1: LCD start-of-frame interrupt enabled"]
    B0x1 = 1,
}
impl From<Sofie> for bool {
    #[inline(always)]
    fn from(variant: Sofie) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `SOFIE` reader - Start of frame interrupt enable This bit is set and cleared by software."]
pub type SofieR = crate::BitReader<Sofie>;
impl SofieR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Sofie {
        match self.bits {
            false => Sofie::B0x0,
            true => Sofie::B0x1,
        }
    }
    #[doc = "LCD start-of-frame interrupt disabled"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Sofie::B0x0
    }
    #[doc = "LCD start-of-frame interrupt enabled"]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Sofie::B0x1
    }
}
#[doc = "Field `SOFIE` writer - Start of frame interrupt enable This bit is set and cleared by software."]
pub type SofieW<'a, REG> = crate::BitWriter<'a, REG, Sofie>;
impl<'a, REG> SofieW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "LCD start-of-frame interrupt disabled"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Sofie::B0x0)
    }
    #[doc = "LCD start-of-frame interrupt enabled"]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Sofie::B0x1)
    }
}
#[doc = "Update display done interrupt enable This bit is set and cleared by software.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Uddie {
    #[doc = "0: LCD Update display done interrupt disabled"]
    B0x0 = 0,
    #[doc = "1: LCD Update display done interrupt enabled"]
    B0x1 = 1,
}
impl From<Uddie> for bool {
    #[inline(always)]
    fn from(variant: Uddie) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `UDDIE` reader - Update display done interrupt enable This bit is set and cleared by software."]
pub type UddieR = crate::BitReader<Uddie>;
impl UddieR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Uddie {
        match self.bits {
            false => Uddie::B0x0,
            true => Uddie::B0x1,
        }
    }
    #[doc = "LCD Update display done interrupt disabled"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Uddie::B0x0
    }
    #[doc = "LCD Update display done interrupt enabled"]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Uddie::B0x1
    }
}
#[doc = "Field `UDDIE` writer - Update display done interrupt enable This bit is set and cleared by software."]
pub type UddieW<'a, REG> = crate::BitWriter<'a, REG, Uddie>;
impl<'a, REG> UddieW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "LCD Update display done interrupt disabled"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Uddie::B0x0)
    }
    #[doc = "LCD Update display done interrupt enabled"]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Uddie::B0x1)
    }
}
#[doc = "Pulse ON duration These bits are written by software to define the pulse duration in terms of ck_ps pulses. Amshort pulse leads to lower power consumption, but displays with high internal resistance may need a longer pulse to achieve satisfactory contrast. Note that the pulse is never longer than one half prescaled LCD clock period. PON duration example with LCDCLK = 32.768mkHz and PS=0x03:\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Pon {
    #[doc = "0: 0 ms"]
    B0x0 = 0,
    #[doc = "1: 244 ms"]
    B0x1 = 1,
    #[doc = "2: 488 ms"]
    B0x2 = 2,
    #[doc = "3: 782 ms"]
    B0x3 = 3,
    #[doc = "4: 976 ms"]
    B0x4 = 4,
    #[doc = "5: 1.22 ms"]
    B0x5 = 5,
    #[doc = "6: 1.46 ms"]
    B0x6 = 6,
    #[doc = "7: 1.71 ms"]
    B0x7 = 7,
}
impl From<Pon> for u8 {
    #[inline(always)]
    fn from(variant: Pon) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Pon {
    type Ux = u8;
}
impl crate::IsEnum for Pon {}
#[doc = "Field `PON` reader - Pulse ON duration These bits are written by software to define the pulse duration in terms of ck_ps pulses. Amshort pulse leads to lower power consumption, but displays with high internal resistance may need a longer pulse to achieve satisfactory contrast. Note that the pulse is never longer than one half prescaled LCD clock period. PON duration example with LCDCLK = 32.768mkHz and PS=0x03:"]
pub type PonR = crate::FieldReader<Pon>;
impl PonR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Pon {
        match self.bits {
            0 => Pon::B0x0,
            1 => Pon::B0x1,
            2 => Pon::B0x2,
            3 => Pon::B0x3,
            4 => Pon::B0x4,
            5 => Pon::B0x5,
            6 => Pon::B0x6,
            7 => Pon::B0x7,
            _ => unreachable!(),
        }
    }
    #[doc = "0 ms"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Pon::B0x0
    }
    #[doc = "244 ms"]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Pon::B0x1
    }
    #[doc = "488 ms"]
    #[inline(always)]
    pub fn is_b_0x2(&self) -> bool {
        *self == Pon::B0x2
    }
    #[doc = "782 ms"]
    #[inline(always)]
    pub fn is_b_0x3(&self) -> bool {
        *self == Pon::B0x3
    }
    #[doc = "976 ms"]
    #[inline(always)]
    pub fn is_b_0x4(&self) -> bool {
        *self == Pon::B0x4
    }
    #[doc = "1.22 ms"]
    #[inline(always)]
    pub fn is_b_0x5(&self) -> bool {
        *self == Pon::B0x5
    }
    #[doc = "1.46 ms"]
    #[inline(always)]
    pub fn is_b_0x6(&self) -> bool {
        *self == Pon::B0x6
    }
    #[doc = "1.71 ms"]
    #[inline(always)]
    pub fn is_b_0x7(&self) -> bool {
        *self == Pon::B0x7
    }
}
#[doc = "Field `PON` writer - Pulse ON duration These bits are written by software to define the pulse duration in terms of ck_ps pulses. Amshort pulse leads to lower power consumption, but displays with high internal resistance may need a longer pulse to achieve satisfactory contrast. Note that the pulse is never longer than one half prescaled LCD clock period. PON duration example with LCDCLK = 32.768mkHz and PS=0x03:"]
pub type PonW<'a, REG> = crate::FieldWriter<'a, REG, 3, Pon, crate::Safe>;
impl<'a, REG> PonW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "0 ms"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Pon::B0x0)
    }
    #[doc = "244 ms"]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Pon::B0x1)
    }
    #[doc = "488 ms"]
    #[inline(always)]
    pub fn b_0x2(self) -> &'a mut crate::W<REG> {
        self.variant(Pon::B0x2)
    }
    #[doc = "782 ms"]
    #[inline(always)]
    pub fn b_0x3(self) -> &'a mut crate::W<REG> {
        self.variant(Pon::B0x3)
    }
    #[doc = "976 ms"]
    #[inline(always)]
    pub fn b_0x4(self) -> &'a mut crate::W<REG> {
        self.variant(Pon::B0x4)
    }
    #[doc = "1.22 ms"]
    #[inline(always)]
    pub fn b_0x5(self) -> &'a mut crate::W<REG> {
        self.variant(Pon::B0x5)
    }
    #[doc = "1.46 ms"]
    #[inline(always)]
    pub fn b_0x6(self) -> &'a mut crate::W<REG> {
        self.variant(Pon::B0x6)
    }
    #[doc = "1.71 ms"]
    #[inline(always)]
    pub fn b_0x7(self) -> &'a mut crate::W<REG> {
        self.variant(Pon::B0x7)
    }
}
#[doc = "Dead time duration These bits are written by software to configure the length of the dead time between frames. During the dead time the COM and SEG voltage levels are held at 0 V to reduce the contrast without modifying the frame rate. ......\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Dead {
    #[doc = "0: No dead time"]
    B0x0 = 0,
    #[doc = "1: 1 phase period dead time"]
    B0x1 = 1,
    #[doc = "2: 2 phase period dead time"]
    B0x2 = 2,
    #[doc = "7: 7 phase period dead time"]
    B0x7 = 7,
}
impl From<Dead> for u8 {
    #[inline(always)]
    fn from(variant: Dead) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Dead {
    type Ux = u8;
}
impl crate::IsEnum for Dead {}
#[doc = "Field `DEAD` reader - Dead time duration These bits are written by software to configure the length of the dead time between frames. During the dead time the COM and SEG voltage levels are held at 0 V to reduce the contrast without modifying the frame rate. ......"]
pub type DeadR = crate::FieldReader<Dead>;
impl DeadR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Dead> {
        match self.bits {
            0 => Some(Dead::B0x0),
            1 => Some(Dead::B0x1),
            2 => Some(Dead::B0x2),
            7 => Some(Dead::B0x7),
            _ => None,
        }
    }
    #[doc = "No dead time"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Dead::B0x0
    }
    #[doc = "1 phase period dead time"]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Dead::B0x1
    }
    #[doc = "2 phase period dead time"]
    #[inline(always)]
    pub fn is_b_0x2(&self) -> bool {
        *self == Dead::B0x2
    }
    #[doc = "7 phase period dead time"]
    #[inline(always)]
    pub fn is_b_0x7(&self) -> bool {
        *self == Dead::B0x7
    }
}
#[doc = "Field `DEAD` writer - Dead time duration These bits are written by software to configure the length of the dead time between frames. During the dead time the COM and SEG voltage levels are held at 0 V to reduce the contrast without modifying the frame rate. ......"]
pub type DeadW<'a, REG> = crate::FieldWriter<'a, REG, 3, Dead>;
impl<'a, REG> DeadW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "No dead time"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Dead::B0x0)
    }
    #[doc = "1 phase period dead time"]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Dead::B0x1)
    }
    #[doc = "2 phase period dead time"]
    #[inline(always)]
    pub fn b_0x2(self) -> &'a mut crate::W<REG> {
        self.variant(Dead::B0x2)
    }
    #[doc = "7 phase period dead time"]
    #[inline(always)]
    pub fn b_0x7(self) -> &'a mut crate::W<REG> {
        self.variant(Dead::B0x7)
    }
}
#[doc = "Contrast control\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Cc {
    #[doc = "0: V<sub>LCD0</sub>"]
    B0x0 = 0,
    #[doc = "1: V<sub>LCD1</sub>"]
    B0x1 = 1,
    #[doc = "2: V<sub>LCD2</sub>"]
    B0x2 = 2,
    #[doc = "3: V<sub>LCD3</sub>"]
    B0x3 = 3,
    #[doc = "4: V<sub>LCD4</sub>"]
    B0x4 = 4,
    #[doc = "5: V<sub>LCD5</sub>"]
    B0x5 = 5,
    #[doc = "6: V<sub>LCD6</sub>"]
    B0x6 = 6,
    #[doc = "7: V<sub>LCD7</sub>"]
    B0x7 = 7,
}
impl From<Cc> for u8 {
    #[inline(always)]
    fn from(variant: Cc) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Cc {
    type Ux = u8;
}
impl crate::IsEnum for Cc {}
#[doc = "Field `CC` reader - Contrast control"]
pub type CcR = crate::FieldReader<Cc>;
impl CcR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Cc {
        match self.bits {
            0 => Cc::B0x0,
            1 => Cc::B0x1,
            2 => Cc::B0x2,
            3 => Cc::B0x3,
            4 => Cc::B0x4,
            5 => Cc::B0x5,
            6 => Cc::B0x6,
            7 => Cc::B0x7,
            _ => unreachable!(),
        }
    }
    #[doc = "V<sub>LCD0</sub>"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Cc::B0x0
    }
    #[doc = "V<sub>LCD1</sub>"]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Cc::B0x1
    }
    #[doc = "V<sub>LCD2</sub>"]
    #[inline(always)]
    pub fn is_b_0x2(&self) -> bool {
        *self == Cc::B0x2
    }
    #[doc = "V<sub>LCD3</sub>"]
    #[inline(always)]
    pub fn is_b_0x3(&self) -> bool {
        *self == Cc::B0x3
    }
    #[doc = "V<sub>LCD4</sub>"]
    #[inline(always)]
    pub fn is_b_0x4(&self) -> bool {
        *self == Cc::B0x4
    }
    #[doc = "V<sub>LCD5</sub>"]
    #[inline(always)]
    pub fn is_b_0x5(&self) -> bool {
        *self == Cc::B0x5
    }
    #[doc = "V<sub>LCD6</sub>"]
    #[inline(always)]
    pub fn is_b_0x6(&self) -> bool {
        *self == Cc::B0x6
    }
    #[doc = "V<sub>LCD7</sub>"]
    #[inline(always)]
    pub fn is_b_0x7(&self) -> bool {
        *self == Cc::B0x7
    }
}
#[doc = "Field `CC` writer - Contrast control"]
pub type CcW<'a, REG> = crate::FieldWriter<'a, REG, 3, Cc, crate::Safe>;
impl<'a, REG> CcW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "V<sub>LCD0</sub>"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Cc::B0x0)
    }
    #[doc = "V<sub>LCD1</sub>"]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Cc::B0x1)
    }
    #[doc = "V<sub>LCD2</sub>"]
    #[inline(always)]
    pub fn b_0x2(self) -> &'a mut crate::W<REG> {
        self.variant(Cc::B0x2)
    }
    #[doc = "V<sub>LCD3</sub>"]
    #[inline(always)]
    pub fn b_0x3(self) -> &'a mut crate::W<REG> {
        self.variant(Cc::B0x3)
    }
    #[doc = "V<sub>LCD4</sub>"]
    #[inline(always)]
    pub fn b_0x4(self) -> &'a mut crate::W<REG> {
        self.variant(Cc::B0x4)
    }
    #[doc = "V<sub>LCD5</sub>"]
    #[inline(always)]
    pub fn b_0x5(self) -> &'a mut crate::W<REG> {
        self.variant(Cc::B0x5)
    }
    #[doc = "V<sub>LCD6</sub>"]
    #[inline(always)]
    pub fn b_0x6(self) -> &'a mut crate::W<REG> {
        self.variant(Cc::B0x6)
    }
    #[doc = "V<sub>LCD7</sub>"]
    #[inline(always)]
    pub fn b_0x7(self) -> &'a mut crate::W<REG> {
        self.variant(Cc::B0x7)
    }
}
#[doc = "Blink frequency selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Blinkf {
    #[doc = "0: f<sub>LCD</sub>/8"]
    B0x0 = 0,
    #[doc = "1: f<sub>LCD</sub>/16"]
    B0x1 = 1,
    #[doc = "2: f<sub>LCD</sub>/32"]
    B0x2 = 2,
    #[doc = "3: f<sub>LCD</sub>/64"]
    B0x3 = 3,
    #[doc = "4: f<sub>LCD</sub>/128"]
    B0x4 = 4,
    #[doc = "5: f<sub>LCD</sub>/256"]
    B0x5 = 5,
    #[doc = "6: f<sub>LCD</sub>/512"]
    B0x6 = 6,
    #[doc = "7: f<sub>LCD</sub>/1024"]
    B0x7 = 7,
}
impl From<Blinkf> for u8 {
    #[inline(always)]
    fn from(variant: Blinkf) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Blinkf {
    type Ux = u8;
}
impl crate::IsEnum for Blinkf {}
#[doc = "Field `BLINKF` reader - Blink frequency selection"]
pub type BlinkfR = crate::FieldReader<Blinkf>;
impl BlinkfR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Blinkf {
        match self.bits {
            0 => Blinkf::B0x0,
            1 => Blinkf::B0x1,
            2 => Blinkf::B0x2,
            3 => Blinkf::B0x3,
            4 => Blinkf::B0x4,
            5 => Blinkf::B0x5,
            6 => Blinkf::B0x6,
            7 => Blinkf::B0x7,
            _ => unreachable!(),
        }
    }
    #[doc = "f<sub>LCD</sub>/8"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Blinkf::B0x0
    }
    #[doc = "f<sub>LCD</sub>/16"]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Blinkf::B0x1
    }
    #[doc = "f<sub>LCD</sub>/32"]
    #[inline(always)]
    pub fn is_b_0x2(&self) -> bool {
        *self == Blinkf::B0x2
    }
    #[doc = "f<sub>LCD</sub>/64"]
    #[inline(always)]
    pub fn is_b_0x3(&self) -> bool {
        *self == Blinkf::B0x3
    }
    #[doc = "f<sub>LCD</sub>/128"]
    #[inline(always)]
    pub fn is_b_0x4(&self) -> bool {
        *self == Blinkf::B0x4
    }
    #[doc = "f<sub>LCD</sub>/256"]
    #[inline(always)]
    pub fn is_b_0x5(&self) -> bool {
        *self == Blinkf::B0x5
    }
    #[doc = "f<sub>LCD</sub>/512"]
    #[inline(always)]
    pub fn is_b_0x6(&self) -> bool {
        *self == Blinkf::B0x6
    }
    #[doc = "f<sub>LCD</sub>/1024"]
    #[inline(always)]
    pub fn is_b_0x7(&self) -> bool {
        *self == Blinkf::B0x7
    }
}
#[doc = "Field `BLINKF` writer - Blink frequency selection"]
pub type BlinkfW<'a, REG> = crate::FieldWriter<'a, REG, 3, Blinkf, crate::Safe>;
impl<'a, REG> BlinkfW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "f<sub>LCD</sub>/8"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Blinkf::B0x0)
    }
    #[doc = "f<sub>LCD</sub>/16"]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Blinkf::B0x1)
    }
    #[doc = "f<sub>LCD</sub>/32"]
    #[inline(always)]
    pub fn b_0x2(self) -> &'a mut crate::W<REG> {
        self.variant(Blinkf::B0x2)
    }
    #[doc = "f<sub>LCD</sub>/64"]
    #[inline(always)]
    pub fn b_0x3(self) -> &'a mut crate::W<REG> {
        self.variant(Blinkf::B0x3)
    }
    #[doc = "f<sub>LCD</sub>/128"]
    #[inline(always)]
    pub fn b_0x4(self) -> &'a mut crate::W<REG> {
        self.variant(Blinkf::B0x4)
    }
    #[doc = "f<sub>LCD</sub>/256"]
    #[inline(always)]
    pub fn b_0x5(self) -> &'a mut crate::W<REG> {
        self.variant(Blinkf::B0x5)
    }
    #[doc = "f<sub>LCD</sub>/512"]
    #[inline(always)]
    pub fn b_0x6(self) -> &'a mut crate::W<REG> {
        self.variant(Blinkf::B0x6)
    }
    #[doc = "f<sub>LCD</sub>/1024"]
    #[inline(always)]
    pub fn b_0x7(self) -> &'a mut crate::W<REG> {
        self.variant(Blinkf::B0x7)
    }
}
#[doc = "Blink mode selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Blink {
    #[doc = "0: Blink disabled"]
    B0x0 = 0,
    #[doc = "1: Blink enabled on SEG\\[0\\], COM\\[0\\] (1 pixel)"]
    B0x1 = 1,
    #[doc = "2: Blink enabled on SEG\\[0\\], all COMs (up to 8 pixels depending on the programmed duty)"]
    B0x2 = 2,
    #[doc = "3: Blink enabled on all SEGs and all COMs (all pixels)"]
    B0x3 = 3,
}
impl From<Blink> for u8 {
    #[inline(always)]
    fn from(variant: Blink) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Blink {
    type Ux = u8;
}
impl crate::IsEnum for Blink {}
#[doc = "Field `BLINK` reader - Blink mode selection"]
pub type BlinkR = crate::FieldReader<Blink>;
impl BlinkR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Blink {
        match self.bits {
            0 => Blink::B0x0,
            1 => Blink::B0x1,
            2 => Blink::B0x2,
            3 => Blink::B0x3,
            _ => unreachable!(),
        }
    }
    #[doc = "Blink disabled"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Blink::B0x0
    }
    #[doc = "Blink enabled on SEG\\[0\\], COM\\[0\\] (1 pixel)"]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Blink::B0x1
    }
    #[doc = "Blink enabled on SEG\\[0\\], all COMs (up to 8 pixels depending on the programmed duty)"]
    #[inline(always)]
    pub fn is_b_0x2(&self) -> bool {
        *self == Blink::B0x2
    }
    #[doc = "Blink enabled on all SEGs and all COMs (all pixels)"]
    #[inline(always)]
    pub fn is_b_0x3(&self) -> bool {
        *self == Blink::B0x3
    }
}
#[doc = "Field `BLINK` writer - Blink mode selection"]
pub type BlinkW<'a, REG> = crate::FieldWriter<'a, REG, 2, Blink, crate::Safe>;
impl<'a, REG> BlinkW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Blink disabled"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Blink::B0x0)
    }
    #[doc = "Blink enabled on SEG\\[0\\], COM\\[0\\] (1 pixel)"]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Blink::B0x1)
    }
    #[doc = "Blink enabled on SEG\\[0\\], all COMs (up to 8 pixels depending on the programmed duty)"]
    #[inline(always)]
    pub fn b_0x2(self) -> &'a mut crate::W<REG> {
        self.variant(Blink::B0x2)
    }
    #[doc = "Blink enabled on all SEGs and all COMs (all pixels)"]
    #[inline(always)]
    pub fn b_0x3(self) -> &'a mut crate::W<REG> {
        self.variant(Blink::B0x3)
    }
}
#[doc = "DIV clock divider\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Div {
    #[doc = "0: ck_div = ck_ps/16"]
    B0x0 = 0,
    #[doc = "1: ck_div = ck_ps/17"]
    B0x1 = 1,
    #[doc = "15: ck_div = ck_ps/31"]
    B0xF = 15,
}
impl From<Div> for u8 {
    #[inline(always)]
    fn from(variant: Div) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Div {
    type Ux = u8;
}
impl crate::IsEnum for Div {}
#[doc = "Field `DIV` reader - DIV clock divider"]
pub type DivR = crate::FieldReader<Div>;
impl DivR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Div> {
        match self.bits {
            0 => Some(Div::B0x0),
            1 => Some(Div::B0x1),
            15 => Some(Div::B0xF),
            _ => None,
        }
    }
    #[doc = "ck_div = ck_ps/16"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Div::B0x0
    }
    #[doc = "ck_div = ck_ps/17"]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Div::B0x1
    }
    #[doc = "ck_div = ck_ps/31"]
    #[inline(always)]
    pub fn is_b_0x_f(&self) -> bool {
        *self == Div::B0xF
    }
}
#[doc = "Field `DIV` writer - DIV clock divider"]
pub type DivW<'a, REG> = crate::FieldWriter<'a, REG, 4, Div>;
impl<'a, REG> DivW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "ck_div = ck_ps/16"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Div::B0x0)
    }
    #[doc = "ck_div = ck_ps/17"]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Div::B0x1)
    }
    #[doc = "ck_div = ck_ps/31"]
    #[inline(always)]
    pub fn b_0x_f(self) -> &'a mut crate::W<REG> {
        self.variant(Div::B0xF)
    }
}
#[doc = "PS 16-bit prescaler\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Ps {
    #[doc = "0: ck_ps = LCDCLK"]
    B0x0 = 0,
    #[doc = "1: ck_ps = LCDCLK/2"]
    B0x1 = 1,
    #[doc = "15: ck_ps = LCDCLK/32768"]
    B0xF = 15,
}
impl From<Ps> for u8 {
    #[inline(always)]
    fn from(variant: Ps) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Ps {
    type Ux = u8;
}
impl crate::IsEnum for Ps {}
#[doc = "Field `PS` reader - PS 16-bit prescaler"]
pub type PsR = crate::FieldReader<Ps>;
impl PsR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<Ps> {
        match self.bits {
            0 => Some(Ps::B0x0),
            1 => Some(Ps::B0x1),
            15 => Some(Ps::B0xF),
            _ => None,
        }
    }
    #[doc = "ck_ps = LCDCLK"]
    #[inline(always)]
    pub fn is_b_0x0(&self) -> bool {
        *self == Ps::B0x0
    }
    #[doc = "ck_ps = LCDCLK/2"]
    #[inline(always)]
    pub fn is_b_0x1(&self) -> bool {
        *self == Ps::B0x1
    }
    #[doc = "ck_ps = LCDCLK/32768"]
    #[inline(always)]
    pub fn is_b_0x_f(&self) -> bool {
        *self == Ps::B0xF
    }
}
#[doc = "Field `PS` writer - PS 16-bit prescaler"]
pub type PsW<'a, REG> = crate::FieldWriter<'a, REG, 4, Ps>;
impl<'a, REG> PsW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "ck_ps = LCDCLK"]
    #[inline(always)]
    pub fn b_0x0(self) -> &'a mut crate::W<REG> {
        self.variant(Ps::B0x0)
    }
    #[doc = "ck_ps = LCDCLK/2"]
    #[inline(always)]
    pub fn b_0x1(self) -> &'a mut crate::W<REG> {
        self.variant(Ps::B0x1)
    }
    #[doc = "ck_ps = LCDCLK/32768"]
    #[inline(always)]
    pub fn b_0x_f(self) -> &'a mut crate::W<REG> {
        self.variant(Ps::B0xF)
    }
}
impl R {
    #[doc = "Bit 0 - High drive enable This bit is written by software to enable a low resistance divider. Displays with high internal resistance may need a longer drive time to achieve satisfactory contrast. This bit is useful in this case if some additional power consumption can be tolerated."]
    #[inline(always)]
    pub fn hd(&self) -> HdR {
        HdR::new((self.bits & 1) != 0)
    }
    #[doc = "Bit 1 - Start of frame interrupt enable This bit is set and cleared by software."]
    #[inline(always)]
    pub fn sofie(&self) -> SofieR {
        SofieR::new(((self.bits >> 1) & 1) != 0)
    }
    #[doc = "Bit 3 - Update display done interrupt enable This bit is set and cleared by software."]
    #[inline(always)]
    pub fn uddie(&self) -> UddieR {
        UddieR::new(((self.bits >> 3) & 1) != 0)
    }
    #[doc = "Bits 4:6 - Pulse ON duration These bits are written by software to define the pulse duration in terms of ck_ps pulses. Amshort pulse leads to lower power consumption, but displays with high internal resistance may need a longer pulse to achieve satisfactory contrast. Note that the pulse is never longer than one half prescaled LCD clock period. PON duration example with LCDCLK = 32.768mkHz and PS=0x03:"]
    #[inline(always)]
    pub fn pon(&self) -> PonR {
        PonR::new(((self.bits >> 4) & 7) as u8)
    }
    #[doc = "Bits 7:9 - Dead time duration These bits are written by software to configure the length of the dead time between frames. During the dead time the COM and SEG voltage levels are held at 0 V to reduce the contrast without modifying the frame rate. ......"]
    #[inline(always)]
    pub fn dead(&self) -> DeadR {
        DeadR::new(((self.bits >> 7) & 7) as u8)
    }
    #[doc = "Bits 10:12 - Contrast control"]
    #[inline(always)]
    pub fn cc(&self) -> CcR {
        CcR::new(((self.bits >> 10) & 7) as u8)
    }
    #[doc = "Bits 13:15 - Blink frequency selection"]
    #[inline(always)]
    pub fn blinkf(&self) -> BlinkfR {
        BlinkfR::new(((self.bits >> 13) & 7) as u8)
    }
    #[doc = "Bits 16:17 - Blink mode selection"]
    #[inline(always)]
    pub fn blink(&self) -> BlinkR {
        BlinkR::new(((self.bits >> 16) & 3) as u8)
    }
    #[doc = "Bits 18:21 - DIV clock divider"]
    #[inline(always)]
    pub fn div(&self) -> DivR {
        DivR::new(((self.bits >> 18) & 0x0f) as u8)
    }
    #[doc = "Bits 22:25 - PS 16-bit prescaler"]
    #[inline(always)]
    pub fn ps(&self) -> PsR {
        PsR::new(((self.bits >> 22) & 0x0f) as u8)
    }
}
impl W {
    #[doc = "Bit 0 - High drive enable This bit is written by software to enable a low resistance divider. Displays with high internal resistance may need a longer drive time to achieve satisfactory contrast. This bit is useful in this case if some additional power consumption can be tolerated."]
    #[inline(always)]
    pub fn hd(&mut self) -> HdW<LcdFcrSpec> {
        HdW::new(self, 0)
    }
    #[doc = "Bit 1 - Start of frame interrupt enable This bit is set and cleared by software."]
    #[inline(always)]
    pub fn sofie(&mut self) -> SofieW<LcdFcrSpec> {
        SofieW::new(self, 1)
    }
    #[doc = "Bit 3 - Update display done interrupt enable This bit is set and cleared by software."]
    #[inline(always)]
    pub fn uddie(&mut self) -> UddieW<LcdFcrSpec> {
        UddieW::new(self, 3)
    }
    #[doc = "Bits 4:6 - Pulse ON duration These bits are written by software to define the pulse duration in terms of ck_ps pulses. Amshort pulse leads to lower power consumption, but displays with high internal resistance may need a longer pulse to achieve satisfactory contrast. Note that the pulse is never longer than one half prescaled LCD clock period. PON duration example with LCDCLK = 32.768mkHz and PS=0x03:"]
    #[inline(always)]
    pub fn pon(&mut self) -> PonW<LcdFcrSpec> {
        PonW::new(self, 4)
    }
    #[doc = "Bits 7:9 - Dead time duration These bits are written by software to configure the length of the dead time between frames. During the dead time the COM and SEG voltage levels are held at 0 V to reduce the contrast without modifying the frame rate. ......"]
    #[inline(always)]
    pub fn dead(&mut self) -> DeadW<LcdFcrSpec> {
        DeadW::new(self, 7)
    }
    #[doc = "Bits 10:12 - Contrast control"]
    #[inline(always)]
    pub fn cc(&mut self) -> CcW<LcdFcrSpec> {
        CcW::new(self, 10)
    }
    #[doc = "Bits 13:15 - Blink frequency selection"]
    #[inline(always)]
    pub fn blinkf(&mut self) -> BlinkfW<LcdFcrSpec> {
        BlinkfW::new(self, 13)
    }
    #[doc = "Bits 16:17 - Blink mode selection"]
    #[inline(always)]
    pub fn blink(&mut self) -> BlinkW<LcdFcrSpec> {
        BlinkW::new(self, 16)
    }
    #[doc = "Bits 18:21 - DIV clock divider"]
    #[inline(always)]
    pub fn div(&mut self) -> DivW<LcdFcrSpec> {
        DivW::new(self, 18)
    }
    #[doc = "Bits 22:25 - PS 16-bit prescaler"]
    #[inline(always)]
    pub fn ps(&mut self) -> PsW<LcdFcrSpec> {
        PsW::new(self, 22)
    }
}
#[doc = "LCD frame control register\n\nYou can [`read`](crate::Reg::read) this register and get [`lcd_fcr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`lcd_fcr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct LcdFcrSpec;
impl crate::RegisterSpec for LcdFcrSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`lcd_fcr::R`](R) reader structure"]
impl crate::Readable for LcdFcrSpec {}
#[doc = "`write(|w| ..)` method takes [`lcd_fcr::W`](W) writer structure"]
impl crate::Writable for LcdFcrSpec {
    type Safety = crate::Unsafe;
}
#[doc = "`reset()` method sets LCD_FCR to value 0"]
impl crate::Resettable for LcdFcrSpec {}