Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/async_dmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async fn main(_s: embassy_executor::Spawner) {
);

// Initialize DMA Controller
let dmac = DmaController::init(peripherals.dmac, &mut peripherals.pm);
let dmac = DmaController::new(peripherals.dmac, &mut peripherals.pm);

// Turn dmac into an async controller
let mut dmac = dmac.into_future(crate::Irqs);
Expand Down
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/async_i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn main(_s: embassy_executor::Spawner) {
let i2c_sercom = bsp::periph_alias!(peripherals.i2c_sercom);

// Initialize DMA Controller
let dmac = DmaController::init(peripherals.dmac, &mut peripherals.pm);
let dmac = DmaController::new(peripherals.dmac, &mut peripherals.pm);

// Turn dmac into an async controller
let mut dmac = dmac.into_future(Irqs);
Expand Down
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/async_spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn main(_s: embassy_executor::Spawner) {
let spi_sercom = bsp::periph_alias!(peripherals.spi_sercom);

// Initialize DMA Controller
let dmac = DmaController::init(peripherals.dmac, &mut peripherals.pm);
let dmac = DmaController::new(peripherals.dmac, &mut peripherals.pm);

// Turn dmac into an async controller
let mut dmac = dmac.into_future(Irqs);
Expand Down
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/async_uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async fn main(spawner: embassy_executor::Spawner) {
let uart_sercom = periph_alias!(peripherals.uart_sercom);

// Initialize DMA Controller
let dmac = DmaController::init(peripherals.dmac, &mut peripherals.pm);
let dmac = DmaController::new(peripherals.dmac, &mut peripherals.pm);
// Turn dmac into an async controller
let mut dmac = dmac.into_future(Irqs);
// Get individual handles to DMA channels
Expand Down
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/dmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn main() -> ! {
cortex_m::singleton!(: [u8; LENGTH] = [0x00; LENGTH]).unwrap();

// Initialize DMA Controller
let mut dmac = DmaController::init(dmac, &mut pm);
let mut dmac = DmaController::new(dmac, &mut pm);
// Get individual handles to DMA channels
let mut channels = dmac.split();

Expand Down
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn main() -> ! {
let (sda, scl) = (pins.sda, pins.scl);

// Setup DMA channels for later use
let mut dmac = DmaController::init(dmac, &mut pm);
let mut dmac = DmaController::new(dmac, &mut pm);
let channels = dmac.split();
let chan0 = channels.0.init(PriorityLevel::Lvl0);

Expand Down
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn main() -> ! {
let (miso, mosi, sclk) = (pins.miso, pins.mosi, pins.sclk);

// Setup DMA channels for later use
let mut dmac = DmaController::init(dmac, &mut pm);
let mut dmac = DmaController::new(dmac, &mut pm);
let channels = dmac.split();
let chan0 = channels.0.init(PriorityLevel::Lvl0);
let chan1 = channels.1.init(PriorityLevel::Lvl0);
Expand Down
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/uart_dma_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() -> ! {
let pins = bsp::Pins::new(peripherals.port);

// Setup DMA channels for later use
let mut dmac = DmaController::init(dmac, &mut pm);
let mut dmac = DmaController::new(dmac, &mut pm);
let channels = dmac.split();

let chan0 = channels.0.init(PriorityLevel::Lvl0);
Expand Down
2 changes: 1 addition & 1 deletion boards/feather_m0/examples/uart_dma_nonblocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn main() -> ! {
let pins = bsp::Pins::new(peripherals.port);

// Setup DMA channels for later use
let mut dmac = DmaController::init(dmac, &mut pm);
let mut dmac = DmaController::new(dmac, &mut pm);
let channels = dmac.split();

let chan0 = channels.0.init(PriorityLevel::Lvl0);
Expand Down
21 changes: 7 additions & 14 deletions boards/feather_m4/examples/dmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,21 @@ use cortex_m::asm;
use feather_m4 as bsp;
use panic_halt as _;

use hal::{
clock::GenericClockController,
pac::{CorePeripherals, Peripherals},
};

use hal::dmac::{DmaController, PriorityLevel, Transfer, TriggerAction, TriggerSource};
use hal::pac::Peripherals;

#[bsp::entry]
fn main() -> ! {
let mut peripherals = Peripherals::take().unwrap();
let core = CorePeripherals::take().unwrap();
let _clocks = GenericClockController::with_external_32kosc(
let (mut _buses, clocks, _tokens) = hal::clock::v2::clock_system_at_reset(
peripherals.oscctrl,
peripherals.osc32kctrl,
peripherals.gclk,
&mut peripherals.mclk,
&mut peripherals.osc32kctrl,
&mut peripherals.oscctrl,
peripherals.mclk,
&mut peripherals.nvmctrl,
);

let mut pm = peripherals.pm;
let dmac = peripherals.dmac;
let _nvic = core.NVIC;

// Initialize buffers
const LENGTH: usize = 50;
Expand All @@ -40,7 +33,7 @@ fn main() -> ! {
cortex_m::singleton!(: [u8; LENGTH] = [0x00; LENGTH]).unwrap();

// Initialize DMA Controller
let mut dmac = DmaController::init(dmac, &mut pm);
let mut dmac = DmaController::new(dmac, clocks.ahbs.dmac);
// Get individual handles to DMA channels
let mut channels = dmac.split();

Expand Down Expand Up @@ -95,7 +88,7 @@ fn main() -> ! {
// Move split channels back into the Channels struct
channels.0 = chan0.into();
// Free the DmaController and return the PAC DMAC struct
let _dmac = dmac.free(channels, &mut pm);
let (_dmac, _ahb_clk) = dmac.free(channels);

loop {
asm::nop();
Expand Down
2 changes: 1 addition & 1 deletion boards/metro_m0/examples/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn main() -> ! {
let (sda, scl) = (pins.sda, pins.scl);

// Setup DMA channels for later use
let mut dmac = DmaController::init(dmac, &mut pm);
let mut dmac = DmaController::new(dmac, &mut pm);
let channels = dmac.split();
let chan0 = channels.0.init(PriorityLevel::Lvl0);

Expand Down
2 changes: 1 addition & 1 deletion boards/metro_m0/examples/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn main() -> ! {
let (miso, mosi, sclk) = (pins.miso, pins.mosi, pins.sck);

// Setup DMA channels for later use
let mut dmac = DmaController::init(dmac, &mut pm);
let mut dmac = DmaController::new(dmac, &mut pm);
let channels = dmac.split();
let chan0 = channels.0.init(PriorityLevel::Lvl0);
let chan1 = channels.1.init(PriorityLevel::Lvl0);
Expand Down
17 changes: 6 additions & 11 deletions boards/metro_m4/examples/async_dmac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ use panic_probe as _;

use bsp::hal;
use bsp::pac;
use hal::{
clock::GenericClockController,
dmac::{DmaController, PriorityLevel, TriggerAction, TriggerSource},
};
use hal::dmac::{DmaController, PriorityLevel, TriggerAction, TriggerSource};
use metro_m4 as bsp;

atsamd_hal::bind_multiple_interrupts!(struct Irqs {
Expand All @@ -22,18 +19,16 @@ atsamd_hal::bind_multiple_interrupts!(struct Irqs {
#[embassy_executor::main]
async fn main(_s: embassy_executor::Spawner) {
let mut peripherals = pac::Peripherals::take().unwrap();
let _core = pac::CorePeripherals::take().unwrap();

let _clocks = GenericClockController::with_external_32kosc(
let (mut _buses, clocks, _tokens) = hal::clock::v2::clock_system_at_reset(
peripherals.oscctrl,
peripherals.osc32kctrl,
peripherals.gclk,
&mut peripherals.mclk,
&mut peripherals.osc32kctrl,
&mut peripherals.oscctrl,
peripherals.mclk,
&mut peripherals.nvmctrl,
);

// Initialize DMA Controller
let dmac = DmaController::init(peripherals.dmac, &mut peripherals.pm);
let dmac = DmaController::new(peripherals.dmac, clocks.ahbs.dmac);

// Turn dmac into an async controller
let mut dmac = dmac.into_future(crate::Irqs);
Expand Down
2 changes: 1 addition & 1 deletion boards/samd11_bare/examples/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn main() -> ! {
let (sda, scl) = (pins.d4, pins.d5);

// Setup DMA channels for later use
let mut dmac = DmaController::init(dmac, &mut pm);
let mut dmac = DmaController::new(dmac, &mut pm);
let channels = dmac.split();
let chan0 = channels.0.init(PriorityLevel::Lvl0);

Expand Down
Loading
Loading