Remove SPI slave prelude (#2260)
* Remove SPI slave prelude * Changelog * Update esp-hal/src/spi/slave.rs
This commit is contained in:
parent
8e9f6b5015
commit
f5b8e4b914
@ -96,6 +96,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Removed `uart::{DefaultRxPin, DefaultTxPin}` (#2132)
|
||||
- Removed `PcntSource` and `PcntInputConfig`. (#2134)
|
||||
- Removed the `place-spi-driver-in-ram` feature, this is now enabled via [esp-config](https://docs.rs/esp-config) (#2156)
|
||||
- Removed `esp_hal::spi::slave::prelude` (#2260)
|
||||
- Removed `esp_hal::spi::slave::WithDmaSpiN` traits (#2260)
|
||||
|
||||
## [0.20.1] - 2024-08-30
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
//! # use esp_hal::dma::DmaPriority;
|
||||
//! # use esp_hal::dma_buffers;
|
||||
//! # use esp_hal::spi::SpiMode;
|
||||
//! # use esp_hal::spi::slave::{prelude::*, Spi};
|
||||
//! # use esp_hal::spi::slave::Spi;
|
||||
//! # use esp_hal::dma::Dma;
|
||||
//! # use esp_hal::gpio::Io;
|
||||
//! let dma = Dma::new(peripherals.DMA);
|
||||
@ -80,17 +80,6 @@ use crate::{
|
||||
system::PeripheralClockControl,
|
||||
};
|
||||
|
||||
/// Prelude for the SPI (Slave) driver
|
||||
pub mod prelude {
|
||||
#[cfg(spi3)]
|
||||
pub use super::dma::WithDmaSpi3 as _esp_hal_spi_slave_dma_WithDmaSpi3;
|
||||
pub use super::{
|
||||
dma::WithDmaSpi2 as _esp_hal_spi_slave_dma_WithDmaSpi2,
|
||||
Instance as _esp_hal_spi_slave_Instance,
|
||||
InstanceDma as _esp_hal_spi_slave_InstanceDma,
|
||||
};
|
||||
}
|
||||
|
||||
const MAX_DMA_SIZE: usize = 32768 - 32;
|
||||
|
||||
/// SPI peripheral driver
|
||||
@ -181,54 +170,20 @@ pub mod dma {
|
||||
Mode,
|
||||
};
|
||||
|
||||
/// Trait for configuring DMA with SPI2 peripherals in slave mode.
|
||||
pub trait WithDmaSpi2<'d, C, DmaMode>
|
||||
where
|
||||
C: DmaChannel,
|
||||
C::P: SpiPeripheral,
|
||||
DmaMode: Mode,
|
||||
{
|
||||
/// Configures the SPI2 peripheral with the provided DMA channel and
|
||||
/// descriptors.
|
||||
fn with_dma(
|
||||
self,
|
||||
channel: Channel<'d, C, DmaMode>,
|
||||
rx_descriptors: &'static mut [DmaDescriptor],
|
||||
tx_descriptors: &'static mut [DmaDescriptor],
|
||||
) -> SpiDma<'d, crate::peripherals::SPI2, C, DmaMode>;
|
||||
}
|
||||
|
||||
/// Trait for configuring DMA with SPI3 peripherals in slave mode.
|
||||
#[cfg(spi3)]
|
||||
pub trait WithDmaSpi3<'d, C, DmaMode>
|
||||
where
|
||||
C: DmaChannel,
|
||||
C::P: SpiPeripheral,
|
||||
DmaMode: Mode,
|
||||
{
|
||||
impl<'d> Spi<'d, crate::peripherals::SPI2, FullDuplexMode> {
|
||||
/// Configures the SPI3 peripheral with the provided DMA channel and
|
||||
/// descriptors.
|
||||
fn with_dma(
|
||||
pub fn with_dma<C, DmaMode>(
|
||||
self,
|
||||
channel: Channel<'d, C, DmaMode>,
|
||||
rx_descriptors: &'static mut [DmaDescriptor],
|
||||
tx_descriptors: &'static mut [DmaDescriptor],
|
||||
) -> SpiDma<'d, crate::peripherals::SPI3, C, DmaMode>;
|
||||
}
|
||||
|
||||
impl<'d, C, DmaMode> WithDmaSpi2<'d, C, DmaMode>
|
||||
for Spi<'d, crate::peripherals::SPI2, FullDuplexMode>
|
||||
) -> SpiDma<'d, crate::peripherals::SPI2, C, DmaMode>
|
||||
where
|
||||
C: DmaChannel,
|
||||
C::P: SpiPeripheral + Spi2Peripheral,
|
||||
DmaMode: Mode,
|
||||
{
|
||||
fn with_dma(
|
||||
self,
|
||||
channel: Channel<'d, C, DmaMode>,
|
||||
rx_descriptors: &'static mut [DmaDescriptor],
|
||||
tx_descriptors: &'static mut [DmaDescriptor],
|
||||
) -> SpiDma<'d, crate::peripherals::SPI2, C, DmaMode> {
|
||||
SpiDma {
|
||||
spi: self.spi,
|
||||
channel,
|
||||
@ -239,19 +194,20 @@ pub mod dma {
|
||||
}
|
||||
|
||||
#[cfg(spi3)]
|
||||
impl<'d, C, DmaMode> WithDmaSpi3<'d, C, DmaMode>
|
||||
for Spi<'d, crate::peripherals::SPI3, FullDuplexMode>
|
||||
impl<'d> Spi<'d, crate::peripherals::SPI3, FullDuplexMode> {
|
||||
/// Configures the SPI3 peripheral with the provided DMA channel and
|
||||
/// descriptors.
|
||||
pub fn with_dma<C, DmaMode>(
|
||||
self,
|
||||
channel: Channel<'d, C, DmaMode>,
|
||||
rx_descriptors: &'static mut [DmaDescriptor],
|
||||
tx_descriptors: &'static mut [DmaDescriptor],
|
||||
) -> SpiDma<'d, crate::peripherals::SPI3, C, DmaMode>
|
||||
where
|
||||
C: DmaChannel,
|
||||
C::P: SpiPeripheral + Spi3Peripheral,
|
||||
DmaMode: Mode,
|
||||
{
|
||||
fn with_dma(
|
||||
self,
|
||||
channel: Channel<'d, C, DmaMode>,
|
||||
rx_descriptors: &'static mut [DmaDescriptor],
|
||||
tx_descriptors: &'static mut [DmaDescriptor],
|
||||
) -> SpiDma<'d, crate::peripherals::SPI3, C, DmaMode> {
|
||||
SpiDma {
|
||||
spi: self.spi,
|
||||
channel,
|
||||
|
||||
@ -36,10 +36,7 @@ use esp_hal::{
|
||||
dma_buffers,
|
||||
gpio::{Input, Io, Level, Output, Pull},
|
||||
prelude::*,
|
||||
spi::{
|
||||
slave::{prelude::*, Spi},
|
||||
SpiMode,
|
||||
},
|
||||
spi::{slave::Spi, SpiMode},
|
||||
};
|
||||
use esp_println::println;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user