File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,15 @@ pub(crate) unsafe fn get_freqs() -> &'static Clocks {
95
95
unwrap ! ( CLOCK_FREQS_PTR . load( core:: sync:: atomic:: Ordering :: SeqCst ) . as_ref( ) ) . assume_init_ref ( )
96
96
}
97
97
98
+ /// Get the current clock configuration of the chip.
99
+ pub fn clocks < ' a > ( _rcc : & ' a crate :: Peri < ' a , crate :: peripherals:: RCC > ) -> & ' a Clocks {
100
+ // Safety: the existence of a `Peri<RCC>` means that `rcc::init()`
101
+ // has already been called, so `CLOCK_FREQS` must be initialized.
102
+ // The clocks could be modified again by `reinit()`, but reinit
103
+ // (for this reason) requires an exclusive reference to `Peri<RCC>`.
104
+ unsafe { get_freqs ( ) }
105
+ }
106
+
98
107
pub ( crate ) trait SealedRccPeripheral {
99
108
fn frequency ( ) -> Hertz ;
100
109
#[ allow( dead_code) ]
@@ -381,7 +390,7 @@ pub fn disable<T: RccPeripheral>() {
381
390
///
382
391
/// This should only be called after `init`.
383
392
#[ cfg( not( feature = "_dual-core" ) ) ]
384
- pub fn reinit ( config : Config ) {
393
+ pub fn reinit < ' a > ( config : Config , _rcc : & ' a mut crate :: Peri < ' a , crate :: peripherals :: RCC > ) {
385
394
critical_section:: with ( |cs| init_rcc ( cs, config) )
386
395
}
387
396
You can’t perform that action at this time.
0 commit comments