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
///Register `CR` reader
pub type R = crate::R<CRrs>;
///Register `CR` writer
pub type W = crate::W<CRrs>;
/**Low-power deepsleep/Sleep/Low-power run

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LPSDSR {
    ///0: Voltage regulator on during Deepsleep/Sleep/Low-power run mode
    MainMode = 0,
    ///1: Voltage regulator in low-power mode during Deepsleep/Sleep/Low-power run mode
    LowPowerMode = 1,
}
impl From<LPSDSR> for bool {
    #[inline(always)]
    fn from(variant: LPSDSR) -> Self {
        variant as u8 != 0
    }
}
///Field `LPSDSR` reader - Low-power deepsleep/Sleep/Low-power run
pub type LPSDSR_R = crate::BitReader<LPSDSR>;
impl LPSDSR_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> LPSDSR {
        match self.bits {
            false => LPSDSR::MainMode,
            true => LPSDSR::LowPowerMode,
        }
    }
    ///Voltage regulator on during Deepsleep/Sleep/Low-power run mode
    #[inline(always)]
    pub fn is_main_mode(&self) -> bool {
        *self == LPSDSR::MainMode
    }
    ///Voltage regulator in low-power mode during Deepsleep/Sleep/Low-power run mode
    #[inline(always)]
    pub fn is_low_power_mode(&self) -> bool {
        *self == LPSDSR::LowPowerMode
    }
}
///Field `LPSDSR` writer - Low-power deepsleep/Sleep/Low-power run
pub type LPSDSR_W<'a, REG> = crate::BitWriter<'a, REG, LPSDSR>;
impl<'a, REG> LPSDSR_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Voltage regulator on during Deepsleep/Sleep/Low-power run mode
    #[inline(always)]
    pub fn main_mode(self) -> &'a mut crate::W<REG> {
        self.variant(LPSDSR::MainMode)
    }
    ///Voltage regulator in low-power mode during Deepsleep/Sleep/Low-power run mode
    #[inline(always)]
    pub fn low_power_mode(self) -> &'a mut crate::W<REG> {
        self.variant(LPSDSR::LowPowerMode)
    }
}
/**Power down deepsleep

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum PDDS {
    ///0: Enter Stop mode when the CPU enters deepsleep
    StopMode = 0,
    ///1: Enter Standby mode when the CPU enters deepsleep
    StandbyMode = 1,
}
impl From<PDDS> for bool {
    #[inline(always)]
    fn from(variant: PDDS) -> Self {
        variant as u8 != 0
    }
}
///Field `PDDS` reader - Power down deepsleep
pub type PDDS_R = crate::BitReader<PDDS>;
impl PDDS_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> PDDS {
        match self.bits {
            false => PDDS::StopMode,
            true => PDDS::StandbyMode,
        }
    }
    ///Enter Stop mode when the CPU enters deepsleep
    #[inline(always)]
    pub fn is_stop_mode(&self) -> bool {
        *self == PDDS::StopMode
    }
    ///Enter Standby mode when the CPU enters deepsleep
    #[inline(always)]
    pub fn is_standby_mode(&self) -> bool {
        *self == PDDS::StandbyMode
    }
}
///Field `PDDS` writer - Power down deepsleep
pub type PDDS_W<'a, REG> = crate::BitWriter<'a, REG, PDDS>;
impl<'a, REG> PDDS_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Enter Stop mode when the CPU enters deepsleep
    #[inline(always)]
    pub fn stop_mode(self) -> &'a mut crate::W<REG> {
        self.variant(PDDS::StopMode)
    }
    ///Enter Standby mode when the CPU enters deepsleep
    #[inline(always)]
    pub fn standby_mode(self) -> &'a mut crate::W<REG> {
        self.variant(PDDS::StandbyMode)
    }
}
/**Clear wakeup flag

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CWUFW {
    ///1: Clear the WUF Wakeup flag after 2 system clock cycles
    Clear = 1,
}
impl From<CWUFW> for bool {
    #[inline(always)]
    fn from(variant: CWUFW) -> Self {
        variant as u8 != 0
    }
}
///Field `CWUF` reader - Clear wakeup flag
pub type CWUF_R = crate::BitReader<CWUFW>;
impl CWUF_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<CWUFW> {
        match self.bits {
            true => Some(CWUFW::Clear),
            _ => None,
        }
    }
    ///Clear the WUF Wakeup flag after 2 system clock cycles
    #[inline(always)]
    pub fn is_clear(&self) -> bool {
        *self == CWUFW::Clear
    }
}
///Field `CWUF` writer - Clear wakeup flag
pub type CWUF_W<'a, REG> = crate::BitWriter<'a, REG, CWUFW>;
impl<'a, REG> CWUF_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Clear the WUF Wakeup flag after 2 system clock cycles
    #[inline(always)]
    pub fn clear(self) -> &'a mut crate::W<REG> {
        self.variant(CWUFW::Clear)
    }
}
/**Clear standby flag

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum CSBFW {
    ///1: Clear the SBF Standby flag
    Clear = 1,
}
impl From<CSBFW> for bool {
    #[inline(always)]
    fn from(variant: CSBFW) -> Self {
        variant as u8 != 0
    }
}
///Field `CSBF` reader - Clear standby flag
pub type CSBF_R = crate::BitReader<CSBFW>;
impl CSBF_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<CSBFW> {
        match self.bits {
            true => Some(CSBFW::Clear),
            _ => None,
        }
    }
    ///Clear the SBF Standby flag
    #[inline(always)]
    pub fn is_clear(&self) -> bool {
        *self == CSBFW::Clear
    }
}
///Field `CSBF` writer - Clear standby flag
pub type CSBF_W<'a, REG> = crate::BitWriter<'a, REG, CSBFW>;
impl<'a, REG> CSBF_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Clear the SBF Standby flag
    #[inline(always)]
    pub fn clear(self) -> &'a mut crate::W<REG> {
        self.variant(CSBFW::Clear)
    }
}
/**Disable backup domain write protection

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DBP {
    ///0: Access to RTC, RTC Backup and RCC CSR registers disabled
    Disabled = 0,
    ///1: Access to RTC, RTC Backup and RCC CSR registers enabled
    Enabled = 1,
}
impl From<DBP> for bool {
    #[inline(always)]
    fn from(variant: DBP) -> Self {
        variant as u8 != 0
    }
}
///Field `DBP` reader - Disable backup domain write protection
pub type DBP_R = crate::BitReader<DBP>;
impl DBP_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> DBP {
        match self.bits {
            false => DBP::Disabled,
            true => DBP::Enabled,
        }
    }
    ///Access to RTC, RTC Backup and RCC CSR registers disabled
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == DBP::Disabled
    }
    ///Access to RTC, RTC Backup and RCC CSR registers enabled
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == DBP::Enabled
    }
}
///Field `DBP` writer - Disable backup domain write protection
pub type DBP_W<'a, REG> = crate::BitWriter<'a, REG, DBP>;
impl<'a, REG> DBP_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Access to RTC, RTC Backup and RCC CSR registers disabled
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(DBP::Disabled)
    }
    ///Access to RTC, RTC Backup and RCC CSR registers enabled
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(DBP::Enabled)
    }
}
/**Ultra-low-power mode

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum ULP {
    ///0: VREFINT is on in low-power mode
    Enabled = 0,
    ///1: VREFINT is off in low-power mode
    Disabled = 1,
}
impl From<ULP> for bool {
    #[inline(always)]
    fn from(variant: ULP) -> Self {
        variant as u8 != 0
    }
}
///Field `ULP` reader - Ultra-low-power mode
pub type ULP_R = crate::BitReader<ULP>;
impl ULP_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> ULP {
        match self.bits {
            false => ULP::Enabled,
            true => ULP::Disabled,
        }
    }
    ///VREFINT is on in low-power mode
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == ULP::Enabled
    }
    ///VREFINT is off in low-power mode
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == ULP::Disabled
    }
}
///Field `ULP` writer - Ultra-low-power mode
pub type ULP_W<'a, REG> = crate::BitWriter<'a, REG, ULP>;
impl<'a, REG> ULP_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///VREFINT is on in low-power mode
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(ULP::Enabled)
    }
    ///VREFINT is off in low-power mode
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(ULP::Disabled)
    }
}
/**Fast wakeup

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum FWU {
    ///0: Low-power modes exit occurs only when VREFINT is ready
    Disabled = 0,
    ///1: VREFINT start up time is ignored when exiting low-power modes
    Enabled = 1,
}
impl From<FWU> for bool {
    #[inline(always)]
    fn from(variant: FWU) -> Self {
        variant as u8 != 0
    }
}
///Field `FWU` reader - Fast wakeup
pub type FWU_R = crate::BitReader<FWU>;
impl FWU_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> FWU {
        match self.bits {
            false => FWU::Disabled,
            true => FWU::Enabled,
        }
    }
    ///Low-power modes exit occurs only when VREFINT is ready
    #[inline(always)]
    pub fn is_disabled(&self) -> bool {
        *self == FWU::Disabled
    }
    ///VREFINT start up time is ignored when exiting low-power modes
    #[inline(always)]
    pub fn is_enabled(&self) -> bool {
        *self == FWU::Enabled
    }
}
///Field `FWU` writer - Fast wakeup
pub type FWU_W<'a, REG> = crate::BitWriter<'a, REG, FWU>;
impl<'a, REG> FWU_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Low-power modes exit occurs only when VREFINT is ready
    #[inline(always)]
    pub fn disabled(self) -> &'a mut crate::W<REG> {
        self.variant(FWU::Disabled)
    }
    ///VREFINT start up time is ignored when exiting low-power modes
    #[inline(always)]
    pub fn enabled(self) -> &'a mut crate::W<REG> {
        self.variant(FWU::Enabled)
    }
}
/**Voltage scaling range selection

Value on reset: 2*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum VOS {
    ///1: 1.8 V (range 1)
    V1_8 = 1,
    ///2: 1.5 V (range 2)
    V1_5 = 2,
    ///3: 1.2 V (range 3)
    V1_2 = 3,
}
impl From<VOS> for u8 {
    #[inline(always)]
    fn from(variant: VOS) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for VOS {
    type Ux = u8;
}
impl crate::IsEnum for VOS {}
///Field `VOS` reader - Voltage scaling range selection
pub type VOS_R = crate::FieldReader<VOS>;
impl VOS_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> Option<VOS> {
        match self.bits {
            1 => Some(VOS::V1_8),
            2 => Some(VOS::V1_5),
            3 => Some(VOS::V1_2),
            _ => None,
        }
    }
    ///1.8 V (range 1)
    #[inline(always)]
    pub fn is_v1_8(&self) -> bool {
        *self == VOS::V1_8
    }
    ///1.5 V (range 2)
    #[inline(always)]
    pub fn is_v1_5(&self) -> bool {
        *self == VOS::V1_5
    }
    ///1.2 V (range 3)
    #[inline(always)]
    pub fn is_v1_2(&self) -> bool {
        *self == VOS::V1_2
    }
}
///Field `VOS` writer - Voltage scaling range selection
pub type VOS_W<'a, REG> = crate::FieldWriter<'a, REG, 2, VOS>;
impl<'a, REG> VOS_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    ///1.8 V (range 1)
    #[inline(always)]
    pub fn v1_8(self) -> &'a mut crate::W<REG> {
        self.variant(VOS::V1_8)
    }
    ///1.5 V (range 2)
    #[inline(always)]
    pub fn v1_5(self) -> &'a mut crate::W<REG> {
        self.variant(VOS::V1_5)
    }
    ///1.2 V (range 3)
    #[inline(always)]
    pub fn v1_2(self) -> &'a mut crate::W<REG> {
        self.variant(VOS::V1_2)
    }
}
/**Deep sleep mode with Flash memory kept off

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum DS_EE_KOFF {
    ///0: NVM woken up when exiting from Deepsleep mode even if the bit RUN_PD is set
    NvmwakeUp = 0,
    ///1: NVM not woken up when exiting from low-power mode (if the bit RUN_PD is set)
    Nvmsleep = 1,
}
impl From<DS_EE_KOFF> for bool {
    #[inline(always)]
    fn from(variant: DS_EE_KOFF) -> Self {
        variant as u8 != 0
    }
}
///Field `DS_EE_KOFF` reader - Deep sleep mode with Flash memory kept off
pub type DS_EE_KOFF_R = crate::BitReader<DS_EE_KOFF>;
impl DS_EE_KOFF_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> DS_EE_KOFF {
        match self.bits {
            false => DS_EE_KOFF::NvmwakeUp,
            true => DS_EE_KOFF::Nvmsleep,
        }
    }
    ///NVM woken up when exiting from Deepsleep mode even if the bit RUN_PD is set
    #[inline(always)]
    pub fn is_nvmwake_up(&self) -> bool {
        *self == DS_EE_KOFF::NvmwakeUp
    }
    ///NVM not woken up when exiting from low-power mode (if the bit RUN_PD is set)
    #[inline(always)]
    pub fn is_nvmsleep(&self) -> bool {
        *self == DS_EE_KOFF::Nvmsleep
    }
}
///Field `DS_EE_KOFF` writer - Deep sleep mode with Flash memory kept off
pub type DS_EE_KOFF_W<'a, REG> = crate::BitWriter<'a, REG, DS_EE_KOFF>;
impl<'a, REG> DS_EE_KOFF_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///NVM woken up when exiting from Deepsleep mode even if the bit RUN_PD is set
    #[inline(always)]
    pub fn nvmwake_up(self) -> &'a mut crate::W<REG> {
        self.variant(DS_EE_KOFF::NvmwakeUp)
    }
    ///NVM not woken up when exiting from low-power mode (if the bit RUN_PD is set)
    #[inline(always)]
    pub fn nvmsleep(self) -> &'a mut crate::W<REG> {
        self.variant(DS_EE_KOFF::Nvmsleep)
    }
}
/**Low power run mode

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LPRUN {
    ///0: Voltage regulator in Main mode in Low-power run mode
    MainMode = 0,
    ///1: Voltage regulator in low-power mode in Low-power run mode
    LowPowerMode = 1,
}
impl From<LPRUN> for bool {
    #[inline(always)]
    fn from(variant: LPRUN) -> Self {
        variant as u8 != 0
    }
}
///Field `LPRUN` reader - Low power run mode
pub type LPRUN_R = crate::BitReader<LPRUN>;
impl LPRUN_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> LPRUN {
        match self.bits {
            false => LPRUN::MainMode,
            true => LPRUN::LowPowerMode,
        }
    }
    ///Voltage regulator in Main mode in Low-power run mode
    #[inline(always)]
    pub fn is_main_mode(&self) -> bool {
        *self == LPRUN::MainMode
    }
    ///Voltage regulator in low-power mode in Low-power run mode
    #[inline(always)]
    pub fn is_low_power_mode(&self) -> bool {
        *self == LPRUN::LowPowerMode
    }
}
///Field `LPRUN` writer - Low power run mode
pub type LPRUN_W<'a, REG> = crate::BitWriter<'a, REG, LPRUN>;
impl<'a, REG> LPRUN_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Voltage regulator in Main mode in Low-power run mode
    #[inline(always)]
    pub fn main_mode(self) -> &'a mut crate::W<REG> {
        self.variant(LPRUN::MainMode)
    }
    ///Voltage regulator in low-power mode in Low-power run mode
    #[inline(always)]
    pub fn low_power_mode(self) -> &'a mut crate::W<REG> {
        self.variant(LPRUN::LowPowerMode)
    }
}
/**Regulator in Low-power deepsleep mode

Value on reset: 0*/
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum LPDS {
    ///0: Voltage regulator in Main mode during Deepsleep mode (Stop mode)
    MainMode = 0,
    ///1: Voltage regulator switches to low-power mode when the CPU enters Deepsleep mode (Stop mode)
    LowPowerMode = 1,
}
impl From<LPDS> for bool {
    #[inline(always)]
    fn from(variant: LPDS) -> Self {
        variant as u8 != 0
    }
}
///Field `LPDS` reader - Regulator in Low-power deepsleep mode
pub type LPDS_R = crate::BitReader<LPDS>;
impl LPDS_R {
    ///Get enumerated values variant
    #[inline(always)]
    pub const fn variant(&self) -> LPDS {
        match self.bits {
            false => LPDS::MainMode,
            true => LPDS::LowPowerMode,
        }
    }
    ///Voltage regulator in Main mode during Deepsleep mode (Stop mode)
    #[inline(always)]
    pub fn is_main_mode(&self) -> bool {
        *self == LPDS::MainMode
    }
    ///Voltage regulator switches to low-power mode when the CPU enters Deepsleep mode (Stop mode)
    #[inline(always)]
    pub fn is_low_power_mode(&self) -> bool {
        *self == LPDS::LowPowerMode
    }
}
///Field `LPDS` writer - Regulator in Low-power deepsleep mode
pub type LPDS_W<'a, REG> = crate::BitWriter<'a, REG, LPDS>;
impl<'a, REG> LPDS_W<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    ///Voltage regulator in Main mode during Deepsleep mode (Stop mode)
    #[inline(always)]
    pub fn main_mode(self) -> &'a mut crate::W<REG> {
        self.variant(LPDS::MainMode)
    }
    ///Voltage regulator switches to low-power mode when the CPU enters Deepsleep mode (Stop mode)
    #[inline(always)]
    pub fn low_power_mode(self) -> &'a mut crate::W<REG> {
        self.variant(LPDS::LowPowerMode)
    }
}
impl R {
    ///Bit 0 - Low-power deepsleep/Sleep/Low-power run
    #[inline(always)]
    pub fn lpsdsr(&self) -> LPSDSR_R {
        LPSDSR_R::new((self.bits & 1) != 0)
    }
    ///Bit 1 - Power down deepsleep
    #[inline(always)]
    pub fn pdds(&self) -> PDDS_R {
        PDDS_R::new(((self.bits >> 1) & 1) != 0)
    }
    ///Bit 2 - Clear wakeup flag
    #[inline(always)]
    pub fn cwuf(&self) -> CWUF_R {
        CWUF_R::new(((self.bits >> 2) & 1) != 0)
    }
    ///Bit 3 - Clear standby flag
    #[inline(always)]
    pub fn csbf(&self) -> CSBF_R {
        CSBF_R::new(((self.bits >> 3) & 1) != 0)
    }
    ///Bit 8 - Disable backup domain write protection
    #[inline(always)]
    pub fn dbp(&self) -> DBP_R {
        DBP_R::new(((self.bits >> 8) & 1) != 0)
    }
    ///Bit 9 - Ultra-low-power mode
    #[inline(always)]
    pub fn ulp(&self) -> ULP_R {
        ULP_R::new(((self.bits >> 9) & 1) != 0)
    }
    ///Bit 10 - Fast wakeup
    #[inline(always)]
    pub fn fwu(&self) -> FWU_R {
        FWU_R::new(((self.bits >> 10) & 1) != 0)
    }
    ///Bits 11:12 - Voltage scaling range selection
    #[inline(always)]
    pub fn vos(&self) -> VOS_R {
        VOS_R::new(((self.bits >> 11) & 3) as u8)
    }
    ///Bit 13 - Deep sleep mode with Flash memory kept off
    #[inline(always)]
    pub fn ds_ee_koff(&self) -> DS_EE_KOFF_R {
        DS_EE_KOFF_R::new(((self.bits >> 13) & 1) != 0)
    }
    ///Bit 14 - Low power run mode
    #[inline(always)]
    pub fn lprun(&self) -> LPRUN_R {
        LPRUN_R::new(((self.bits >> 14) & 1) != 0)
    }
    ///Bit 16 - Regulator in Low-power deepsleep mode
    #[inline(always)]
    pub fn lpds(&self) -> LPDS_R {
        LPDS_R::new(((self.bits >> 16) & 1) != 0)
    }
}
impl core::fmt::Debug for R {
    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
        f.debug_struct("CR")
            .field("lpsdsr", &self.lpsdsr())
            .field("pdds", &self.pdds())
            .field("cwuf", &self.cwuf())
            .field("csbf", &self.csbf())
            .field("dbp", &self.dbp())
            .field("ulp", &self.ulp())
            .field("fwu", &self.fwu())
            .field("vos", &self.vos())
            .field("ds_ee_koff", &self.ds_ee_koff())
            .field("lprun", &self.lprun())
            .field("lpds", &self.lpds())
            .finish()
    }
}
impl W {
    ///Bit 0 - Low-power deepsleep/Sleep/Low-power run
    #[inline(always)]
    pub fn lpsdsr(&mut self) -> LPSDSR_W<CRrs> {
        LPSDSR_W::new(self, 0)
    }
    ///Bit 1 - Power down deepsleep
    #[inline(always)]
    pub fn pdds(&mut self) -> PDDS_W<CRrs> {
        PDDS_W::new(self, 1)
    }
    ///Bit 2 - Clear wakeup flag
    #[inline(always)]
    pub fn cwuf(&mut self) -> CWUF_W<CRrs> {
        CWUF_W::new(self, 2)
    }
    ///Bit 3 - Clear standby flag
    #[inline(always)]
    pub fn csbf(&mut self) -> CSBF_W<CRrs> {
        CSBF_W::new(self, 3)
    }
    ///Bit 8 - Disable backup domain write protection
    #[inline(always)]
    pub fn dbp(&mut self) -> DBP_W<CRrs> {
        DBP_W::new(self, 8)
    }
    ///Bit 9 - Ultra-low-power mode
    #[inline(always)]
    pub fn ulp(&mut self) -> ULP_W<CRrs> {
        ULP_W::new(self, 9)
    }
    ///Bit 10 - Fast wakeup
    #[inline(always)]
    pub fn fwu(&mut self) -> FWU_W<CRrs> {
        FWU_W::new(self, 10)
    }
    ///Bits 11:12 - Voltage scaling range selection
    #[inline(always)]
    pub fn vos(&mut self) -> VOS_W<CRrs> {
        VOS_W::new(self, 11)
    }
    ///Bit 13 - Deep sleep mode with Flash memory kept off
    #[inline(always)]
    pub fn ds_ee_koff(&mut self) -> DS_EE_KOFF_W<CRrs> {
        DS_EE_KOFF_W::new(self, 13)
    }
    ///Bit 14 - Low power run mode
    #[inline(always)]
    pub fn lprun(&mut self) -> LPRUN_W<CRrs> {
        LPRUN_W::new(self, 14)
    }
    ///Bit 16 - Regulator in Low-power deepsleep mode
    #[inline(always)]
    pub fn lpds(&mut self) -> LPDS_W<CRrs> {
        LPDS_W::new(self, 16)
    }
}
/**power control register

You can [`read`](crate::Reg::read) this register and get [`cr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cr::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#PWR:CR)*/
pub struct CRrs;
impl crate::RegisterSpec for CRrs {
    type Ux = u32;
}
///`read()` method returns [`cr::R`](R) reader structure
impl crate::Readable for CRrs {}
///`write(|w| ..)` method takes [`cr::W`](W) writer structure
impl crate::Writable for CRrs {
    type Safety = crate::Unsafe;
}
///`reset()` method sets CR to value 0x1000
impl crate::Resettable for CRrs {
    const RESET_VALUE: u32 = 0x1000;
}