Remove redundant WithDmaSpi traits (#1975)

Co-authored-by: Dominic Fischer <git@dominicfischer.me>
This commit is contained in:
Dominic Fischer 2024-08-21 13:59:55 +01:00 committed by GitHub
parent 7dfaca49ba
commit dc6c53ee47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 24 additions and 61 deletions

View File

@ -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)
- The `AesFlavour` trait no longer has the `ENCRYPT_MODE`/`DECRYPT_MODE` associated constants (#1849)
- Removed `FlashSafeDma` (#1856)
- Remove redundant WithDmaSpi traits (#1975)
## [0.19.0] - 2024-07-15

View File

@ -90,10 +90,7 @@ use crate::{
/// Prelude for the SPI (Master) driver
pub mod prelude {
#[cfg(spi3)]
pub use super::dma::WithDmaSpi3 as _esp_hal_spi_master_dma_WithDmaSpi3;
pub use super::{
dma::WithDmaSpi2 as _esp_hal_spi_master_dma_WithDmaSpi2,
Instance as _esp_hal_spi_master_Instance,
InstanceDma as _esp_hal_spi_master_InstanceDma,
};
@ -867,44 +864,19 @@ pub mod dma {
Mode,
};
pub trait WithDmaSpi2<'d, C, M, DmaMode>
impl<'d, M> Spi<'d, crate::peripherals::SPI2, M>
where
C: DmaChannel,
C::P: SpiPeripheral,
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>
mut channel: Channel<'d, C, DmaMode>,
) -> SpiDma<'d, crate::peripherals::SPI2, C, M, DmaMode>
where
C: DmaChannel,
C::P: SpiPeripheral + Spi2Peripheral,
M: DuplexMode,
DmaMode: Mode,
{
fn with_dma(
self,
mut channel: Channel<'d, C, DmaMode>,
) -> SpiDma<'d, crate::peripherals::SPI2, C, M, DmaMode> {
channel.tx.init_channel(); // no need to call this for both, TX and RX
SpiDma {
@ -916,17 +888,19 @@ pub mod dma {
}
#[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
M: DuplexMode,
{
pub fn with_dma<C, DmaMode>(
self,
mut channel: Channel<'d, C, DmaMode>,
) -> SpiDma<'d, crate::peripherals::SPI3, C, M, DmaMode>
where
C: DmaChannel,
C::P: SpiPeripheral + Spi3Peripheral,
M: DuplexMode,
DmaMode: Mode,
{
fn with_dma(
self,
mut channel: Channel<'d, C, DmaMode>,
) -> SpiDma<'d, crate::peripherals::SPI3, C, M, DmaMode> {
channel.tx.init_channel(); // no need to call this for both, TX and RX
SpiDma {

View File

@ -28,10 +28,7 @@ use esp_hal::{
gpio::Io,
peripherals::Peripherals,
prelude::*,
spi::{
master::{prelude::*, Spi},
SpiMode,
},
spi::{master::Spi, SpiMode},
system::SystemControl,
timer::timg::TimerGroup,
};

View File

@ -37,7 +37,7 @@ use esp_hal::{
peripherals::Peripherals,
prelude::*,
spi::{
master::{prelude::*, Address, Command, Spi},
master::{Address, Command, Spi},
SpiDataMode,
SpiMode,
},

View File

@ -27,10 +27,7 @@ use esp_hal::{
gpio::Io,
peripherals::Peripherals,
prelude::*,
spi::{
master::{prelude::*, Spi},
SpiMode,
},
spi::{master::Spi, SpiMode},
system::SystemControl,
};
use esp_println::println;

View File

@ -28,10 +28,7 @@ use esp_hal::{
gpio::Io,
peripherals::Peripherals,
prelude::*,
spi::{
master::{prelude::*, Spi},
SpiMode,
},
spi::{master::Spi, SpiMode},
system::SystemControl,
};
use hil_test as _;

View File

@ -31,10 +31,7 @@ use esp_hal::{
},
peripherals::Peripherals,
prelude::*,
spi::{
master::{prelude::*, Spi},
SpiMode,
},
spi::{master::Spi, SpiMode},
system::SystemControl,
};
use hil_test as _;

View File

@ -26,7 +26,7 @@ mod tests {
peripherals::Peripherals,
prelude::_fugit_RateExtU32,
spi::{
master::{prelude::*, Address, Command, Spi},
master::{Address, Command, Spi},
SpiDataMode,
SpiMode,
},

View File

@ -30,7 +30,7 @@ mod tests {
peripherals::Peripherals,
prelude::_fugit_RateExtU32,
spi::{
master::{prelude::*, Address, Command, Spi},
master::{Address, Command, Spi},
SpiDataMode,
SpiMode,
},