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