Remove redundant WithDmaSpi traits (#1975)
Co-authored-by: Dominic Fischer <git@dominicfischer.me>
This commit is contained in:
parent
7dfaca49ba
commit
dc6c53ee47
@ -47,6 +47,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- This package no longer re-exports the `esp_hal_procmacros::main` macro (#1828)
|
- This package no longer re-exports the `esp_hal_procmacros::main` macro (#1828)
|
||||||
- The `AesFlavour` trait no longer has the `ENCRYPT_MODE`/`DECRYPT_MODE` associated constants (#1849)
|
- The `AesFlavour` trait no longer has the `ENCRYPT_MODE`/`DECRYPT_MODE` associated constants (#1849)
|
||||||
- Removed `FlashSafeDma` (#1856)
|
- Removed `FlashSafeDma` (#1856)
|
||||||
|
- Remove redundant WithDmaSpi traits (#1975)
|
||||||
|
|
||||||
## [0.19.0] - 2024-07-15
|
## [0.19.0] - 2024-07-15
|
||||||
|
|
||||||
|
|||||||
@ -90,10 +90,7 @@ use crate::{
|
|||||||
|
|
||||||
/// Prelude for the SPI (Master) driver
|
/// Prelude for the SPI (Master) driver
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
#[cfg(spi3)]
|
|
||||||
pub use super::dma::WithDmaSpi3 as _esp_hal_spi_master_dma_WithDmaSpi3;
|
|
||||||
pub use super::{
|
pub use super::{
|
||||||
dma::WithDmaSpi2 as _esp_hal_spi_master_dma_WithDmaSpi2,
|
|
||||||
Instance as _esp_hal_spi_master_Instance,
|
Instance as _esp_hal_spi_master_Instance,
|
||||||
InstanceDma as _esp_hal_spi_master_InstanceDma,
|
InstanceDma as _esp_hal_spi_master_InstanceDma,
|
||||||
};
|
};
|
||||||
@ -867,44 +864,19 @@ pub mod dma {
|
|||||||
Mode,
|
Mode,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait WithDmaSpi2<'d, C, M, DmaMode>
|
impl<'d, M> Spi<'d, crate::peripherals::SPI2, M>
|
||||||
where
|
where
|
||||||
C: DmaChannel,
|
|
||||||
C::P: SpiPeripheral,
|
|
||||||
M: DuplexMode,
|
M: DuplexMode,
|
||||||
DmaMode: Mode,
|
|
||||||
{
|
{
|
||||||
fn with_dma(
|
pub fn with_dma<C, DmaMode>(
|
||||||
self,
|
|
||||||
channel: Channel<'d, C, DmaMode>,
|
|
||||||
) -> SpiDma<'d, crate::peripherals::SPI2, C, M, DmaMode>;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(spi3)]
|
|
||||||
pub trait WithDmaSpi3<'d, C, M, DmaMode>
|
|
||||||
where
|
|
||||||
C: DmaChannel,
|
|
||||||
C::P: SpiPeripheral,
|
|
||||||
M: DuplexMode,
|
|
||||||
DmaMode: Mode,
|
|
||||||
{
|
|
||||||
fn with_dma(
|
|
||||||
self,
|
|
||||||
channel: Channel<'d, C, DmaMode>,
|
|
||||||
) -> SpiDma<'d, crate::peripherals::SPI3, C, M, DmaMode>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'d, C, M, DmaMode> WithDmaSpi2<'d, C, M, DmaMode> for Spi<'d, crate::peripherals::SPI2, M>
|
|
||||||
where
|
|
||||||
C: DmaChannel,
|
|
||||||
C::P: SpiPeripheral + Spi2Peripheral,
|
|
||||||
M: DuplexMode,
|
|
||||||
DmaMode: Mode,
|
|
||||||
{
|
|
||||||
fn with_dma(
|
|
||||||
self,
|
self,
|
||||||
mut channel: Channel<'d, C, DmaMode>,
|
mut channel: Channel<'d, C, DmaMode>,
|
||||||
) -> SpiDma<'d, crate::peripherals::SPI2, C, M, DmaMode> {
|
) -> SpiDma<'d, crate::peripherals::SPI2, C, M, DmaMode>
|
||||||
|
where
|
||||||
|
C: DmaChannel,
|
||||||
|
C::P: SpiPeripheral + Spi2Peripheral,
|
||||||
|
DmaMode: Mode,
|
||||||
|
{
|
||||||
channel.tx.init_channel(); // no need to call this for both, TX and RX
|
channel.tx.init_channel(); // no need to call this for both, TX and RX
|
||||||
|
|
||||||
SpiDma {
|
SpiDma {
|
||||||
@ -916,17 +888,19 @@ pub mod dma {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(spi3)]
|
#[cfg(spi3)]
|
||||||
impl<'d, C, M, DmaMode> WithDmaSpi3<'d, C, M, DmaMode> for Spi<'d, crate::peripherals::SPI3, M>
|
impl<'d, M> Spi<'d, crate::peripherals::SPI3, M>
|
||||||
where
|
where
|
||||||
C: DmaChannel,
|
|
||||||
C::P: SpiPeripheral + Spi3Peripheral,
|
|
||||||
M: DuplexMode,
|
M: DuplexMode,
|
||||||
DmaMode: Mode,
|
|
||||||
{
|
{
|
||||||
fn with_dma(
|
pub fn with_dma<C, DmaMode>(
|
||||||
self,
|
self,
|
||||||
mut channel: Channel<'d, C, DmaMode>,
|
mut channel: Channel<'d, C, DmaMode>,
|
||||||
) -> SpiDma<'d, crate::peripherals::SPI3, C, M, DmaMode> {
|
) -> SpiDma<'d, crate::peripherals::SPI3, C, M, DmaMode>
|
||||||
|
where
|
||||||
|
C: DmaChannel,
|
||||||
|
C::P: SpiPeripheral + Spi3Peripheral,
|
||||||
|
DmaMode: Mode,
|
||||||
|
{
|
||||||
channel.tx.init_channel(); // no need to call this for both, TX and RX
|
channel.tx.init_channel(); // no need to call this for both, TX and RX
|
||||||
|
|
||||||
SpiDma {
|
SpiDma {
|
||||||
|
|||||||
@ -28,10 +28,7 @@ use esp_hal::{
|
|||||||
gpio::Io,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{master::Spi, SpiMode},
|
||||||
master::{prelude::*, Spi},
|
|
||||||
SpiMode,
|
|
||||||
},
|
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
timer::timg::TimerGroup,
|
timer::timg::TimerGroup,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -37,7 +37,7 @@ use esp_hal::{
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{
|
||||||
master::{prelude::*, Address, Command, Spi},
|
master::{Address, Command, Spi},
|
||||||
SpiDataMode,
|
SpiDataMode,
|
||||||
SpiMode,
|
SpiMode,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -27,10 +27,7 @@ use esp_hal::{
|
|||||||
gpio::Io,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{master::Spi, SpiMode},
|
||||||
master::{prelude::*, Spi},
|
|
||||||
SpiMode,
|
|
||||||
},
|
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
};
|
};
|
||||||
use esp_println::println;
|
use esp_println::println;
|
||||||
|
|||||||
@ -28,10 +28,7 @@ use esp_hal::{
|
|||||||
gpio::Io,
|
gpio::Io,
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{master::Spi, SpiMode},
|
||||||
master::{prelude::*, Spi},
|
|
||||||
SpiMode,
|
|
||||||
},
|
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
};
|
};
|
||||||
use hil_test as _;
|
use hil_test as _;
|
||||||
|
|||||||
@ -31,10 +31,7 @@ use esp_hal::{
|
|||||||
},
|
},
|
||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
spi::{
|
spi::{master::Spi, SpiMode},
|
||||||
master::{prelude::*, Spi},
|
|
||||||
SpiMode,
|
|
||||||
},
|
|
||||||
system::SystemControl,
|
system::SystemControl,
|
||||||
};
|
};
|
||||||
use hil_test as _;
|
use hil_test as _;
|
||||||
|
|||||||
@ -26,7 +26,7 @@ mod tests {
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::_fugit_RateExtU32,
|
prelude::_fugit_RateExtU32,
|
||||||
spi::{
|
spi::{
|
||||||
master::{prelude::*, Address, Command, Spi},
|
master::{Address, Command, Spi},
|
||||||
SpiDataMode,
|
SpiDataMode,
|
||||||
SpiMode,
|
SpiMode,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -30,7 +30,7 @@ mod tests {
|
|||||||
peripherals::Peripherals,
|
peripherals::Peripherals,
|
||||||
prelude::_fugit_RateExtU32,
|
prelude::_fugit_RateExtU32,
|
||||||
spi::{
|
spi::{
|
||||||
master::{prelude::*, Address, Command, Spi},
|
master::{Address, Command, Spi},
|
||||||
SpiDataMode,
|
SpiDataMode,
|
||||||
SpiMode,
|
SpiMode,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user