From a0c8e2d0299f3ae8eb24cd264d2b8e87f2bce464 Mon Sep 17 00:00:00 2001 From: James Munns Date: Mon, 17 Nov 2025 15:02:26 +0100 Subject: Restore examples --- examples/src/lib.rs | 8 ++++---- src/clocks/mod.rs | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/src/lib.rs b/examples/src/lib.rs index be4761c32..2018a3c25 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -12,20 +12,20 @@ use {embassy_mcxa as hal, panic_probe as _}; pub unsafe fn init_uart2_pins(_p: &hal::pac::Peripherals) { // NOTE: Lpuart has been updated to properly enable + reset its own clocks. // GPIO has not. - _ = clocks::enable_and_reset::(&clocks::NoConfig); + _ = clocks::enable_and_reset::(&clocks::periph_helpers::NoConfig); pins::configure_uart2_pins_port2(); } /// Initialize clocks for the LED GPIO/PORT used by the blink example. pub unsafe fn init_led_gpio_clocks(_p: &hal::pac::Peripherals) { - _ = clocks::enable_and_reset::(&clocks::NoConfig); - _ = clocks::enable_and_reset::(&clocks::NoConfig); + _ = clocks::enable_and_reset::(&clocks::periph_helpers::NoConfig); + _ = clocks::enable_and_reset::(&clocks::periph_helpers::NoConfig); } /// Initialize clocks and pin muxing for ADC. pub unsafe fn init_adc_pins(_p: &hal::pac::Peripherals) { // NOTE: Lpuart has been updated to properly enable + reset its own clocks. // GPIO has not. - _ = clocks::enable_and_reset::(&clocks::NoConfig); + _ = clocks::enable_and_reset::(&clocks::periph_helpers::NoConfig); pins::configure_adc_pins(); } diff --git a/src/clocks/mod.rs b/src/clocks/mod.rs index 40acb11ec..74a1f1a1f 100644 --- a/src/clocks/mod.rs +++ b/src/clocks/mod.rs @@ -319,7 +319,7 @@ pub trait Gate { /// /// This peripheral must not yet be in use prior to calling `enable_and_reset`. #[inline] -pub(crate) unsafe fn enable_and_reset(cfg: &G::MrccPeriphConfig) -> Result { +pub unsafe fn enable_and_reset(cfg: &G::MrccPeriphConfig) -> Result { let freq = enable::(cfg).inspect_err(|_| disable::())?; pulse_reset::(); Ok(freq) @@ -334,7 +334,7 @@ pub(crate) unsafe fn enable_and_reset(cfg: &G::MrccPeriphConfig) -> Res /// /// This peripheral must not yet be in use prior to calling `enable`. #[inline] -pub(crate) unsafe fn enable(cfg: &G::MrccPeriphConfig) -> Result { +pub unsafe fn enable(cfg: &G::MrccPeriphConfig) -> Result { G::enable_clock(); while !G::is_clock_enabled() {} core::arch::asm!("dsb sy; isb sy", options(nomem, nostack, preserves_flags)); @@ -357,14 +357,14 @@ pub(crate) unsafe fn enable(cfg: &G::MrccPeriphConfig) -> Result() { +pub unsafe fn disable() { G::disable_clock(); } /// Check whether a gate is currently enabled. #[allow(dead_code)] #[inline] -pub(crate) fn is_clock_enabled() -> bool { +pub fn is_clock_enabled() -> bool { G::is_clock_enabled() } @@ -376,7 +376,7 @@ pub(crate) fn is_clock_enabled() -> bool { /// /// This peripheral must not yet be in use prior to calling `release_reset`. #[inline] -pub(crate) unsafe fn release_reset() { +pub unsafe fn release_reset() { G::release_reset(); } @@ -388,13 +388,13 @@ pub(crate) unsafe fn release_reset() { /// /// This peripheral must not yet be in use prior to calling `assert_reset`. #[inline] -pub(crate) unsafe fn assert_reset() { +pub unsafe fn assert_reset() { G::assert_reset(); } /// Check whether the peripheral is held in reset. #[inline] -pub(crate) unsafe fn is_reset_released() -> bool { +pub unsafe fn is_reset_released() -> bool { G::is_reset_released() } @@ -406,7 +406,7 @@ pub(crate) unsafe fn is_reset_released() -> bool { /// /// This peripheral must not yet be in use prior to calling `release_reset`. #[inline] -pub(crate) unsafe fn pulse_reset() { +pub unsafe fn pulse_reset() { G::assert_reset(); cortex_m::asm::nop(); cortex_m::asm::nop(); -- cgit