pub struct Spis<T> where
T: Instance, { /* private fields */ }
Expand description
Interface to a SPIS instance.
Implementations
sourceimpl<T> Spis<T> where
T: Instance,
impl<T> Spis<T> where
T: Instance,
sourcepub fn new(spis: T, pins: Pins) -> Spis<T>
pub fn new(spis: T, pins: Pins) -> Spis<T>
Takes ownership of the raw SPIS peripheral and relevant pins, returning a safe wrapper.
sourcepub fn set_default_char(&self, def: u8) -> &Spis<T>
pub fn set_default_char(&self, def: u8) -> &Spis<T>
Sets the ´default´ character (character clocked out in case of an ignored transaction).
sourcepub fn set_orc(&self, orc: u8) -> &Spis<T>
pub fn set_orc(&self, orc: u8) -> &Spis<T>
Sets the over-read character (character sent on over-read of the transmit buffer).
sourcepub fn set_polarity(&self, polarity: Polarity) -> &Spis<T>
pub fn set_polarity(&self, polarity: Polarity) -> &Spis<T>
Sets serial clock (SCK) polarity.
sourcepub fn acquire(&self) -> &Spis<T>
pub fn acquire(&self) -> &Spis<T>
Requests acquiring the SPIS semaphore and waits until acquired.
sourcepub fn try_acquire(&self) -> Result<&Spis<T>, Error>
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.
sourcepub fn release(&self) -> &Spis<T>
pub fn release(&self) -> &Spis<T>
Releases the SPIS semaphore, enabling the SPIS to acquire it.
sourcepub fn enable_interrupt(&self, event: SpisEvent) -> &Spis<T>
pub fn enable_interrupt(&self, event: SpisEvent) -> &Spis<T>
Enables interrupt for specified event.
sourcepub fn disable_interrupt(&self, event: SpisEvent) -> &Spis<T>
pub fn disable_interrupt(&self, event: SpisEvent) -> &Spis<T>
Disables interrupt for specified event.
sourcepub fn auto_acquire(&self, enabled: bool) -> &Spis<T>
pub fn auto_acquire(&self, enabled: bool) -> &Spis<T>
Automatically acquire the semaphore after transfer has ended.
sourcepub fn reset_events(&self)
pub fn reset_events(&self)
Resets all events.
sourcepub fn reset_event(&self, event: SpisEvent)
pub fn reset_event(&self, event: SpisEvent)
Resets specified event.
sourcepub fn is_event_triggered(&self, event: SpisEvent) -> bool
pub fn is_event_triggered(&self, event: SpisEvent) -> bool
Checks if specified event has been triggered.
sourcepub fn is_acquired(&self) -> bool
pub fn is_acquired(&self) -> bool
Checks if the semaphore is acquired.
sourcepub fn is_overread(&self) -> bool
pub fn is_overread(&self) -> bool
Checks if last transaction overread.
sourcepub fn is_overflow(&self) -> bool
pub fn is_overflow(&self) -> bool
Checks if last transaction overflowed.
sourcepub fn semaphore_status(&self) -> SemaphoreStatus
pub fn semaphore_status(&self) -> SemaphoreStatus
Returns the semaphore status.
sourcepub fn event_acquired(&self) -> &Reg<EVENTS_ACQUIRED_SPEC>
pub fn event_acquired(&self) -> &Reg<EVENTS_ACQUIRED_SPEC>
Returns reference to Acquired
event endpoint for PPI.
sourcepub fn event_end(&self) -> &Reg<EVENTS_END_SPEC>
pub fn event_end(&self) -> &Reg<EVENTS_END_SPEC>
Returns reference to End
event endpoint for PPI.
sourcepub fn event_end_rx(&self) -> &Reg<EVENTS_ENDRX_SPEC>
pub fn event_end_rx(&self) -> &Reg<EVENTS_ENDRX_SPEC>
Returns reference to EndRx
event endpoint for PPI.
sourcepub fn task_acquire(&self) -> &Reg<TASKS_ACQUIRE_SPEC>
pub fn task_acquire(&self) -> &Reg<TASKS_ACQUIRE_SPEC>
Returns reference to Acquire
task endpoint for PPI.
sourcepub fn task_release(&self) -> &Reg<TASKS_RELEASE_SPEC>
pub fn task_release(&self) -> &Reg<TASKS_RELEASE_SPEC>
Returns reference to Release
task endpoint for PPI.
sourcepub fn transfer<W, B>(
self,
buffer: B
) -> Result<Transfer<T, B>, (Error, Spis<T>, B)> where
B: 'static + WriteBuffer<Word = W>,
pub fn transfer<W, B>(
self,
buffer: B
) -> Result<Transfer<T, B>, (Error, Spis<T>, B)> where
B: 'static + WriteBuffer<Word = W>,
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.
sourcepub 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: 'static + ReadBuffer<Word = TxW>,
RxB: 'static + WriteBuffer<Word = RxW>,
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: 'static + ReadBuffer<Word = TxW>,
RxB: 'static + WriteBuffer<Word = RxW>,
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.
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.