@@ -4,10 +4,9 @@ use crate::time::{Hertz, U32Ext};
4
4
#[ cfg( any( feature = "stm32l0x2" , feature = "stm32l0x3" ) ) ]
5
5
use crate :: {
6
6
pac:: CRS ,
7
- syscfg:: SYSCFG ,
7
+ syscfg:: SYSCFG
8
8
} ;
9
9
10
-
11
10
/// System clock mux source
12
11
#[ derive( Clone , Copy ) ]
13
12
pub enum ClockSrc {
@@ -199,27 +198,22 @@ impl Rcc {
199
198
// Initialize CRS
200
199
crs. cfgr . write ( |w|
201
200
// Select LSE as synchronization source
202
- unsafe { w. syncsrc ( ) . bits ( 0b01 ) }
203
- ) ;
204
- crs. cr . write ( |w|
205
- w
206
- . autotrimen ( ) . set_bit ( )
207
- . cen ( ) . set_bit ( )
208
- ) ;
201
+ unsafe { w. syncsrc ( ) . bits ( 0b01 ) } ) ;
202
+ crs. cr
203
+ . modify ( |_, w| w. autotrimen ( ) . set_bit ( ) . cen ( ) . set_bit ( ) ) ;
209
204
210
205
// Enable VREFINT reference for HSI48 oscillator
211
- syscfg. syscfg . cfgr3 . modify ( |_, w|
212
- w
213
- . enref_hsi48 ( ) . set_bit ( )
214
- . en_vrefint ( ) . set_bit ( )
215
- ) ;
206
+ syscfg
207
+ . syscfg
208
+ . cfgr3
209
+ . modify ( |_, w| w. enref_hsi48 ( ) . set_bit ( ) . en_vrefint ( ) . set_bit ( ) ) ;
216
210
217
211
// Select HSI48 as USB clock
218
212
self . rb . ccipr . modify ( |_, w| w. hsi48msel ( ) . set_bit ( ) ) ;
219
213
220
214
// Enable dedicated USB clock
221
215
self . rb . crrcr . modify ( |_, w| w. hsi48on ( ) . set_bit ( ) ) ;
222
- while self . rb . crrcr . read ( ) . hsi48rdy ( ) . bit_is_clear ( ) { } ;
216
+ while self . rb . crrcr . read ( ) . hsi48rdy ( ) . bit_is_clear ( ) { }
223
217
224
218
HSI48 ( ( ) )
225
219
}
@@ -280,7 +274,7 @@ impl RccExt for RCC {
280
274
} ;
281
275
282
276
// Disable PLL
283
- self . cr . write ( | w| w. pllon ( ) . clear_bit ( ) ) ;
277
+ self . cr . modify ( |_ , w| w. pllon ( ) . clear_bit ( ) ) ;
284
278
while self . cr . read ( ) . pllrdy ( ) . bit_is_set ( ) { }
285
279
286
280
let mul_bytes = mul as u8 ;
@@ -315,7 +309,7 @@ impl RccExt for RCC {
315
309
} ) ;
316
310
317
311
// Enable PLL
318
- self . cr . write ( | w| w. pllon ( ) . set_bit ( ) ) ;
312
+ self . cr . modify ( |_ , w| w. pllon ( ) . set_bit ( ) ) ;
319
313
while self . cr . read ( ) . pllrdy ( ) . bit_is_clear ( ) { }
320
314
321
315
( freq, 3 )
@@ -366,7 +360,6 @@ impl RccExt for RCC {
366
360
367
361
Rcc { rb : self , clocks }
368
362
}
369
-
370
363
}
371
364
372
365
/// Frozen clock frequencies
@@ -420,7 +413,6 @@ impl Clocks {
420
413
}
421
414
}
422
415
423
-
424
416
/// Token that exists only, if the HSI48 clock has been enabled
425
417
///
426
418
/// You can get an instance of this struct by calling [`Rcc::enable_hsi48`].
0 commit comments