pub struct Spi { /* private fields */ }Expand description
SPI bus master.
Wraps an opaque ove_spi_t handle provided by the board configuration.
Construct via Spi::from_handle.
Implementations§
Source§impl Spi
impl Spi
Sourcepub const unsafe fn from_handle(handle: ove_spi_t) -> Self
pub const unsafe fn from_handle(handle: ove_spi_t) -> Self
Wrap an existing ove_spi_t handle.
§Safety
handle must be a valid SPI handle returned by the substrate.
The caller is responsible for ensuring no other Spi wrapper
exists for the same handle concurrently.
Sourcepub fn transfer(
&self,
cs: Option<&ove_spi_cs>,
tx: &[u8],
rx: &mut [u8],
timeout: Duration,
) -> Result<()>
pub fn transfer( &self, cs: Option<&ove_spi_cs>, tx: &[u8], rx: &mut [u8], timeout: Duration, ) -> Result<()>
Full-duplex SPI transfer. tx or rx may be empty for half-duplex.
Sourcepub fn write(
&self,
cs: Option<&ove_spi_cs>,
data: &[u8],
timeout: Duration,
) -> Result<()>
pub fn write( &self, cs: Option<&ove_spi_cs>, data: &[u8], timeout: Duration, ) -> Result<()>
Write-only SPI transfer.
Trait Implementations§
Source§impl SpiBus for Spi
impl SpiBus for Spi
Source§fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
Read
words from the slave. Read moreSource§fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
Write
words to the slave, ignoring all the incoming words. Read moreSource§fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error>
fn transfer(&mut self, read: &mut [u8], write: &[u8]) -> Result<(), Self::Error>
Write and read simultaneously.
write is written to the slave on MOSI and
words received on MISO are stored in read. Read moreimpl Copy for Spi
Auto Trait Implementations§
impl Freeze for Spi
impl RefUnwindSafe for Spi
impl !Send for Spi
impl !Sync for Spi
impl Unpin for Spi
impl UnsafeUnpin for Spi
impl UnwindSafe for Spi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more