diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs index 303b85346..c39ef1913 100644 --- a/embassy-stm32/src/spi/mod.rs +++ b/embassy-stm32/src/spi/mod.rs @@ -97,8 +97,8 @@ pub struct Spi<'d, T: Instance, M: PeriMode> { sck: Option>, mosi: Option>, miso: Option>, - txdma: Option>, - rxdma: Option>, + tx_dma: Option>, + rx_dma: Option>, _phantom: PhantomData, current_word_size: word_impl::Config, } @@ -109,8 +109,8 @@ impl<'d, T: Instance, M: PeriMode> Spi<'d, T, M> { sck: Option>, mosi: Option>, miso: Option>, - txdma: Option>, - rxdma: Option>, + tx_dma: Option>, + rx_dma: Option>, config: Config, ) -> Self { into_ref!(peri); @@ -209,8 +209,8 @@ impl<'d, T: Instance, M: PeriMode> Spi<'d, T, M> { sck, mosi, miso, - txdma, - rxdma, + tx_dma, + rx_dma, current_word_size: ::CONFIG, _phantom: PhantomData, } @@ -479,8 +479,8 @@ impl<'d, T: Instance> Spi<'d, T, Async> { sck: impl Peripheral

> + 'd, mosi: impl Peripheral

> + 'd, miso: impl Peripheral

> + 'd, - txdma: impl Peripheral

> + 'd, - rxdma: impl Peripheral

> + 'd, + tx_dma: impl Peripheral

> + 'd, + rx_dma: impl Peripheral

> + 'd, config: Config, ) -> Self { Self::new_inner( @@ -488,8 +488,8 @@ impl<'d, T: Instance> Spi<'d, T, Async> { new_pin!(sck, AFType::OutputPushPull, Speed::VeryHigh, config.sck_pull_mode()), new_pin!(mosi, AFType::OutputPushPull, Speed::VeryHigh), new_pin!(miso, AFType::Input, Speed::VeryHigh), - new_dma!(txdma), - new_dma!(rxdma), + new_dma!(tx_dma), + new_dma!(rx_dma), config, ) } @@ -499,7 +499,7 @@ impl<'d, T: Instance> Spi<'d, T, Async> { peri: impl Peripheral

+ 'd, sck: impl Peripheral

> + 'd, miso: impl Peripheral

> + 'd, - rxdma: impl Peripheral

> + 'd, + rx_dma: impl Peripheral

> + 'd, config: Config, ) -> Self { Self::new_inner( @@ -508,7 +508,7 @@ impl<'d, T: Instance> Spi<'d, T, Async> { None, new_pin!(miso, AFType::Input, Speed::VeryHigh), None, - new_dma!(rxdma), + new_dma!(rx_dma), config, ) } @@ -518,7 +518,7 @@ impl<'d, T: Instance> Spi<'d, T, Async> { peri: impl Peripheral

+ 'd, sck: impl Peripheral

> + 'd, mosi: impl Peripheral

> + 'd, - txdma: impl Peripheral

> + 'd, + tx_dma: impl Peripheral

> + 'd, config: Config, ) -> Self { Self::new_inner( @@ -526,7 +526,7 @@ impl<'d, T: Instance> Spi<'d, T, Async> { new_pin!(sck, AFType::OutputPushPull, Speed::VeryHigh, config.sck_pull_mode()), new_pin!(mosi, AFType::OutputPushPull, Speed::VeryHigh), None, - new_dma!(txdma), + new_dma!(tx_dma), None, config, ) @@ -538,7 +538,7 @@ impl<'d, T: Instance> Spi<'d, T, Async> { pub fn new_txonly_nosck( peri: impl Peripheral

+ 'd, mosi: impl Peripheral

> + 'd, - txdma: impl Peripheral

> + 'd, + tx_dma: impl Peripheral

> + 'd, config: Config, ) -> Self { Self::new_inner( @@ -546,7 +546,7 @@ impl<'d, T: Instance> Spi<'d, T, Async> { None, new_pin!(mosi, AFType::OutputPushPull, Speed::VeryHigh), None, - new_dma!(txdma), + new_dma!(tx_dma), None, config, ) @@ -556,8 +556,8 @@ impl<'d, T: Instance> Spi<'d, T, Async> { /// Useful for on chip peripherals like SUBGHZ which are hardwired. pub fn new_subghz( peri: impl Peripheral

+ 'd, - txdma: impl Peripheral

> + 'd, - rxdma: impl Peripheral

> + 'd, + tx_dma: impl Peripheral

> + 'd, + rx_dma: impl Peripheral

> + 'd, ) -> Self { // see RM0453 rev 1 section 7.2.13 page 291 // The SUBGHZSPI_SCK frequency is obtained by PCLK3 divided by two. @@ -569,17 +569,17 @@ impl<'d, T: Instance> Spi<'d, T, Async> { config.bit_order = BitOrder::MsbFirst; config.frequency = freq; - Self::new_inner(peri, None, None, None, new_dma!(txdma), new_dma!(rxdma), config) + Self::new_inner(peri, None, None, None, new_dma!(tx_dma), new_dma!(rx_dma), config) } #[allow(dead_code)] pub(crate) fn new_internal( peri: impl Peripheral

+ 'd, - txdma: impl Peripheral

> + 'd, - rxdma: impl Peripheral

> + 'd, + tx_dma: impl Peripheral

> + 'd, + rx_dma: impl Peripheral

> + 'd, config: Config, ) -> Self { - Self::new_inner(peri, None, None, None, new_dma!(txdma), new_dma!(rxdma), config) + Self::new_inner(peri, None, None, None, new_dma!(tx_dma), new_dma!(rx_dma), config) } /// SPI write, using DMA. @@ -594,7 +594,7 @@ impl<'d, T: Instance> Spi<'d, T, Async> { }); let tx_dst = T::REGS.tx_ptr(); - let tx_f = unsafe { self.txdma.as_mut().unwrap().write(data, tx_dst, Default::default()) }; + let tx_f = unsafe { self.tx_dma.as_mut().unwrap().write(data, tx_dst, Default::default()) }; set_txdmaen(T::REGS, true); T::REGS.cr1().modify(|w| { @@ -632,12 +632,12 @@ impl<'d, T: Instance> Spi<'d, T, Async> { let clock_byte_count = data.len(); let rx_src = T::REGS.rx_ptr(); - let rx_f = unsafe { self.rxdma.as_mut().unwrap().read(rx_src, data, Default::default()) }; + let rx_f = unsafe { self.rx_dma.as_mut().unwrap().read(rx_src, data, Default::default()) }; let tx_dst = T::REGS.tx_ptr(); let clock_byte = 0x00u8; let tx_f = unsafe { - self.txdma + self.tx_dma .as_mut() .unwrap() .write_repeated(&clock_byte, clock_byte_count, tx_dst, Default::default()) @@ -679,11 +679,11 @@ impl<'d, T: Instance> Spi<'d, T, Async> { set_rxdmaen(T::REGS, true); let rx_src = T::REGS.rx_ptr(); - let rx_f = unsafe { self.rxdma.as_mut().unwrap().read_raw(rx_src, read, Default::default()) }; + let rx_f = unsafe { self.rx_dma.as_mut().unwrap().read_raw(rx_src, read, Default::default()) }; let tx_dst = T::REGS.tx_ptr(); let tx_f = unsafe { - self.txdma + self.tx_dma .as_mut() .unwrap() .write_raw(write, tx_dst, Default::default())