diff options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/src/bin/adc_interrupt.rs | 4 | ||||
| -rw-r--r-- | examples/src/bin/adc_polling.rs | 11 | ||||
| -rw-r--r-- | examples/src/bin/hello.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/lpuart_buffered.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/lpuart_polling.rs | 2 | ||||
| -rw-r--r-- | examples/src/bin/rtc_alarm.rs | 2 | ||||
| -rw-r--r-- | examples/src/lib.rs | 4 |
7 files changed, 10 insertions, 17 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; | |||
| 22 | async fn main(_spawner: Spawner) { | 22 | async 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 |
diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 66b93450a..f5f6124c0 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs | |||
| @@ -9,7 +9,7 @@ use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; | |||
| 9 | 9 | ||
| 10 | /// Initialize clocks and pin muxing for UART2 debug console. | 10 | /// Initialize clocks and pin muxing for UART2 debug console. |
| 11 | /// Safe to call multiple times; writes are idempotent for our use. | 11 | /// Safe to call multiple times; writes are idempotent for our use. |
| 12 | pub unsafe fn init_uart2_pins(_p: &hal::pac::Peripherals) { | 12 | pub unsafe fn init_uart2_pins() { |
| 13 | // NOTE: Lpuart has been updated to properly enable + reset its own clocks. | 13 | // NOTE: Lpuart has been updated to properly enable + reset its own clocks. |
| 14 | // GPIO has not. | 14 | // GPIO has not. |
| 15 | _ = clocks::enable_and_reset::<hal::peripherals::PORT2>(&clocks::periph_helpers::NoConfig); | 15 | _ = clocks::enable_and_reset::<hal::peripherals::PORT2>(&clocks::periph_helpers::NoConfig); |
| @@ -17,7 +17,7 @@ pub unsafe fn init_uart2_pins(_p: &hal::pac::Peripherals) { | |||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | /// Initialize clocks and pin muxing for ADC. | 19 | /// Initialize clocks and pin muxing for ADC. |
| 20 | pub unsafe fn init_adc_pins(_p: &hal::pac::Peripherals) { | 20 | pub unsafe fn init_adc_pins() { |
| 21 | // NOTE: Lpuart has been updated to properly enable + reset its own clocks. | 21 | // NOTE: Lpuart has been updated to properly enable + reset its own clocks. |
| 22 | // GPIO has not. | 22 | // GPIO has not. |
| 23 | _ = clocks::enable_and_reset::<hal::peripherals::PORT1>(&clocks::periph_helpers::NoConfig); | 23 | _ = clocks::enable_and_reset::<hal::peripherals::PORT1>(&clocks::periph_helpers::NoConfig); |
