Skip to content

Commit

Permalink
Docs on new async APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
MabezDev committed Aug 22, 2024
1 parent 054d67c commit f7c34ac
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions esp-hal/src/spi/master.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1725,7 +1725,8 @@ pub mod dma {
}
}

async fn read_async(&mut self, words: &mut [u8]) -> Result<(), super::Error> {
/// Fill the given buffer with data from the bus.
pub async fn read_async(&mut self, words: &mut [u8]) -> Result<(), super::Error> {
// Get previous transfer.
let (mut spi_dma, mut tx_buf, mut rx_buf) = self.wait_for_idle_async().await;

Expand Down Expand Up @@ -1753,7 +1754,8 @@ pub mod dma {
Ok(())
}

async fn write_async(&mut self, words: &[u8]) -> Result<(), super::Error> {
/// Transmit the given buffer to the bus.
pub async fn write_async(&mut self, words: &[u8]) -> Result<(), super::Error> {
// Get previous transfer.
let (mut spi_dma, mut tx_buf, mut rx_buf) = self.wait_for_idle_async().await;

Expand All @@ -1778,7 +1780,8 @@ pub mod dma {
Ok(())
}

async fn transfer_async(
/// Transfer by writing out a buffer and reading the response from the bus into another buffer.
pub async fn transfer_async(
&mut self,
read: &mut [u8],
write: &[u8],
Expand Down Expand Up @@ -1826,7 +1829,8 @@ pub mod dma {
}
}

async fn transfer_in_place_async(
/// Transfer by writing out a buffer and reading the response from the bus into the same buffer.
pub async fn transfer_in_place_async(
&mut self,
words: &mut [u8],
) -> Result<(), super::Error> {
Expand Down Expand Up @@ -1869,7 +1873,8 @@ pub mod dma {
Ok(())
}

async fn flush_async(&mut self) -> Result<(), super::Error> {
/// Flush any pending data in the SPI peripheral.
pub async fn flush_async(&mut self) -> Result<(), super::Error> {
// Get previous transfer.
let (spi_dma, tx_buf, rx_buf) = self.wait_for_idle_async().await;
self.state = State::Idle(spi_dma, tx_buf, rx_buf);
Expand Down

0 comments on commit f7c34ac

Please sign in to comment.