stm32l0 0.16.0

Device support crates for STM32L0 devices
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
///Register `PECR` reader
pub type R = crate::R<PECRrs>;
///Register `PECR` writer
pub type W = crate::W<PECRrs>;
/**FLASH_PECR and data EEPROM lock

Value on reset: 1*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PELOCK {
    ///0: The FLASH_PECR register is unlocked
    Unlocked = 0,
    ///1: The FLASH_PECR register is locked and no write/erase operation can start
    Locked = 1,
}
impl From<PELOCK> for bool {
    #[inline(always)]
    fn from(variant: PELOCK) -> Self {
        variant as u8 != 0
    }
}
///Field `PELOCK` reader - FLASH_PECR and data EEPROM lock
pub type PELOCK_R = crate::BitReader<PELOCK>;
impl PELOCK_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> PELOCK {
        match self.bits {
            false => PELOCK::Unlocked,
            true => PELOCK::Locked,
        }
    }
    ///The FLASH_PECR register is unlocked
    #[inline(always)]
    pub fn is_unlocked(&self) -> bool {
        *self == PELOCK::Unlocked
    }
    ///The FLASH_PECR register is locked and no write/erase operation can start
    #[inline(always)]
    pub fn is_locked(&self) -> bool {
        *self == PELOCK::Locked
    }
}
///Field `PELOCK` writer - FLASH_PECR and data EEPROM lock
pub type PELOCK_W<'a, REG> = crate::BitWriter<'a, REG, PELOCK>;
impl<'a, REG> PELOCK_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///The FLASH_PECR register is unlocked
    #[inline(always)]
    pub fn unlocked(self) -> &'a mut crate::W<REG> {
        self.variant(PELOCK::Unlocked)
    }
    ///The FLASH_PECR register is locked and no write/erase operation can start
    #[inline(always)]
    pub fn locked(self) -> &'a mut crate::W<REG> {
        self.variant(PELOCK::Locked)
    }
}
/**Program memory lock

Value on reset: 1*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PRGLOCK {
    ///0: The write and erase operations in the Flash program memory are disabled
    Unlocked = 0,
    ///1: The write and erase operations in the Flash program memory are enabled
    Locked = 1,
}
impl From<PRGLOCK> for bool {
    #[inline(always)]
    fn from(variant: PRGLOCK) -> Self {
        variant as u8 != 0
    }
}
///Field `PRGLOCK` reader - Program memory lock
pub type PRGLOCK_R = crate::BitReader<PRGLOCK>;
impl PRGLOCK_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> PRGLOCK {
        match self.bits {
            false => PRGLOCK::Unlocked,
            true => PRGLOCK::Locked,
        }
    }
    ///The write and erase operations in the Flash program memory are disabled
    #[inline(always)]
    pub fn is_unlocked(&self) -> bool {
        *self == PRGLOCK::Unlocked
    }
    ///The write and erase operations in the Flash program memory are enabled
    #[inline(always)]
    pub fn is_locked(&self) -> bool {
        *self == PRGLOCK::Locked
    }
}
///Field `PRGLOCK` writer - Program memory lock
pub type PRGLOCK_W<'a, REG> = crate::BitWriter<'a, REG, PRGLOCK>;
impl<'a, REG> PRGLOCK_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///The write and erase operations in the Flash program memory are disabled
    #[inline(always)]
    pub fn unlocked(self) -> &'a mut crate::W<REG> {
        self.variant(PRGLOCK::Unlocked)
    }
    ///The write and erase operations in the Flash program memory are enabled
    #[inline(always)]
    pub fn locked(self) -> &'a mut crate::W<REG> {
        self.variant(PRGLOCK::Locked)
    }
}
/**Option bytes block lock

Value on reset: 1*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OPTLOCK {
    ///0: The write and erase operations in the Option bytes area are disabled
    Unlocked = 0,
    ///1: The write and erase operations in the Option bytes area are enabled
    Locked = 1,
}
impl From<OPTLOCK> for bool {
    #[inline(always)]
    fn from(variant: OPTLOCK) -> Self {
        variant as u8 != 0
    }
}
///Field `OPTLOCK` reader - Option bytes block lock
pub type OPTLOCK_R = crate::BitReader<OPTLOCK>;
impl OPTLOCK_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> OPTLOCK {
        match self.bits {
            false => OPTLOCK::Unlocked,
            true => OPTLOCK::Locked,
        }
    }
    ///The write and erase operations in the Option bytes area are disabled
    #[inline(always)]
    pub fn is_unlocked(&self) -> bool {
        *self == OPTLOCK::Unlocked
    }
    ///The write and erase operations in the Option bytes area are enabled
    #[inline(always)]
    pub fn is_locked(&self) -> bool {
        *self == OPTLOCK::Locked
    }
}
///Field `OPTLOCK` writer - Option bytes block lock
pub type OPTLOCK_W<'a, REG> = crate::BitWriter<'a, REG, OPTLOCK>;
impl<'a, REG> OPTLOCK_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///The write and erase operations in the Option bytes area are disabled
    #[inline(always)]
    pub fn unlocked(self) -> &'a mut crate::W<REG> {
        self.variant(OPTLOCK::Unlocked)
    }
    ///The write and erase operations in the Option bytes area are enabled
    #[inline(always)]
    pub fn locked(self) -> &'a mut crate::W<REG> {
        self.variant(OPTLOCK::Locked)
    }
}
/**Program memory selection

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PROG {
    ///0: The Flash program memory is not selected
    NotSelected = 0,
    ///1: The Flash program memory is selected
    Selected = 1,
}
impl From<PROG> for bool {
    #[inline(always)]
    fn from(variant: PROG) -> Self {
        variant as u8 != 0
    }
}
///Field `PROG` reader - Program memory selection
pub type PROG_R = crate::BitReader<PROG>;
impl PROG_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> PROG {
        match self.bits {
            false => PROG::NotSelected,
            true => PROG::Selected,
        }
    }
    ///The Flash program memory is not selected
    #[inline(always)]
    pub fn is_not_selected(&self) -> bool {
        *self == PROG::NotSelected
    }
    ///The Flash program memory is selected
    #[inline(always)]
    pub fn is_selected(&self) -> bool {
        *self == PROG::Selected
    }
}
///Field `PROG` writer - Program memory selection
pub type PROG_W<'a, REG> = crate::BitWriter<'a, REG, PROG>;
impl<'a, REG> PROG_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///The Flash program memory is not selected
    #[inline(always)]
    pub fn not_selected(self) -> &'a mut crate::W<REG> {
        self.variant(PROG::NotSelected)
    }
    ///The Flash program memory is selected
    #[inline(always)]
    pub fn selected(self) -> &'a mut crate::W<REG> {
        self.variant(PROG::Selected)
    }
}
/**Data EEPROM selection

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DATA {
    ///0: Data EEPROM not selected
    NotSelected = 0,
    ///1: Data memory selected
    Selected = 1,
}
impl From<DATA> for bool {
    #[inline(always)]
    fn from(variant: DATA) -> Self {
        variant as u8 != 0
    }
}
///Field `DATA` reader - Data EEPROM selection
pub type DATA_R = crate::BitReader<DATA>;
impl DATA_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> DATA {
        match self.bits {
            false => DATA::NotSelected,
            true => DATA::Selected,
        }
    }
    ///Data EEPROM not selected
    #[inline(always)]
    pub fn is_not_selected(&self) -> bool {
        *self == DATA::NotSelected
    }
    ///Data memory selected
    #[inline(always)]
    pub fn is_selected(&self) -> bool {
        *self == DATA::Selected
    }
}
///Field `DATA` writer - Data EEPROM selection
pub type DATA_W<'a, REG> = crate::BitWriter<'a, REG, DATA>;
impl<'a, REG> DATA_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Data EEPROM not selected
    #[inline(always)]
    pub fn not_selected(self) -> &'a mut crate::W<REG> {
        self.variant(DATA::NotSelected)
    }
    ///Data memory selected
    #[inline(always)]
    pub fn selected(self) -> &'a mut crate::W<REG> {
        self.variant(DATA::Selected)
    }
}
/**Fixed time data write for Byte, Half Word and Word programming

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FIX {
    ///0: An erase phase is automatically performed
    AutoErase = 0,
    ///1: The program operation is always performed with a preliminary erase
    PrelimErase = 1,
}
impl From<FIX> for bool {
    #[inline(always)]
    fn from(variant: FIX) -> Self {
        variant as u8 != 0
    }
}
///Field `FIX` reader - Fixed time data write for Byte, Half Word and Word programming
pub type FIX_R = crate::BitReader<FIX>;
impl FIX_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> FIX {
        match self.bits {
            false => FIX::AutoErase,
            true => FIX::PrelimErase,
        }
    }
    ///An erase phase is automatically performed
    #[inline(always)]
    pub fn is_auto_erase(&self) -> bool {
        *self == FIX::AutoErase
    }
    ///The program operation is always performed with a preliminary erase
    #[inline(always)]
    pub fn is_prelim_erase(&self) -> bool {
        *self == FIX::PrelimErase
    }
}
///Field `FIX` writer - Fixed time data write for Byte, Half Word and Word programming
pub type FIX_W<'a, REG> = crate::BitWriter<'a, REG, FIX>;
impl<'a, REG> FIX_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///An erase phase is automatically performed
    #[inline(always)]
    pub fn auto_erase(self) -> &'a mut crate::W<REG> {
        self.variant(FIX::AutoErase)
    }
    ///The program operation is always performed with a preliminary erase
    #[inline(always)]
    pub fn prelim_erase(self) -> &'a mut crate::W<REG> {
        self.variant(FIX::PrelimErase)
    }
}
/**Page or Double Word erase mode

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ERASE {
    ///0: No erase operation requested
    NoErase = 0,
    ///1: Erase operation requested
    Erase = 1,
}
impl From<ERASE> for bool {
    #[inline(always)]
    fn from(variant: ERASE) -> Self {
        variant as u8 != 0
    }
}
///Field `ERASE` reader - Page or Double Word erase mode
pub type ERASE_R = crate::BitReader<ERASE>;
impl ERASE_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> ERASE {
        match self.bits {
            false => ERASE::NoErase,
            true => ERASE::Erase,
        }
    }
    ///No erase operation requested
    #[inline(always)]
    pub fn is_no_erase(&self) -> bool {
        *self == ERASE::NoErase
    }
    ///Erase operation requested
    #[inline(always)]
    pub fn is_erase(&self) -> bool {
        *self == ERASE::Erase
    }
}
///Field `ERASE` writer - Page or Double Word erase mode
pub type ERASE_W<'a, REG> = crate::BitWriter<'a, REG, ERASE>;
impl<'a, REG> ERASE_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///No erase operation requested
    #[inline(always)]
    pub fn no_erase(self) -> &'a mut crate::W<REG> {
        self.variant(ERASE::NoErase)
    }
    ///Erase operation requested
    #[inline(always)]
    pub fn erase(self) -> &'a mut crate::W<REG> {
        self.variant(ERASE::Erase)
    }
}
/**Half Page/Double Word programming mode

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FPRG {
    ///0: Half Page programming disabled
    Disabled = 0,
    ///1: Half Page programming enabled
    Enabled = 1,
}
impl From<FPRG> for bool {
    #[inline(always)]
    fn from(variant: FPRG) -> Self {
        variant as u8 != 0
    }
}
///Field `FPRG` reader - Half Page/Double Word programming mode
pub type FPRG_R = crate::BitReader<FPRG>;
impl FPRG_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> FPRG {
        match self.bits {
            false => FPRG::Disabled,
            true => FPRG::Enabled,
        }
    }
    ///Half Page programming disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == FPRG::Disabled
    }
    ///Half Page programming enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == FPRG::Enabled
    }
}
///Field `FPRG` writer - Half Page/Double Word programming mode
pub type FPRG_W<'a, REG> = crate::BitWriter<'a, REG, FPRG>;
impl<'a, REG> FPRG_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Half Page programming disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(FPRG::Disabled)
    }
    ///Half Page programming enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(FPRG::Enabled)
    }
}
/**Parallel bank mode

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PARALLELBANK {
    ///0: Parallel bank mode disabled
    Disabled = 0,
    ///1: Parallel bank mode enabled
    Enabled = 1,
}
impl From<PARALLELBANK> for bool {
    #[inline(always)]
    fn from(variant: PARALLELBANK) -> Self {
        variant as u8 != 0
    }
}
///Field `PARALLELBANK` reader - Parallel bank mode
pub type PARALLELBANK_R = crate::BitReader<PARALLELBANK>;
impl PARALLELBANK_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> PARALLELBANK {
        match self.bits {
            false => PARALLELBANK::Disabled,
            true => PARALLELBANK::Enabled,
        }
    }
    ///Parallel bank mode disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == PARALLELBANK::Disabled
    }
    ///Parallel bank mode enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == PARALLELBANK::Enabled
    }
}
///Field `PARALLELBANK` writer - Parallel bank mode
pub type PARALLELBANK_W<'a, REG> = crate::BitWriter<'a, REG, PARALLELBANK>;
impl<'a, REG> PARALLELBANK_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Parallel bank mode disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(PARALLELBANK::Disabled)
    }
    ///Parallel bank mode enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(PARALLELBANK::Enabled)
    }
}
/**End of programming interrupt enable

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum EOPIE {
    ///0: End of program interrupt disable
    Disabled = 0,
    ///1: End of program interrupt enable
    Enabled = 1,
}
impl From<EOPIE> for bool {
    #[inline(always)]
    fn from(variant: EOPIE) -> Self {
        variant as u8 != 0
    }
}
///Field `EOPIE` reader - End of programming interrupt enable
pub type EOPIE_R = crate::BitReader<EOPIE>;
impl EOPIE_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> EOPIE {
        match self.bits {
            false => EOPIE::Disabled,
            true => EOPIE::Enabled,
        }
    }
    ///End of program interrupt disable
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == EOPIE::Disabled
    }
    ///End of program interrupt enable
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == EOPIE::Enabled
    }
}
///Field `EOPIE` writer - End of programming interrupt enable
pub type EOPIE_W<'a, REG> = crate::BitWriter<'a, REG, EOPIE>;
impl<'a, REG> EOPIE_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///End of program interrupt disable
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(EOPIE::Disabled)
    }
    ///End of program interrupt enable
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(EOPIE::Enabled)
    }
}
/**Error interrupt enable

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ERRIE {
    ///0: Error interrupt disable
    Disabled = 0,
    ///1: Error interrupt enable
    Enabled = 1,
}
impl From<ERRIE> for bool {
    #[inline(always)]
    fn from(variant: ERRIE) -> Self {
        variant as u8 != 0
    }
}
///Field `ERRIE` reader - Error interrupt enable
pub type ERRIE_R = crate::BitReader<ERRIE>;
impl ERRIE_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> ERRIE {
        match self.bits {
            false => ERRIE::Disabled,
            true => ERRIE::Enabled,
        }
    }
    ///Error interrupt disable
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == ERRIE::Disabled
    }
    ///Error interrupt enable
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == ERRIE::Enabled
    }
}
///Field `ERRIE` writer - Error interrupt enable
pub type ERRIE_W<'a, REG> = crate::BitWriter<'a, REG, ERRIE>;
impl<'a, REG> ERRIE_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Error interrupt disable
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(ERRIE::Disabled)
    }
    ///Error interrupt enable
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(ERRIE::Enabled)
    }
}
/**Launch the option byte loading

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OBL_LAUNCHR {
    ///0: Option byte loaded
    Complete = 0,
    ///1: Option byte loading to be done
    NotComplete = 1,
}
impl From<OBL_LAUNCHR> for bool {
    #[inline(always)]
    fn from(variant: OBL_LAUNCHR) -> Self {
        variant as u8 != 0
    }
}
///Field `OBL_LAUNCH` reader - Launch the option byte loading
pub type OBL_LAUNCH_R = crate::BitReader<OBL_LAUNCHR>;
impl OBL_LAUNCH_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> OBL_LAUNCHR {
        match self.bits {
            false => OBL_LAUNCHR::Complete,
            true => OBL_LAUNCHR::NotComplete,
        }
    }
    ///Option byte loaded
    #[inline(always)]
    pub fn is_complete(&self) -> bool {
        *self == OBL_LAUNCHR::Complete
    }
    ///Option byte loading to be done
    #[inline(always)]
    pub fn is_not_complete(&self) -> bool {
        *self == OBL_LAUNCHR::NotComplete
    }
}
/**Launch the option byte loading

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum OBL_LAUNCHW {
    ///1: Reload option byte
    Reload = 1,
}
impl From<OBL_LAUNCHW> for bool {
    #[inline(always)]
    fn from(variant: OBL_LAUNCHW) -> Self {
        variant as u8 != 0
    }
}
///Field `OBL_LAUNCH` writer - Launch the option byte loading
pub type OBL_LAUNCH_W<'a, REG> = crate::BitWriter<'a, REG, OBL_LAUNCHW>;
impl<'a, REG> OBL_LAUNCH_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Reload option byte
    #[inline(always)]
    pub fn reload(self) -> &'a mut crate::W<REG> {
        self.variant(OBL_LAUNCHW::Reload)
    }
}
///Field `NZDISABLE` reader - Non-Zero check notification disable
pub type NZDISABLE_R = crate::BitReader;
///Field `NZDISABLE` writer - Non-Zero check notification disable
pub type NZDISABLE_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
    ///Bit 0 - FLASH_PECR and data EEPROM lock
    #[inline(always)]
    pub fn pelock(&self) -> PELOCK_R {
        PELOCK_R::new((self.bits & 1) != 0)
    }
    ///Bit 1 - Program memory lock
    #[inline(always)]
    pub fn prglock(&self) -> PRGLOCK_R {
        PRGLOCK_R::new(((self.bits >> 1) & 1) != 0)
    }
    ///Bit 2 - Option bytes block lock
    #[inline(always)]
    pub fn optlock(&self) -> OPTLOCK_R {
        OPTLOCK_R::new(((self.bits >> 2) & 1) != 0)
    }
    ///Bit 3 - Program memory selection
    #[inline(always)]
    pub fn prog(&self) -> PROG_R {
        PROG_R::new(((self.bits >> 3) & 1) != 0)
    }
    ///Bit 4 - Data EEPROM selection
    #[inline(always)]
    pub fn data(&self) -> DATA_R {
        DATA_R::new(((self.bits >> 4) & 1) != 0)
    }
    ///Bit 8 - Fixed time data write for Byte, Half Word and Word programming
    #[inline(always)]
    pub fn fix(&self) -> FIX_R {
        FIX_R::new(((self.bits >> 8) & 1) != 0)
    }
    ///Bit 9 - Page or Double Word erase mode
    #[inline(always)]
    pub fn erase(&self) -> ERASE_R {
        ERASE_R::new(((self.bits >> 9) & 1) != 0)
    }
    ///Bit 10 - Half Page/Double Word programming mode
    #[inline(always)]
    pub fn fprg(&self) -> FPRG_R {
        FPRG_R::new(((self.bits >> 10) & 1) != 0)
    }
    ///Bit 15 - Parallel bank mode
    #[inline(always)]
    pub fn parallelbank(&self) -> PARALLELBANK_R {
        PARALLELBANK_R::new(((self.bits >> 15) & 1) != 0)
    }
    ///Bit 16 - End of programming interrupt enable
    #[inline(always)]
    pub fn eopie(&self) -> EOPIE_R {
        EOPIE_R::new(((self.bits >> 16) & 1) != 0)
    }
    ///Bit 17 - Error interrupt enable
    #[inline(always)]
    pub fn errie(&self) -> ERRIE_R {
        ERRIE_R::new(((self.bits >> 17) & 1) != 0)
    }
    ///Bit 18 - Launch the option byte loading
    #[inline(always)]
    pub fn obl_launch(&self) -> OBL_LAUNCH_R {
        OBL_LAUNCH_R::new(((self.bits >> 18) & 1) != 0)
    }
    ///Bit 23 - Non-Zero check notification disable
    #[inline(always)]
    pub fn nzdisable(&self) -> NZDISABLE_R {
        NZDISABLE_R::new(((self.bits >> 23) & 1) != 0)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("PECR")
            .field("pelock", &self.pelock())
            .field("prglock", &self.prglock())
            .field("optlock", &self.optlock())
            .field("prog", &self.prog())
            .field("data", &self.data())
            .field("fix", &self.fix())
            .field("erase", &self.erase())
            .field("fprg", &self.fprg())
            .field("parallelbank", &self.parallelbank())
            .field("eopie", &self.eopie())
            .field("errie", &self.errie())
            .field("obl_launch", &self.obl_launch())
            .field("nzdisable", &self.nzdisable())
            .finish()
    }
}
impl W {
    ///Bit 0 - FLASH_PECR and data EEPROM lock
    #[inline(always)]
    pub fn pelock(&mut self) -> PELOCK_W<PECRrs> {
        PELOCK_W::new(self, 0)
    }
    ///Bit 1 - Program memory lock
    #[inline(always)]
    pub fn prglock(&mut self) -> PRGLOCK_W<PECRrs> {
        PRGLOCK_W::new(self, 1)
    }
    ///Bit 2 - Option bytes block lock
    #[inline(always)]
    pub fn optlock(&mut self) -> OPTLOCK_W<PECRrs> {
        OPTLOCK_W::new(self, 2)
    }
    ///Bit 3 - Program memory selection
    #[inline(always)]
    pub fn prog(&mut self) -> PROG_W<PECRrs> {
        PROG_W::new(self, 3)
    }
    ///Bit 4 - Data EEPROM selection
    #[inline(always)]
    pub fn data(&mut self) -> DATA_W<PECRrs> {
        DATA_W::new(self, 4)
    }
    ///Bit 8 - Fixed time data write for Byte, Half Word and Word programming
    #[inline(always)]
    pub fn fix(&mut self) -> FIX_W<PECRrs> {
        FIX_W::new(self, 8)
    }
    ///Bit 9 - Page or Double Word erase mode
    #[inline(always)]
    pub fn erase(&mut self) -> ERASE_W<PECRrs> {
        ERASE_W::new(self, 9)
    }
    ///Bit 10 - Half Page/Double Word programming mode
    #[inline(always)]
    pub fn fprg(&mut self) -> FPRG_W<PECRrs> {
        FPRG_W::new(self, 10)
    }
    ///Bit 15 - Parallel bank mode
    #[inline(always)]
    pub fn parallelbank(&mut self) -> PARALLELBANK_W<PECRrs> {
        PARALLELBANK_W::new(self, 15)
    }
    ///Bit 16 - End of programming interrupt enable
    #[inline(always)]
    pub fn eopie(&mut self) -> EOPIE_W<PECRrs> {
        EOPIE_W::new(self, 16)
    }
    ///Bit 17 - Error interrupt enable
    #[inline(always)]
    pub fn errie(&mut self) -> ERRIE_W<PECRrs> {
        ERRIE_W::new(self, 17)
    }
    ///Bit 18 - Launch the option byte loading
    #[inline(always)]
    pub fn obl_launch(&mut self) -> OBL_LAUNCH_W<PECRrs> {
        OBL_LAUNCH_W::new(self, 18)
    }
    ///Bit 23 - Non-Zero check notification disable
    #[inline(always)]
    pub fn nzdisable(&mut self) -> NZDISABLE_W<PECRrs> {
        NZDISABLE_W::new(self, 23)
    }
}
/**Program/erase control register

You can [`read`](crate::Reg::read) this register and get [`pecr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`pecr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).

See register [structure](https://stm32-rs.github.io/stm32-rs/STM32L0x0.html#FLASH:PECR)*/
pub struct PECRrs;
impl crate::RegisterSpec for PECRrs {
    type Ux = u32;
}
///`read()` method returns [`pecr::R`](R) reader structure
impl crate::Readable for PECRrs {}
///`write(|w| ..)` method takes [`pecr::W`](W) writer structure
impl crate::Writable for PECRrs {
    type Safety = crate::Unsafe;
}
///`reset()` method sets PECR to value 0x07
impl crate::Resettable for PECRrs {
    const RESET_VALUE: u32 = 0x07;
}