aboutsummaryrefslogtreecommitdiff
path: root/examples/src/bin
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 /examples/src/bin
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 'examples/src/bin')
-rw-r--r--examples/src/bin/adc_interrupt.rs4
-rw-r--r--examples/src/bin/adc_polling.rs11
-rw-r--r--examples/src/bin/hello.rs2
-rw-r--r--examples/src/bin/lpuart_buffered.rs2
-rw-r--r--examples/src/bin/lpuart_polling.rs2
-rw-r--r--examples/src/bin/rtc_alarm.rs2
6 files changed, 8 insertions, 15 deletions
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) {
36 36
37 // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX 37 // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX
38 unsafe { 38 unsafe {
39 embassy_mcxa_examples::init_uart2_pins(hal::pac()); 39 embassy_mcxa_examples::init_uart2_pins();
40 } 40 }
41 let mut uart = Lpuart::new_blocking( 41 let mut uart = Lpuart::new_blocking(
42 p.LPUART2, // Peripheral 42 p.LPUART2, // Peripheral
@@ -48,7 +48,7 @@ async fn main(_spawner: Spawner) {
48 uart.write_str_blocking("\r\n=== ADC interrupt Example ===\r\n"); 48 uart.write_str_blocking("\r\n=== ADC interrupt Example ===\r\n");
49 49
50 unsafe { 50 unsafe {
51 init_adc_pins(hal::pac()); 51 init_adc_pins();
52 } 52 }
53 53
54 let adc_config = LpadcConfig { 54 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;
22async fn main(_spawner: Spawner) { 22async fn main(_spawner: Spawner) {
23 let p = hal::init(hal::config::Config::default()); 23 let p = hal::init(hal::config::Config::default());
24 24
25 unsafe {
26 init_uart2_pins(hal::pac());
27 }
28
29 // Create UART configuration 25 // Create UART configuration
30 let config = Config { 26 let config = Config {
31 baudrate_bps: 115_200, 27 baudrate_bps: 115_200,
@@ -36,7 +32,8 @@ async fn main(_spawner: Spawner) {
36 32
37 // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX 33 // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX
38 unsafe { 34 unsafe {
39 init_uart2_pins(hal::pac()); 35 init_uart2_pins();
36 init_adc_pins();
40 } 37 }
41 let mut uart = Lpuart::new_blocking( 38 let mut uart = Lpuart::new_blocking(
42 p.LPUART2, // Peripheral 39 p.LPUART2, // Peripheral
@@ -48,10 +45,6 @@ async fn main(_spawner: Spawner) {
48 45
49 uart.write_str_blocking("\r\n=== ADC polling Example ===\r\n"); 46 uart.write_str_blocking("\r\n=== ADC polling Example ===\r\n");
50 47
51 unsafe {
52 init_adc_pins(hal::pac());
53 }
54
55 let adc_config = LpadcConfig { 48 let adc_config = LpadcConfig {
56 enable_in_doze_mode: true, 49 enable_in_doze_mode: true,
57 conversion_average_mode: CalAvgs::Average128, 50 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) {
28 28
29 // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX 29 // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX
30 unsafe { 30 unsafe {
31 embassy_mcxa_examples::init_uart2_pins(hal::pac()); 31 embassy_mcxa_examples::init_uart2_pins();
32 } 32 }
33 let mut uart = Lpuart::new_blocking( 33 let mut uart = Lpuart::new_blocking(
34 p.LPUART2, // Peripheral 34 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) {
32 hal::interrupt::LPUART2.configure_for_uart(hal::interrupt::Priority::P3); 32 hal::interrupt::LPUART2.configure_for_uart(hal::interrupt::Priority::P3);
33 33
34 unsafe { 34 unsafe {
35 init_uart2_pins(hal::pac()); 35 init_uart2_pins();
36 } 36 }
37 37
38 // UART configuration (enable both TX and RX) 38 // 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) {
15 15
16 // Board-level init for UART2 clocks and pins. 16 // Board-level init for UART2 clocks and pins.
17 unsafe { 17 unsafe {
18 init_uart2_pins(hal::pac()); 18 init_uart2_pins();
19 } 19 }
20 20
21 // Create UART configuration 21 // 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) {
34 34
35 // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX 35 // Create UART instance using LPUART2 with P2_2 as TX and P2_3 as RX
36 unsafe { 36 unsafe {
37 embassy_mcxa_examples::init_uart2_pins(hal::pac()); 37 embassy_mcxa_examples::init_uart2_pins();
38 } 38 }
39 let mut uart = Lpuart::new_blocking( 39 let mut uart = Lpuart::new_blocking(
40 p.LPUART2, // Peripheral 40 p.LPUART2, // Peripheral