@@ -70,7 +70,7 @@ impl PWR {
70
70
/// Returns a struct that can be used to enter Sleep mode
71
71
pub fn sleep_mode < ' r > ( & ' r mut self , scb : & ' r mut SCB ) -> SleepMode < ' r > {
72
72
SleepMode {
73
- pwr : & mut self . 0 ,
73
+ pwr : self ,
74
74
scb,
75
75
}
76
76
}
@@ -108,7 +108,7 @@ impl PWR {
108
108
-> StopMode < ' r >
109
109
{
110
110
StopMode {
111
- pwr : & mut self . 0 ,
111
+ pwr : self ,
112
112
scb,
113
113
rcc,
114
114
config,
@@ -118,7 +118,7 @@ impl PWR {
118
118
/// Returns a struct that can be used to enter Standby mode
119
119
pub fn standby_mode < ' r > ( & ' r mut self , scb : & ' r mut SCB ) -> StandbyMode < ' r > {
120
120
StandbyMode {
121
- pwr : & mut self . 0 ,
121
+ pwr : self ,
122
122
scb,
123
123
}
124
124
}
@@ -175,16 +175,16 @@ pub trait PowerMode {
175
175
///
176
176
/// Please note that entering Sleep mode may change the SCB configuration.
177
177
pub struct SleepMode < ' r > {
178
- pwr : & ' r mut pac :: PWR ,
178
+ pwr : & ' r mut PWR ,
179
179
scb : & ' r mut SCB ,
180
180
}
181
181
182
182
impl PowerMode for SleepMode < ' _ > {
183
183
fn enter ( & mut self ) {
184
184
#[ cfg( feature = "stm32l0x1" ) ]
185
- self . pwr . cr . modify ( |_, w| w. lpsdsr ( ) . main_mode ( ) ) ;
185
+ self . pwr . 0 . cr . modify ( |_, w| w. lpsdsr ( ) . main_mode ( ) ) ;
186
186
#[ cfg( any( feature = "stm32l0x2" , feature = "stm32l0x3" ) ) ]
187
- self . pwr . cr . modify ( |_, w| w. lpds ( ) . clear_bit ( ) ) ;
187
+ self . pwr . 0 . cr . modify ( |_, w| w. lpds ( ) . clear_bit ( ) ) ;
188
188
189
189
self . scb . clear_sleepdeep ( ) ;
190
190
@@ -253,7 +253,7 @@ impl PowerMode for LowPowerSleepMode<'_> {
253
253
/// that might require special handling. This is explained in the STM32L0x2
254
254
/// Reference Manual, section 6.3.9.
255
255
pub struct StopMode < ' r > {
256
- pwr : & ' r mut pac :: PWR ,
256
+ pwr : & ' r mut PWR ,
257
257
scb : & ' r mut SCB ,
258
258
rcc : & ' r mut Rcc ,
259
259
config : StopModeConfig ,
@@ -308,7 +308,7 @@ impl PowerMode for StopMode<'_> {
308
308
) ;
309
309
310
310
// Configure Stop mode
311
- self . pwr . cr . modify ( |_, w|
311
+ self . pwr . 0 . cr . modify ( |_, w|
312
312
w
313
313
// Ultra-low-power mode
314
314
. ulp ( ) . bit ( self . config . ultra_low_power )
@@ -321,7 +321,7 @@ impl PowerMode for StopMode<'_> {
321
321
) ;
322
322
323
323
// Wait for WUF to be cleared
324
- while self . pwr . csr . read ( ) . wuf ( ) . bit_is_set ( ) { }
324
+ while self . pwr . 0 . csr . read ( ) . wuf ( ) . bit_is_set ( ) { }
325
325
326
326
// Enter Stop mode
327
327
asm:: dsb ( ) ;
@@ -355,15 +355,15 @@ pub struct StopModeConfig {
355
355
/// it could block forever. Once woken up, the method will not return. Instead,
356
356
/// the microcontroller will reset.
357
357
pub struct StandbyMode < ' r > {
358
- pwr : & ' r mut pac :: PWR ,
358
+ pwr : & ' r mut PWR ,
359
359
scb : & ' r mut SCB ,
360
360
}
361
361
362
362
impl PowerMode for StandbyMode < ' _ > {
363
363
fn enter ( & mut self ) {
364
364
// Configure Standby mode
365
365
self . scb . set_sleepdeep ( ) ;
366
- self . pwr . cr . modify ( |_, w|
366
+ self . pwr . 0 . cr . modify ( |_, w|
367
367
w
368
368
// Clear WUF
369
369
. cwuf ( ) . set_bit ( )
@@ -372,7 +372,7 @@ impl PowerMode for StandbyMode<'_> {
372
372
) ;
373
373
374
374
// Wait for WUF to be cleared
375
- while self . pwr . csr . read ( ) . wuf ( ) . bit_is_set ( ) { }
375
+ while self . pwr . 0 . csr . read ( ) . wuf ( ) . bit_is_set ( ) { }
376
376
377
377
// Enter Standby mode
378
378
asm:: dsb ( ) ;
0 commit comments