Struct embassy_nrf::spim::Spim
source · 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 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.