pub struct SubghzSpi<'d, M: Mode> { /* private fields */ }Expand description
Sub-GHz radio SPI interface driver.
Wraps the internal SUBGHZSPI peripheral and hardware slave-select line (PWR_SUBGHZSPICR.NSS).
Implements embedded-hal and embedded-hal-async SpiDevice traits.
Implementations§
Source§impl<'d> SubghzSpi<'d, Async>
impl<'d> SubghzSpi<'d, Async>
Sourcepub fn new<T: Instance, D1: TxDma<T>, D2: RxDma<T>>(
peri: Peri<'d, T>,
tx_dma: Peri<'d, D1>,
rx_dma: Peri<'d, D2>,
irq: impl Binding<D1::Interrupt, InterruptHandler<D1>> + Binding<D2::Interrupt, InterruptHandler<D2>> + 'd,
) -> Self
pub fn new<T: Instance, D1: TxDma<T>, D2: RxDma<T>>( peri: Peri<'d, T>, tx_dma: Peri<'d, D1>, rx_dma: Peri<'d, D2>, irq: impl Binding<D1::Interrupt, InterruptHandler<D1>> + Binding<D2::Interrupt, InterruptHandler<D2>> + 'd, ) -> Self
Create a new asynchronous SubghzSpi driver using DMA.
Sourcepub async fn write(&mut self, words: &[u8]) -> Result<(), Error>
pub async fn write(&mut self, words: &[u8]) -> Result<(), Error>
Send a write command or buffer asynchronously over SUBGHZSPI.
Sourcepub async fn read(&mut self, words: &mut [u8]) -> Result<(), Error>
pub async fn read(&mut self, words: &mut [u8]) -> Result<(), Error>
Read data asynchronously from SUBGHZSPI.
Source§impl<'d> SubghzSpi<'d, Blocking>
impl<'d> SubghzSpi<'d, Blocking>
Sourcepub fn new_blocking<T: Instance>(peri: Peri<'d, T>) -> Self
pub fn new_blocking<T: Instance>(peri: Peri<'d, T>) -> Self
Create a new blocking SubghzSpi driver without DMA.
Sourcepub fn blocking_write(&mut self, words: &[u8]) -> Result<(), Error>
pub fn blocking_write(&mut self, words: &[u8]) -> Result<(), Error>
Send a write command or buffer blockingly over SUBGHZSPI.
Sourcepub fn blocking_read(&mut self, words: &mut [u8]) -> Result<(), Error>
pub fn blocking_read(&mut self, words: &mut [u8]) -> Result<(), Error>
Read data blockingly from SUBGHZSPI.
Trait Implementations§
Source§impl<'d, M: Mode> SpiDevice for SubghzSpi<'d, M>
impl<'d, M: Mode> SpiDevice for SubghzSpi<'d, M>
Source§fn transaction(
&mut self,
operations: &mut [Operation<'_, u8>],
) -> Result<(), Self::Error>
fn transaction( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), Self::Error>
Perform a transaction against the device. Read more
Source§fn read(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>
fn read(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>
Do a read within a transaction. Read more
Source§fn write(&mut self, buf: &[Word]) -> Result<(), Self::Error>
fn write(&mut self, buf: &[Word]) -> Result<(), Self::Error>
Do a write within a transaction. Read more
Source§impl<'d> SpiDevice for SubghzSpi<'d, Async>
impl<'d> SpiDevice for SubghzSpi<'d, Async>
Source§async fn transaction(
&mut self,
operations: &mut [Operation<'_, u8>],
) -> Result<(), Self::Error>
async fn transaction( &mut self, operations: &mut [Operation<'_, u8>], ) -> Result<(), Self::Error>
Perform a transaction against the device. Read more
Source§async fn read(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>
async fn read(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>
Do a read within a transaction. Read more
Source§async fn write(&mut self, buf: &[Word]) -> Result<(), Self::Error>
async fn write(&mut self, buf: &[Word]) -> Result<(), Self::Error>
Do a write within a transaction. Read more
Auto Trait Implementations§
impl<'d, M> !RefUnwindSafe for SubghzSpi<'d, M>
impl<'d, M> !UnwindSafe for SubghzSpi<'d, M>
impl<'d, M> Forget for SubghzSpi<'d, M>
impl<'d, M> Freeze for SubghzSpi<'d, M>
impl<'d, M> Move for SubghzSpi<'d, M>
impl<'d, M> Send for SubghzSpi<'d, M>
impl<'d, M> Sync for SubghzSpi<'d, M>
impl<'d, M> Unpin for SubghzSpi<'d, M>
impl<'d, M> UnsafeUnpin for SubghzSpi<'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