diff options
| author | James Munns <[email protected]> | 2025-12-08 17:58:00 +0100 |
|---|---|---|
| committer | James Munns <[email protected]> | 2025-12-08 17:58:00 +0100 |
| commit | 6680ef22fa4b46adb4cda46d6cdbc9dac39dc78c (patch) | |
| tree | 367bfba7c960798db8f5813629e5bb206158e80c /examples/mcxa/src/bin/dma_scatter_gather_builder.rs | |
| parent | 5d8f3a3d18eda339e258193295cf332d7e01882e (diff) | |
Clean up examples, move interrupts to be more fully managed
Diffstat (limited to 'examples/mcxa/src/bin/dma_scatter_gather_builder.rs')
| -rw-r--r-- | examples/mcxa/src/bin/dma_scatter_gather_builder.rs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/examples/mcxa/src/bin/dma_scatter_gather_builder.rs b/examples/mcxa/src/bin/dma_scatter_gather_builder.rs index 29c54ca42..d0f9ae9c4 100644 --- a/examples/mcxa/src/bin/dma_scatter_gather_builder.rs +++ b/examples/mcxa/src/bin/dma_scatter_gather_builder.rs | |||
| @@ -20,18 +20,13 @@ | |||
| 20 | #![no_std] | 20 | #![no_std] |
| 21 | #![no_main] | 21 | #![no_main] |
| 22 | 22 | ||
| 23 | use core::fmt::Write as _; | ||
| 24 | |||
| 23 | use embassy_executor::Spawner; | 25 | use embassy_executor::Spawner; |
| 24 | use embassy_mcxa::clocks::config::Div8; | 26 | use embassy_mcxa::clocks::config::Div8; |
| 25 | use embassy_mcxa::dma::{DmaCh0InterruptHandler, DmaChannel, ScatterGatherBuilder}; | 27 | use embassy_mcxa::dma::{DmaChannel, ScatterGatherBuilder}; |
| 26 | use embassy_mcxa::lpuart::{Blocking, Config, Lpuart, LpuartTx}; | 28 | use embassy_mcxa::lpuart::{Blocking, Config, Lpuart, LpuartTx}; |
| 27 | use embassy_mcxa::{bind_interrupts, pac}; | ||
| 28 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; | 29 | use {defmt_rtt as _, embassy_mcxa as hal, panic_probe as _}; |
| 29 | use core::fmt::Write as _; | ||
| 30 | |||
| 31 | // Bind DMA channel 0 interrupt | ||
| 32 | bind_interrupts!(struct Irqs { | ||
| 33 | DMA_CH0 => DmaCh0InterruptHandler; | ||
| 34 | }); | ||
| 35 | 30 | ||
| 36 | // Source buffers (multiple segments) | 31 | // Source buffers (multiple segments) |
| 37 | static mut SRC1: [u32; 4] = [0x11111111, 0x22222222, 0x33333333, 0x44444444]; | 32 | static mut SRC1: [u32; 4] = [0x11111111, 0x22222222, 0x33333333, 0x44444444]; |
| @@ -62,11 +57,6 @@ async fn main(_spawner: Spawner) { | |||
| 62 | 57 | ||
| 63 | defmt::info!("DMA Scatter-Gather Builder example starting..."); | 58 | defmt::info!("DMA Scatter-Gather Builder example starting..."); |
| 64 | 59 | ||
| 65 | // Enable DMA interrupt (DMA clock/reset/init is handled automatically by HAL) | ||
| 66 | unsafe { | ||
| 67 | cortex_m::peripheral::NVIC::unmask(pac::Interrupt::DMA_CH0); | ||
| 68 | } | ||
| 69 | |||
| 70 | // Create UART for debug output | 60 | // Create UART for debug output |
| 71 | let config = Config { | 61 | let config = Config { |
| 72 | baudrate_bps: 115_200, | 62 | baudrate_bps: 115_200, |
