pub struct SpiPeripheral<'a, S: SpiSlaveDevice<'a>> { /* private fields */ }
Implementations§
Source§impl<'a, S: SpiSlaveDevice<'a>> SpiPeripheral<'a, S>
impl<'a, S: SpiSlaveDevice<'a>> SpiPeripheral<'a, S>
pub fn new( spi_slave: &'a S, grants: Grant<PeripheralApp, UpcallCount<2>, AllowRoCount<{ ro_allow::COUNT }>, AllowRwCount<{ rw_allow::COUNT }>>, ) -> SpiPeripheral<'a, S>
pub fn config_buffers(&self, read: &'static mut [u8], write: &'static mut [u8])
Trait Implementations§
Source§impl<'a, S: SpiSlaveDevice<'a>> SpiSlaveClient for SpiPeripheral<'a, S>
impl<'a, S: SpiSlaveDevice<'a>> SpiSlaveClient for SpiPeripheral<'a, S>
Source§fn read_write_done(
&self,
writebuf: Option<&'static mut [u8]>,
readbuf: Option<&'static mut [u8]>,
length: usize,
_status: Result<(), ErrorCode>,
)
fn read_write_done( &self, writebuf: Option<&'static mut [u8]>, readbuf: Option<&'static mut [u8]>, length: usize, _status: Result<(), ErrorCode>, )
Callback issued when the controller completes an SPI operation to this
peripheral. Read more
Source§fn chip_selected(&self)
fn chip_selected(&self)
Notification that the chip select has been brought low.
Source§impl<'a, S: SpiSlaveDevice<'a>> SyscallDriver for SpiPeripheral<'a, S>
impl<'a, S: SpiSlaveDevice<'a>> SyscallDriver for SpiPeripheral<'a, S>
Source§fn command(
&self,
command_num: usize,
arg1: usize,
_: usize,
process_id: ProcessId,
) -> CommandReturn
fn command( &self, command_num: usize, arg1: usize, _: usize, process_id: ProcessId, ) -> CommandReturn
Provide read/write buffers to SpiPeripheral
-
allow_num 0: Provides a buffer to receive transfers into. Provide read-only buffers to SpiPeripheral
-
allow_num 0: Provides a buffer to transmit
-
0: driver existence check
-
1: read/write buffers
- read and write buffers optional
- fails if arg1 (bytes to write) > write_buffer.len()
-
2: get chip select
- returns current selected peripheral
- in slave mode, always returns 0
-
3: set clock phase on current peripheral
- 0 is sample leading
- non-zero is sample trailing
-
4: get clock phase on current peripheral
- 0 is sample leading
- non-zero is sample trailing
-
5: set clock polarity on current peripheral
- 0 is idle low
- non-zero is idle high
-
6: get clock polarity on current peripheral
- 0 is idle low
- non-zero is idle high
-
x: lock spi
- if you perform an operation without the lock, it implicitly acquires the lock before the operation and releases it after
- while an app holds the lock no other app can issue operations on SPI (they are buffered)
- not implemented or currently supported
-
x+1: unlock spi
- does nothing if lock not held
- not implemented or currently supported
Source§fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>
fn allocate_grant(&self, processid: ProcessId) -> Result<(), Error>
Request to allocate a capsule’s grant for a specific process. Read more
Source§fn allow_userspace_readable(
&self,
app: ProcessId,
which: usize,
slice: ReadWriteProcessBuffer,
) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>
fn allow_userspace_readable( &self, app: ProcessId, which: usize, slice: ReadWriteProcessBuffer, ) -> Result<ReadWriteProcessBuffer, (ReadWriteProcessBuffer, ErrorCode)>
System call for a process to pass a buffer (a
UserspaceReadableProcessBuffer
) to the kernel that the kernel can
either read or write. The kernel calls this method only after it checks
that the entire buffer is within memory the process can both read and
write. Read moreAuto Trait Implementations§
impl<'a, S> !Freeze for SpiPeripheral<'a, S>
impl<'a, S> !RefUnwindSafe for SpiPeripheral<'a, S>
impl<'a, S> !Send for SpiPeripheral<'a, S>
impl<'a, S> !Sync for SpiPeripheral<'a, S>
impl<'a, S> Unpin for SpiPeripheral<'a, S>
impl<'a, S> !UnwindSafe for SpiPeripheral<'a, S>
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