capsules_core::spi_peripheral

Struct SpiPeripheral

Source
pub struct SpiPeripheral<'a, S: SpiSlaveDevice<'a>> { /* private fields */ }

Implementations§

Source§

impl<'a, S: SpiSlaveDevice<'a>> SpiPeripheral<'a, S>

Source

pub fn new( spi_slave: &'a S, grants: Grant<PeripheralApp, UpcallCount<2>, AllowRoCount<{ ro_allow::COUNT }>, AllowRwCount<{ rw_allow::COUNT }>>, ) -> SpiPeripheral<'a, S>

Source

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>

Source§

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)

Notification that the chip select has been brought low.
Source§

impl<'a, S: SpiSlaveDevice<'a>> SyscallDriver for SpiPeripheral<'a, S>

Source§

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>

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)>

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 more

Auto 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> 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 = 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>,

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.