Struct nrf52840_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,
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: WriteBuffer<Word = W> + 'static,
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.
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: ReadBuffer<Word = TxW> + 'static,
RxB: WriteBuffer<Word = RxW> + 'static,
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.