Skip to content

Commit

Permalink
Add SpiDmaBus::split for moving between manual & automatic DMA buff…
Browse files Browse the repository at this point in the history
…ers (#2824)

* Allow swapping dma buffers

* Deconstruct makes more sense

* Format

* Changelog

* Race-conditioned

* Change SpiDmaBus::deconstruct name to SpiDmaBus::split

* Add flush & bracket references

* Fix mutability

---------

Co-authored-by: ferris <[email protected]>
  • Loading branch information
i404788 and ferris authored Dec 20, 2024
1 parent f83ab23 commit 0ef5a80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Peripheral singletons now implement `Debug` and `defmt::Format` (#2682, #2834)
- `BurstConfig`, a device-specific configuration for configuring DMA transfers in burst mode (#2543)
- `{DmaRxBuf, DmaTxBuf, DmaRxTxBuf}::set_burst_config` (#2543)
- Added `SpiDmaBus::split` for moving between manual & automatic DMA buffers (#2824)
- ESP32-S2: DMA support for AES (#2699)
- Added `transfer_in_place_async` and embedded-hal-async implementation to `Spi` (#2691)
- `InterruptHandler` now implements `Hash` and `defmt::Format` (#2830)
Expand Down
6 changes: 6 additions & 0 deletions esp-hal/src/spi/master.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1646,6 +1646,12 @@ mod dma {
tx_buf,
}
}

/// Splits [SpiDmaBus] back into [SpiDma], [DmaRxBuf] and [DmaTxBuf].
pub fn split(mut self) -> (SpiDma<'d, M, T>, DmaRxBuf, DmaTxBuf) {
self.wait_for_idle();
(self.spi_dma, self.rx_buf, self.tx_buf)
}
}

impl<T> InterruptConfigurable for SpiDmaBus<'_, Blocking, T>
Expand Down

0 comments on commit 0ef5a80

Please sign in to comment.