Skip to content

Commit

Permalink
Merge branch 'main' into i8080_move_api
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominaezzz authored Sep 25, 2024
2 parents 8d6d52e + feaf668 commit 389e8de
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions esp-hal/src/clock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,16 @@ impl Clocks {
})
}

fn try_get() -> Option<&'static Clocks> {
fn try_get<'a>() -> Option<&'a Clocks> {
unsafe {
// Safety: ACTIVE_CLOCKS is only set in `init` and never modified after that.
ACTIVE_CLOCKS.as_ref()
let clocks = &*core::ptr::addr_of!(ACTIVE_CLOCKS);
clocks.as_ref()
}
}

/// Get the active clock configuration.
pub fn get() -> &'static Clocks {
pub fn get<'a>() -> &'a Clocks {
unwrap!(Self::try_get())
}

Expand Down

0 comments on commit 389e8de

Please sign in to comment.