Fix into_async/blocking on typed Spi (#2674)

This commit is contained in:
Dániel Buga 2024-12-04 15:45:52 +01:00 committed by GitHub
parent d54f8440a5
commit dcded33d3d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 11 deletions

View File

@ -60,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Xtensa devices now correctly enable the `esp-hal-procmacros/rtc-slow` feature (#2594)
- User-bound GPIO interrupt handlers should no longer interfere with async pins. (#2625)
- `spi::master::Spi::{into_async, into_blocking}` are now correctly available on the typed driver, to. (#2674)
### Removed

View File

@ -511,21 +511,21 @@ impl<'d> Spi<'d, Blocking> {
) -> Result<Self, ConfigError> {
Self::new_typed(spi.map_into(), config)
}
/// Converts the SPI instance into async mode.
pub fn into_async(self) -> Spi<'d, Async> {
Spi {
spi: self.spi,
_mode: PhantomData,
guard: self.guard,
}
}
}
impl<'d, T> Spi<'d, Blocking, T>
where
T: Instance,
{
/// Converts the SPI instance into async mode.
pub fn into_async(self) -> Spi<'d, Async, T> {
Spi {
spi: self.spi,
_mode: PhantomData,
guard: self.guard,
}
}
/// Configures the SPI instance to use DMA with the specified channel.
///
/// This method prepares the SPI instance for DMA transfers using SPI
@ -539,9 +539,12 @@ where
}
}
impl<'d> Spi<'d, Async> {
impl<'d, T> Spi<'d, Async, T>
where
T: Instance,
{
/// Converts the SPI instance into blocking mode.
pub fn into_blocking(self) -> Spi<'d, Blocking> {
pub fn into_blocking(self) -> Spi<'d, Blocking, T> {
Spi {
spi: self.spi,
_mode: PhantomData,