diff --git a/embassy-stm32/src/dma/gpdma.rs b/embassy-stm32/src/dma/gpdma.rs index a877bb8d4..e57bf04ed 100644 --- a/embassy-stm32/src/dma/gpdma.rs +++ b/embassy-stm32/src/dma/gpdma.rs @@ -143,27 +143,28 @@ impl<'a> Transfer<'a> { buf.len(), true, W::size(), + W::size(), options, ) } /// Create a new write DMA transfer (memory to peripheral). - pub unsafe fn new_write( + pub unsafe fn new_write( channel: impl Peripheral

+ 'a, request: Request, - buf: &'a [W], - peri_addr: *mut W, + buf: &'a [MW], + peri_addr: *mut PW, options: TransferOptions, ) -> Self { Self::new_write_raw(channel, request, buf, peri_addr, options) } /// Create a new write DMA transfer (memory to peripheral), using raw pointers. - pub unsafe fn new_write_raw( + pub unsafe fn new_write_raw( channel: impl Peripheral

+ 'a, request: Request, - buf: *const [W], - peri_addr: *mut W, + buf: *const [MW], + peri_addr: *mut PW, options: TransferOptions, ) -> Self { into_ref!(channel); @@ -173,21 +174,22 @@ impl<'a> Transfer<'a> { request, Dir::MemoryToPeripheral, peri_addr as *const u32, - buf as *const W as *mut u32, + buf as *const MW as *mut u32, buf.len(), true, - W::size(), + MW::size(), + PW::size(), options, ) } /// Create a new write DMA transfer (memory to peripheral), writing the same value repeatedly. - pub unsafe fn new_write_repeated( + pub unsafe fn new_write_repeated( channel: impl Peripheral

+ 'a, request: Request, - repeated: &'a W, + repeated: &'a MW, count: usize, - peri_addr: *mut W, + peri_addr: *mut PW, options: TransferOptions, ) -> Self { into_ref!(channel); @@ -197,10 +199,11 @@ impl<'a> Transfer<'a> { request, Dir::MemoryToPeripheral, peri_addr as *const u32, - repeated as *const W as *mut u32, + repeated as *const MW as *mut u32, count, false, - W::size(), + MW::size(), + PW::size(), options, ) } @@ -214,6 +217,7 @@ impl<'a> Transfer<'a> { mem_len: usize, incr_mem: bool, data_size: WordSize, + dst_size: WordSize, _options: TransferOptions, ) -> Self { // BNDT is specified as bytes, not as number of transfers. @@ -234,7 +238,7 @@ impl<'a> Transfer<'a> { ch.llr().write(|_| {}); // no linked list ch.tr1().write(|w| { w.set_sdw(data_size.into()); - w.set_ddw(data_size.into()); + w.set_ddw(dst_size.into()); w.set_sinc(dir == Dir::MemoryToPeripheral && incr_mem); w.set_dinc(dir == Dir::PeripheralToMemory && incr_mem); }); diff --git a/embassy-stm32/src/timer/simple_pwm.rs b/embassy-stm32/src/timer/simple_pwm.rs index 757536c2d..5b3cf8fea 100644 --- a/embassy-stm32/src/timer/simple_pwm.rs +++ b/embassy-stm32/src/timer/simple_pwm.rs @@ -416,8 +416,10 @@ macro_rules! impl_waveform_chx { } #[cfg(not(any(stm32l0)))] TimerBits::Bits32 => { + #[cfg(not(any(bdma, gpdma)))] + panic!("unsupported timer bits"); + #[cfg(any(bdma, gpdma))] - panic("unsupported timer bits"); Transfer::new_write( &mut dma, req,