Skip to content

Commit

Permalink
improve docs of read/write_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajSadel committed Jan 10, 2025
1 parent 8c48ab4 commit f15db5b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions esp-hal/src/spi/master.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,20 +504,22 @@ where
}
}

/// Write bytes to SPI.
/// Write bytes to SPI. After writing, flush is called to ensure all data
/// has been transmitted.
pub fn write_bytes(&mut self, words: &[u8]) -> Result<(), Error> {
self.driver().write_bytes(words)?;
self.driver().flush()?;

Ok(())
}

/// Read bytes from SPI.
/// Read bytes from SPI. The provided slice is filled with data received
/// from the slave.
pub fn read_bytes(&mut self, words: &mut [u8]) -> Result<(), Error> {
self.driver().read_bytes(words)
}

/// Sends `words` to the slave. Returns the `words` received from the slave
/// Sends `words` to the slave. Returns the `words` received from the slave.
pub fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Error> {
self.driver().transfer(words)
}
Expand Down

0 comments on commit f15db5b

Please sign in to comment.