From 81f7569a525a5814f48f2b7df0d8c4b86735c242 Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Tue, 19 Dec 2023 17:12:34 +0800 Subject: [PATCH] match up with metapac change --- embassy-stm32/src/dma/bdma.rs | 20 +++++++------------- embassy-stm32/src/dma/dma.rs | 27 +++++++++++---------------- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/embassy-stm32/src/dma/bdma.rs b/embassy-stm32/src/dma/bdma.rs index 5102330c..2f37b1ed 100644 --- a/embassy-stm32/src/dma/bdma.rs +++ b/embassy-stm32/src/dma/bdma.rs @@ -303,20 +303,14 @@ impl<'a, C: Channel> Transfer<'a, C> { ch.cr().write(|w| { w.set_psize(data_size.into()); w.set_msize(data_size.into()); - if incr_mem { - w.set_minc(vals::Inc::ENABLED); - } else { - w.set_minc(vals::Inc::DISABLED); - } + w.set_minc(incr_mem); w.set_dir(dir.into()); w.set_teie(true); w.set_tcie(options.complete_transfer_ir); w.set_htie(options.half_transfer_ir); + w.set_circ(options.circular); if options.circular { - w.set_circ(vals::Circ::ENABLED); debug!("Setting circular mode"); - } else { - w.set_circ(vals::Circ::DISABLED); } w.set_pl(vals::Pl::VERYHIGH); w.set_en(true); @@ -352,7 +346,7 @@ impl<'a, C: Channel> Transfer<'a, C> { pub fn is_running(&mut self) -> bool { let ch = self.channel.regs().ch(self.channel.num()); let en = ch.cr().read().en(); - let circular = ch.cr().read().circ() == vals::Circ::ENABLED; + let circular = ch.cr().read().circ(); let tcif = STATE.complete_count[self.channel.index()].load(Ordering::Acquire) != 0; en && (circular || !tcif) } @@ -467,12 +461,12 @@ impl<'a, C: Channel, W: Word> ReadableRingBuffer<'a, C, W> { let mut w = regs::Cr(0); w.set_psize(data_size.into()); w.set_msize(data_size.into()); - w.set_minc(vals::Inc::ENABLED); + w.set_minc(true); w.set_dir(dir.into()); w.set_teie(true); w.set_htie(true); w.set_tcie(true); - w.set_circ(vals::Circ::ENABLED); + w.set_circ(true); w.set_pl(vals::Pl::VERYHIGH); w.set_en(true); @@ -625,12 +619,12 @@ impl<'a, C: Channel, W: Word> WritableRingBuffer<'a, C, W> { let mut w = regs::Cr(0); w.set_psize(data_size.into()); w.set_msize(data_size.into()); - w.set_minc(vals::Inc::ENABLED); + w.set_minc(true); w.set_dir(dir.into()); w.set_teie(true); w.set_htie(true); w.set_tcie(true); - w.set_circ(vals::Circ::ENABLED); + w.set_circ(true); w.set_pl(vals::Pl::VERYHIGH); w.set_en(true); diff --git a/embassy-stm32/src/dma/dma.rs b/embassy-stm32/src/dma/dma.rs index 64e492c1..9b47ca5c 100644 --- a/embassy-stm32/src/dma/dma.rs +++ b/embassy-stm32/src/dma/dma.rs @@ -382,18 +382,13 @@ impl<'a, C: Channel> Transfer<'a, C> { w.set_msize(data_size.into()); w.set_psize(data_size.into()); w.set_pl(vals::Pl::VERYHIGH); - w.set_minc(match incr_mem { - true => vals::Inc::INCREMENTED, - false => vals::Inc::FIXED, - }); - w.set_pinc(vals::Inc::FIXED); + w.set_minc(incr_mem); + w.set_pinc(false); w.set_teie(true); w.set_tcie(options.complete_transfer_ir); + w.set_circ(options.circular); if options.circular { - w.set_circ(vals::Circ::ENABLED); debug!("Setting circular mode"); - } else { - w.set_circ(vals::Circ::DISABLED); } #[cfg(dma_v1)] w.set_trbuff(true); @@ -545,8 +540,8 @@ impl<'a, C: Channel, W: Word> DoubleBuffered<'a, C, W> { w.set_msize(data_size.into()); w.set_psize(data_size.into()); w.set_pl(vals::Pl::VERYHIGH); - w.set_minc(vals::Inc::INCREMENTED); - w.set_pinc(vals::Inc::FIXED); + w.set_minc(true); + w.set_pinc(false); w.set_teie(true); w.set_tcie(true); #[cfg(dma_v1)] @@ -703,12 +698,12 @@ impl<'a, C: Channel, W: Word> ReadableRingBuffer<'a, C, W> { w.set_msize(data_size.into()); w.set_psize(data_size.into()); w.set_pl(vals::Pl::VERYHIGH); - w.set_minc(vals::Inc::INCREMENTED); - w.set_pinc(vals::Inc::FIXED); + w.set_minc(true); + w.set_pinc(false); w.set_teie(true); w.set_htie(options.half_transfer_ir); w.set_tcie(true); - w.set_circ(vals::Circ::ENABLED); + w.set_circ(true); #[cfg(dma_v1)] w.set_trbuff(true); #[cfg(dma_v2)] @@ -878,12 +873,12 @@ impl<'a, C: Channel, W: Word> WritableRingBuffer<'a, C, W> { w.set_msize(data_size.into()); w.set_psize(data_size.into()); w.set_pl(vals::Pl::VERYHIGH); - w.set_minc(vals::Inc::INCREMENTED); - w.set_pinc(vals::Inc::FIXED); + w.set_minc(true); + w.set_pinc(false); w.set_teie(true); w.set_htie(options.half_transfer_ir); w.set_tcie(true); - w.set_circ(vals::Circ::ENABLED); + w.set_circ(true); #[cfg(dma_v1)] w.set_trbuff(true); #[cfg(dma_v2)]