aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorJames Munns <[email protected]>2025-11-24 18:41:43 +0100
committerGitHub <[email protected]>2025-11-24 18:41:43 +0100
commit7ee5cb570f0c0daeb2e6a9d5120fd96ee885025f (patch)
treee10b98df1dd9f96b7b3874a06f201d2e23f2fbc9 /src/lib.rs
parent6e1bc1139b7dcc8407fd1213bf0cb0788d26288e (diff)
Remove the pac singleton function (#42)
There will be a follow up PR that removes the unsafe `init` functions, but I wanted to squash this out first in case I don't get to it all today.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs15
1 files changed, 0 insertions, 15 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 6f3a63c94..95e6b3479 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -322,21 +322,6 @@ embassy_hal_internal::peripherals!(
322 WWDT0, 322 WWDT0,
323); 323);
324 324
325/// Get access to the PAC Peripherals for low-level register access.
326/// This is a lazy-initialized singleton that can be called after init().
327#[allow(static_mut_refs)]
328pub fn pac() -> &'static pac::Peripherals {
329 // SAFETY: We only call this after init(), and the PAC is a singleton.
330 // The embassy peripheral tokens ensure we don't have multiple mutable accesses.
331 unsafe {
332 static mut PAC_INSTANCE: Option<pac::Peripherals> = None;
333 if PAC_INSTANCE.is_none() {
334 PAC_INSTANCE = Some(pac::Peripherals::steal());
335 }
336 PAC_INSTANCE.as_ref().unwrap()
337 }
338}
339
340// Use cortex-m-rt's #[interrupt] attribute directly; PAC does not re-export it. 325// Use cortex-m-rt's #[interrupt] attribute directly; PAC does not re-export it.
341 326
342// Re-export interrupt traits and types 327// Re-export interrupt traits and types