pub struct Spi<'d, M: IoMode> { /* private fields */ }Expand description
Spi driver.
Implementations§
Source§impl<'d, M: IoMode> Spi<'d, M>
impl<'d, M: IoMode> Spi<'d, M>
Sourcepub fn blocking_read(&mut self, data: &mut [u8]) -> Result<(), IoError>
pub fn blocking_read(&mut self, data: &mut [u8]) -> Result<(), IoError>
Read data from Spi blocking execution until done.
Sourcepub fn blocking_write(&mut self, data: &[u8]) -> Result<(), IoError>
pub fn blocking_write(&mut self, data: &[u8]) -> Result<(), IoError>
Write data to Spi blocking execution until done.
Sourcepub fn blocking_transfer(
&mut self,
read: &mut [u8],
write: &[u8],
) -> Result<(), IoError>
pub fn blocking_transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), IoError>
Transfer data to SPI blocking execution until done.
Sourcepub fn blocking_transfer_in_place(
&mut self,
data: &mut [u8],
) -> Result<(), IoError>
pub fn blocking_transfer_in_place( &mut self, data: &mut [u8], ) -> Result<(), IoError>
Transfer data in place to SPI blocking execution until done.
Sourcepub fn blocking_flush(&mut self) -> Result<(), IoError>
pub fn blocking_flush(&mut self) -> Result<(), IoError>
Block execution until Spi is done.
Source§impl<'d> Spi<'d, Blocking>
impl<'d> Spi<'d, Blocking>
Sourcepub fn new_blocking<T: Instance>(
_peri: Peri<'d, T>,
sck: Peri<'d, impl SckPin<T> + 'd>,
mosi: Peri<'d, impl MosiPin<T> + 'd>,
miso: Peri<'d, impl MisoPin<T> + 'd>,
config: Config,
) -> Result<Self, SetupError>
pub fn new_blocking<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, mosi: Peri<'d, impl MosiPin<T> + 'd>, miso: Peri<'d, impl MisoPin<T> + 'd>, config: Config, ) -> Result<Self, SetupError>
Create a SPI driver in blocking mode.
Source§impl<'d> Spi<'d, Async>
impl<'d> Spi<'d, Async>
Sourcepub fn new_async<T: Instance>(
_peri: Peri<'d, T>,
sck: Peri<'d, impl SckPin<T> + 'd>,
mosi: Peri<'d, impl MosiPin<T> + 'd>,
miso: Peri<'d, impl MisoPin<T> + 'd>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
config: Config,
) -> Result<Self, SetupError>
pub fn new_async<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, mosi: Peri<'d, impl MosiPin<T> + 'd>, miso: Peri<'d, impl MisoPin<T> + 'd>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>
Create a SPI driver in async mode.
Sourcepub fn new_async_txonly<T: Instance>(
_peri: Peri<'d, T>,
sck: Peri<'d, impl SckPin<T> + 'd>,
mosi: Peri<'d, impl MosiPin<T> + 'd>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
config: Config,
) -> Result<Self, SetupError>
pub fn new_async_txonly<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, mosi: Peri<'d, impl MosiPin<T> + 'd>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>
Create a TX-only SPI driver in async mode.
Sourcepub fn new_async_rxonly<T: Instance>(
_peri: Peri<'d, T>,
sck: Peri<'d, impl SckPin<T> + 'd>,
miso: Peri<'d, impl MisoPin<T> + 'd>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
config: Config,
) -> Result<Self, SetupError>
pub fn new_async_rxonly<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, miso: Peri<'d, impl MisoPin<T> + 'd>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>
Create an RX-only SPI driver in async mode.
Source§impl<'d> Spi<'d, Dma<'d>>
impl<'d> Spi<'d, Dma<'d>>
Sourcepub fn new_async_with_dma<T: Instance>(
_peri: Peri<'d, T>,
sck: Peri<'d, impl SckPin<T> + 'd>,
mosi: Peri<'d, impl MosiPin<T> + 'd>,
miso: Peri<'d, impl MisoPin<T> + 'd>,
tx_dma: Peri<'d, impl TxDma<T>>,
rx_dma: Peri<'d, impl RxDma<T>>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
config: Config,
) -> Result<Self, SetupError>
pub fn new_async_with_dma<T: Instance>( _peri: Peri<'d, T>, sck: Peri<'d, impl SckPin<T> + 'd>, mosi: Peri<'d, impl MosiPin<T> + 'd>, miso: Peri<'d, impl MisoPin<T> + 'd>, tx_dma: Peri<'d, impl TxDma<T>>, rx_dma: Peri<'d, impl RxDma<T>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, config: Config, ) -> Result<Self, SetupError>
Create a SPI driver in async mode.
Source§impl<'d, M: AsyncMode> Spi<'d, M>where
Self: AsyncEngine,
impl<'d, M: AsyncMode> Spi<'d, M>where
Self: AsyncEngine,
Sourcepub fn async_read(
&mut self,
data: &mut [u8],
) -> impl Future<Output = Result<(), IoError>>
pub fn async_read( &mut self, data: &mut [u8], ) -> impl Future<Output = Result<(), IoError>>
Read data from Spi async execution until done.
Sourcepub fn async_write(
&mut self,
data: &[u8],
) -> impl Future<Output = Result<(), IoError>>
pub fn async_write( &mut self, data: &[u8], ) -> impl Future<Output = Result<(), IoError>>
Write data to Spi async execution until done.
Sourcepub fn async_transfer(
&mut self,
read: &mut [u8],
write: &[u8],
) -> impl Future<Output = Result<(), IoError>>
pub fn async_transfer( &mut self, read: &mut [u8], write: &[u8], ) -> impl Future<Output = Result<(), IoError>>
Transfer data to SPI async execution until done.
Sourcepub fn async_transfer_in_place(
&mut self,
data: &mut [u8],
) -> impl Future<Output = Result<(), IoError>>
pub fn async_transfer_in_place( &mut self, data: &mut [u8], ) -> impl Future<Output = Result<(), IoError>>
Transfer data in place to SPI async execution until done.
Sourcepub async fn async_flush(&mut self) -> Result<(), IoError>
pub async fn async_flush(&mut self) -> Result<(), IoError>
Async flush.
Trait Implementations§
Source§impl<'d, M: IoMode> SetConfig for Spi<'d, M>
impl<'d, M: IoMode> SetConfig for Spi<'d, M>
Source§type ConfigError = SetupError
type ConfigError = SetupError
The error type that can occur if
set_config fails.Source§fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
Set the configuration of the driver.
Source§impl<'d, M: IoMode> SpiBus for Spi<'d, M>
impl<'d, M: IoMode> SpiBus for Spi<'d, M>
Source§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Wait until all operations have completed and the bus is idle. Read more
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§impl<'d, M: AsyncMode> SpiBus for Spi<'d, M>where
Spi<'d, M>: AsyncEngine,
impl<'d, M: AsyncMode> SpiBus for Spi<'d, M>where
Spi<'d, M>: AsyncEngine,
Source§async fn flush(&mut self) -> Result<(), Self::Error>
async fn flush(&mut self) -> Result<(), Self::Error>
Wait until all operations have completed and the bus is idle. Read more
Source§async fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
async fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
Write
words to the slave, ignoring all the incoming words. Read moreSource§async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
async fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
Read
words from the slave. Read moreAuto Trait Implementations§
impl<'d, M> Freeze for Spi<'d, M>where
M: Freeze,
impl<'d, M> !RefUnwindSafe for Spi<'d, M>
impl<'d, M> Send for Spi<'d, M>
impl<'d, M> Sync for Spi<'d, M>where
M: Sync,
impl<'d, M> Unpin for Spi<'d, M>where
M: Unpin,
impl<'d, M> !UnwindSafe for Spi<'d, M>
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