Struct nrf52832_hal::spis::Spis

source ·
pub struct Spis<T>
where T: Instance,
{ /* private fields */ }
Expand description

Interface to a SPIS instance.

Implementations§

source§

impl<T> Spis<T>
where T: Instance,

source

pub fn new(spis: T, pins: Pins) -> Spis<T>

Takes ownership of the raw SPIS peripheral and relevant pins, returning a safe wrapper.

source

pub fn set_default_char(&self, def: u8) -> &Spis<T>

Sets the ´default´ character (character clocked out in case of an ignored transaction).

source

pub fn set_orc(&self, orc: u8) -> &Spis<T>

Sets the over-read character (character sent on over-read of the transmit buffer).

source

pub fn set_order(&self, order: Order) -> &Spis<T>

Sets bit order.

source

pub fn set_polarity(&self, polarity: Polarity) -> &Spis<T>

Sets serial clock (SCK) polarity.

source

pub fn set_phase(&self, phase: Phase) -> &Spis<T>

Sets serial clock (SCK) phase.

source

pub fn set_mode(&self, mode: Mode) -> &Spis<T>

Sets SPI mode.

source

pub fn enable(&self) -> &Spis<T>

Enables the SPIS instance.

source

pub fn disable(&self) -> &Spis<T>

Disables the SPIS module.

source

pub fn acquire(&self) -> &Spis<T>

Requests acquiring the SPIS semaphore and waits until acquired.

source

pub fn try_acquire(&self) -> Result<&Spis<T>, Error>

Requests acquiring the SPIS semaphore, returning an error if not possible.

Note: The semaphore will still be requested, and will be made available at a later point.

source

pub fn release(&self) -> &Spis<T>

Releases the SPIS semaphore, enabling the SPIS to acquire it.

source

pub fn enable_interrupt(&self, event: SpisEvent) -> &Spis<T>

Enables interrupt for specified event.

source

pub fn disable_interrupt(&self, event: SpisEvent) -> &Spis<T>

Disables interrupt for specified event.

source

pub fn auto_acquire(&self, enabled: bool) -> &Spis<T>

Automatically acquire the semaphore after transfer has ended.

source

pub fn reset_events(&self)

Resets all events.

source

pub fn reset_event(&self, event: SpisEvent)

Resets specified event.

source

pub fn is_event_triggered(&self, event: SpisEvent) -> bool

Checks if specified event has been triggered.

source

pub fn is_done(&self) -> bool

Checks if the granted transfer is done.

source

pub fn is_acquired(&self) -> bool

Checks if the semaphore is acquired.

source

pub fn is_overread(&self) -> bool

Checks if last transaction overread.

source

pub fn is_overflow(&self) -> bool

Checks if last transaction overflowed.

source

pub fn amount(&self) -> u32

Returns number of bytes received in last granted transaction.

source

pub fn semaphore_status(&self) -> SemaphoreStatus

Returns the semaphore status.

source

pub fn event_acquired(&self) -> &Reg<EVENTS_ACQUIRED_SPEC>

Returns reference to Acquired event endpoint for PPI.

source

pub fn event_end(&self) -> &Reg<EVENTS_END_SPEC>

Returns reference to End event endpoint for PPI.

source

pub fn event_end_rx(&self) -> &Reg<EVENTS_ENDRX_SPEC>

Returns reference to EndRx event endpoint for PPI.

source

pub fn task_acquire(&self) -> &Reg<TASKS_ACQUIRE_SPEC>

Returns reference to Acquire task endpoint for PPI.

source

pub fn task_release(&self) -> &Reg<TASKS_RELEASE_SPEC>

Returns reference to Release task endpoint for PPI.

source

pub fn transfer<W, B>( self, buffer: B ) -> Result<Transfer<T, B>, (Error, Spis<T>, B)>
where B: WriteBuffer<Word = W> + 'static,

Full duplex DMA transfer. Transmits the given buffer while simultaneously receiving data into the same buffer until it is filled. Buffer must be located in RAM. Returns a value that represents the in-progress DMA transfer.

source

pub fn transfer_split<TxW, RxW, TxB, RxB>( self, tx_buffer: TxB, rx_buffer: RxB ) -> Result<TransferSplit<T, TxB, RxB>, (Error, Spis<T>, TxB, RxB)>
where TxB: ReadBuffer<Word = TxW> + 'static, RxB: WriteBuffer<Word = RxW> + 'static,

Full duplex DMA transfer. Transmits the given tx_buffer while simultaneously receiving data into the given rx_buffer until it is filled. The buffers must be located in RAM. Returns a value that represents the in-progress DMA transfer.

source

pub fn free(self) -> (T, Pins)

Returns the raw interface to the underlying SPIS peripheral.

Auto Trait Implementations§

§

impl<T> Freeze for Spis<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Spis<T>
where T: RefUnwindSafe,

§

impl<T> Send for Spis<T>
where T: Send,

§

impl<T> Sync for Spis<T>
where T: Sync,

§

impl<T> Unpin for Spis<T>
where T: Unpin,

§

impl<T> UnwindSafe for Spis<T>
where T: UnwindSafe,

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> Az for T

source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

source§

fn cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> CheckedAs for T

source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

source§

fn lossy_into(self) -> Dst

Performs the conversion.
source§

impl<T> OverflowingAs for T

source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> SaturatingAs for T

source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> UnwrappedAs for T

source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
source§

impl<T> WrappingAs for T

source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.