embassy-stm32

Crates

git

Versions

stm32wl54cc-cm4

Flavors

Skip to main content

SubghzSpi

Struct SubghzSpi 

Source
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, M: Mode> SubghzSpi<'d, M>

Source

pub fn set_nss(level: bool)

Control the Sub-GHz radio SPI NSS (slave select) signal.

  • false: NSS low (asserted / active).
  • true: NSS high (deasserted / inactive).
Source

pub fn nss() -> bool

Read the current state of the Sub-GHz radio SPI NSS signal.

Source§

impl<'d> SubghzSpi<'d, Async>

Source

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.

Source

pub async fn write(&mut self, words: &[u8]) -> Result<(), Error>

Send a write command or buffer asynchronously over SUBGHZSPI.

Source

pub async fn read(&mut self, words: &mut [u8]) -> Result<(), Error>

Read data asynchronously from SUBGHZSPI.

Source

pub async fn transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), Error>

Perform a full-duplex asynchronous transfer over SUBGHZSPI.

Source

pub async fn transfer_in_place(&mut self, words: &mut [u8]) -> Result<(), Error>

Perform an in-place asynchronous transfer over SUBGHZSPI.

Source§

impl<'d> SubghzSpi<'d, Blocking>

Source

pub fn new_blocking<T: Instance>(peri: Peri<'d, T>) -> Self

Create a new blocking SubghzSpi driver without DMA.

Source

pub fn blocking_write(&mut self, words: &[u8]) -> Result<(), Error>

Send a write command or buffer blockingly over SUBGHZSPI.

Source

pub fn blocking_read(&mut self, words: &mut [u8]) -> Result<(), Error>

Read data blockingly from SUBGHZSPI.

Source

pub fn blocking_transfer( &mut self, read: &mut [u8], write: &[u8], ) -> Result<(), Error>

Perform a full-duplex blocking transfer over SUBGHZSPI.

Source

pub fn blocking_transfer_in_place( &mut self, words: &mut [u8], ) -> Result<(), Error>

Perform an in-place blocking transfer over SUBGHZSPI.

Trait Implementations§

Source§

impl<'d, M: Mode> ErrorType for SubghzSpi<'d, M>

Source§

type Error = Error

Error type.
Source§

impl<'d, M: Mode> SpiDevice for SubghzSpi<'d, M>

Source§

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>

Do a read within a transaction. Read more
Source§

fn write(&mut self, buf: &[Word]) -> Result<(), Self::Error>

Do a write within a transaction. Read more
Source§

fn transfer( &mut self, read: &mut [Word], write: &[Word], ) -> Result<(), Self::Error>

Do a transfer within a transaction. Read more
Source§

fn transfer_in_place(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>

Do an in-place transfer within a transaction. Read more
Source§

impl<'d> SpiDevice for SubghzSpi<'d, Async>

Source§

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>

Do a read within a transaction. Read more
Source§

async fn write(&mut self, buf: &[Word]) -> Result<(), Self::Error>

Do a write within a transaction. Read more
Source§

async fn transfer( &mut self, read: &mut [Word], write: &[Word], ) -> Result<(), Self::Error>

Do a transfer within a transaction. Read more
Source§

async fn transfer_in_place( &mut self, buf: &mut [Word], ) -> Result<(), Self::Error>

Do an in-place transfer 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>
where Spi<'d, M, Master>: Freeze,

§

impl<'d, M> Move for SubghzSpi<'d, M>

§

impl<'d, M> Send for SubghzSpi<'d, M>
where Spi<'d, M, Master>: Send,

§

impl<'d, M> Sync for SubghzSpi<'d, M>
where Spi<'d, M, Master>: Sync,

§

impl<'d, M> Unpin for SubghzSpi<'d, M>
where Spi<'d, M, Master>: Unpin,

§

impl<'d, M> UnsafeUnpin for SubghzSpi<'d, M>
where Spi<'d, M, Master>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.