pub struct Spim<'d, T: Instance> { /* private fields */ }
Expand description
SPIM driver.
Implementations§
Source§impl<'d, T: Instance> Spim<'d, T>
impl<'d, T: Instance> Spim<'d, T>
Sourcepub fn new(
spim: impl Peripheral<P = T> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
sck: impl Peripheral<P = impl GpioPin> + 'd,
miso: impl Peripheral<P = impl GpioPin> + 'd,
mosi: impl Peripheral<P = impl GpioPin> + 'd,
config: Config,
) -> Self
pub fn new( spim: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, sck: impl Peripheral<P = impl GpioPin> + 'd, miso: impl Peripheral<P = impl GpioPin> + 'd, mosi: impl Peripheral<P = impl GpioPin> + 'd, config: Config, ) -> Self
Create a new SPIM driver.
Sourcepub fn new_txonly(
spim: impl Peripheral<P = T> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
sck: impl Peripheral<P = impl GpioPin> + 'd,
mosi: impl Peripheral<P = impl GpioPin> + 'd,
config: Config,
) -> Self
pub fn new_txonly( spim: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, sck: impl Peripheral<P = impl GpioPin> + 'd, mosi: impl Peripheral<P = impl GpioPin> + 'd, config: Config, ) -> Self
Create a new SPIM driver, capable of TX only (MOSI only).
Sourcepub fn new_rxonly(
spim: impl Peripheral<P = T> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
sck: impl Peripheral<P = impl GpioPin> + 'd,
miso: impl Peripheral<P = impl GpioPin> + 'd,
config: Config,
) -> Self
pub fn new_rxonly( spim: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, sck: impl Peripheral<P = impl GpioPin> + 'd, miso: impl Peripheral<P = impl GpioPin> + 'd, config: Config, ) -> Self
Create a new SPIM driver, capable of RX only (MISO only).
Sourcepub fn new_txonly_nosck(
spim: impl Peripheral<P = T> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
mosi: impl Peripheral<P = impl GpioPin> + 'd,
config: Config,
) -> Self
pub fn new_txonly_nosck( spim: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, mosi: impl Peripheral<P = impl GpioPin> + 'd, config: Config, ) -> Self
Create a new SPIM driver, capable of TX only (MOSI only), without SCK pin.
Sourcepub fn blocking_read(&mut self, data: &mut [u8]) -> Result<(), Error>
pub fn blocking_read(&mut self, data: &mut [u8]) -> Result<(), Error>
Reads data from the SPI bus without sending anything. Blocks until the buffer has been filled.
Sourcepub fn blocking_transfer(
&mut self,
read: &mut [u8],
write: &[u8],
) -> Result<(), Error>
pub fn blocking_transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), Error>
Simultaneously sends and receives data. Blocks until the transmission is completed. If necessary, the write buffer will be copied into RAM (see struct description for detail).
Sourcepub fn blocking_transfer_from_ram(
&mut self,
read: &mut [u8],
write: &[u8],
) -> Result<(), Error>
pub fn blocking_transfer_from_ram( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), Error>
Same as blocking_transfer
but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub fn blocking_transfer_in_place(
&mut self,
data: &mut [u8],
) -> Result<(), Error>
pub fn blocking_transfer_in_place( &mut self, data: &mut [u8], ) -> Result<(), Error>
Simultaneously sends and receives data. Places the received data into the same buffer and blocks until the transmission is completed.
Sourcepub fn blocking_write(&mut self, data: &[u8]) -> Result<(), Error>
pub fn blocking_write(&mut self, data: &[u8]) -> Result<(), Error>
Sends data, discarding any received data. Blocks until the transmission is completed. If necessary, the write buffer will be copied into RAM (see struct description for detail).
Sourcepub fn blocking_write_from_ram(&mut self, data: &[u8]) -> Result<(), Error>
pub fn blocking_write_from_ram(&mut self, data: &[u8]) -> Result<(), Error>
Same as blocking_write
but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub async fn read(&mut self, data: &mut [u8]) -> Result<(), Error>
pub async fn read(&mut self, data: &mut [u8]) -> Result<(), Error>
Reads data from the SPI bus without sending anything.
Sourcepub async fn transfer(
&mut self,
read: &mut [u8],
write: &[u8],
) -> Result<(), Error>
pub async fn transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), Error>
Simultaneously sends and receives data. If necessary, the write buffer will be copied into RAM (see struct description for detail).
Sourcepub async fn transfer_from_ram(
&mut self,
read: &mut [u8],
write: &[u8],
) -> Result<(), Error>
pub async fn transfer_from_ram( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), Error>
Same as transfer
but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub async fn transfer_in_place(&mut self, data: &mut [u8]) -> Result<(), Error>
pub async fn transfer_in_place(&mut self, data: &mut [u8]) -> Result<(), Error>
Simultaneously sends and receives data. Places the received data into the same buffer.
Trait Implementations§
Source§impl<'d, T: Instance> SetConfig for Spim<'d, T>
impl<'d, T: Instance> SetConfig for Spim<'d, T>
Source§type ConfigError = ()
type ConfigError = ()
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>
Source§impl<'d, T: Instance> SpiBus for Spim<'d, T>
impl<'d, T: Instance> SpiBus for Spim<'d, T>
Source§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Source§fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
fn read(&mut self, words: &mut [u8]) -> Result<(), Self::Error>
words
from the slave. Read moreSource§fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, words: &[u8]) -> Result<(), Self::Error>
words
to the slave, ignoring all the incoming words. Read moreSource§impl<'d, T: Instance> SpiBus for Spim<'d, T>
impl<'d, T: Instance> SpiBus for Spim<'d, T>
Source§async fn flush(&mut self) -> Result<(), Error>
async fn flush(&mut self) -> Result<(), Error>
Source§async fn read(&mut self, words: &mut [u8]) -> Result<(), Error>
async fn read(&mut self, words: &mut [u8]) -> Result<(), Error>
words
from the slave. Read moreSource§async fn write(&mut self, data: &[u8]) -> Result<(), Error>
async fn write(&mut self, data: &[u8]) -> Result<(), Error>
words
to the slave, ignoring all the incoming words. Read more