From 7ee5cb570f0c0daeb2e6a9d5120fd96ee885025f Mon Sep 17 00:00:00 2001 From: James Munns Date: Mon, 24 Nov 2025 18:41:43 +0100 Subject: 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. --- examples/src/bin/adc_interrupt.rs | 4 ++-- examples/src/bin/adc_polling.rs | 11 ++--------- examples/src/bin/hello.rs | 2 +- examples/src/bin/lpuart_buffered.rs | 2 +- examples/src/bin/lpuart_polling.rs | 2 +- examples/src/bin/rtc_alarm.rs | 2 +- 6 files changed, 8 insertions(+), 15 deletions(-) (limited to 'examples/src/bin') diff --git a/examples/src/bin/adc_interrupt.rs b/examples/src/bin/adc_interrupt.rs index 9fed052fd..0d3a75a28 100644 --- a/examples/src/bin/adc_interrupt.rs +++ b/examples/src/bin/adc_interrupt.rs @@ -36,7 +36,7 @@ async fn main(_spawner: Spawner) { // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX unsafe { - embassy_mcxa_examples::init_uart2_pins(hal::pac()); + embassy_mcxa_examples::init_uart2_pins(); } let mut uart = Lpuart::new_blocking( p.LPUART2, // Peripheral @@ -48,7 +48,7 @@ async fn main(_spawner: Spawner) { uart.write_str_blocking("\r\n=== ADC interrupt Example ===\r\n"); unsafe { - init_adc_pins(hal::pac()); + init_adc_pins(); } let adc_config = LpadcConfig { diff --git a/examples/src/bin/adc_polling.rs b/examples/src/bin/adc_polling.rs index 545f8f77a..02ac321b5 100644 --- a/examples/src/bin/adc_polling.rs +++ b/examples/src/bin/adc_polling.rs @@ -22,10 +22,6 @@ const G_LPADC_RESULT_SHIFT: u32 = 0; async fn main(_spawner: Spawner) { let p = hal::init(hal::config::Config::default()); - unsafe { - init_uart2_pins(hal::pac()); - } - // Create UART configuration let config = Config { baudrate_bps: 115_200, @@ -36,7 +32,8 @@ async fn main(_spawner: Spawner) { // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX unsafe { - init_uart2_pins(hal::pac()); + init_uart2_pins(); + init_adc_pins(); } let mut uart = Lpuart::new_blocking( p.LPUART2, // Peripheral @@ -48,10 +45,6 @@ async fn main(_spawner: Spawner) { uart.write_str_blocking("\r\n=== ADC polling Example ===\r\n"); - unsafe { - init_adc_pins(hal::pac()); - } - let adc_config = LpadcConfig { enable_in_doze_mode: true, conversion_average_mode: CalAvgs::Average128, diff --git a/examples/src/bin/hello.rs b/examples/src/bin/hello.rs index e2d0b413d..0362480c1 100644 --- a/examples/src/bin/hello.rs +++ b/examples/src/bin/hello.rs @@ -28,7 +28,7 @@ async fn main(_spawner: Spawner) { // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX unsafe { - embassy_mcxa_examples::init_uart2_pins(hal::pac()); + embassy_mcxa_examples::init_uart2_pins(); } let mut uart = Lpuart::new_blocking( p.LPUART2, // Peripheral diff --git a/examples/src/bin/lpuart_buffered.rs b/examples/src/bin/lpuart_buffered.rs index b0d19ef16..4c9294f57 100644 --- a/examples/src/bin/lpuart_buffered.rs +++ b/examples/src/bin/lpuart_buffered.rs @@ -32,7 +32,7 @@ async fn main(_spawner: Spawner) { hal::interrupt::LPUART2.configure_for_uart(hal::interrupt::Priority::P3); unsafe { - init_uart2_pins(hal::pac()); + init_uart2_pins(); } // UART configuration (enable both TX and RX) diff --git a/examples/src/bin/lpuart_polling.rs b/examples/src/bin/lpuart_polling.rs index 525d42e2c..c8666e64a 100644 --- a/examples/src/bin/lpuart_polling.rs +++ b/examples/src/bin/lpuart_polling.rs @@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) { // Board-level init for UART2 clocks and pins. unsafe { - init_uart2_pins(hal::pac()); + init_uart2_pins(); } // Create UART configuration diff --git a/examples/src/bin/rtc_alarm.rs b/examples/src/bin/rtc_alarm.rs index a54b4a817..6f8a77101 100644 --- a/examples/src/bin/rtc_alarm.rs +++ b/examples/src/bin/rtc_alarm.rs @@ -34,7 +34,7 @@ async fn main(_spawner: Spawner) { // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX unsafe { - embassy_mcxa_examples::init_uart2_pins(hal::pac()); + embassy_mcxa_examples::init_uart2_pins(); } let mut uart = Lpuart::new_blocking( p.LPUART2, // Peripheral -- cgit