Trait kernel::hil::spi::SpiSlaveDevice
source · pub trait SpiSlaveDevice<'a> {
// Required methods
fn set_client(&self, client: &'a dyn SpiSlaveClient);
fn configure(
&self,
cpol: ClockPolarity,
cpal: ClockPhase,
) -> Result<(), ErrorCode>;
fn read_write_bytes(
&self,
write_buffer: Option<&'static mut [u8]>,
read_buffer: Option<&'static mut [u8]>,
len: usize,
) -> Result<(), (ErrorCode, Option<&'static mut [u8]>, Option<&'static mut [u8]>)>;
fn set_polarity(&self, polarity: ClockPolarity) -> Result<(), ErrorCode>;
fn get_polarity(&self) -> ClockPolarity;
fn set_phase(&self, phase: ClockPhase) -> Result<(), ErrorCode>;
fn get_phase(&self) -> ClockPhase;
}
Expand description
An interface to a SPI bus in peripheral mode.
It is the standard trait used by services within the kernel: SpiSlave
is
for lower-level access responsible for initializing hardware.
Required Methods§
sourcefn set_client(&self, client: &'a dyn SpiSlaveClient)
fn set_client(&self, client: &'a dyn SpiSlaveClient)
Specify the callback of SpiSlaveDevice::read_write_bytes
operations.
sourcefn configure(
&self,
cpol: ClockPolarity,
cpal: ClockPhase,
) -> Result<(), ErrorCode>
fn configure( &self, cpol: ClockPolarity, cpal: ClockPhase, ) -> Result<(), ErrorCode>
Setup the SPI settings and speed of the bus.
sourcefn read_write_bytes(
&self,
write_buffer: Option<&'static mut [u8]>,
read_buffer: Option<&'static mut [u8]>,
len: usize,
) -> Result<(), (ErrorCode, Option<&'static mut [u8]>, Option<&'static mut [u8]>)>
fn read_write_bytes( &self, write_buffer: Option<&'static mut [u8]>, read_buffer: Option<&'static mut [u8]>, len: usize, ) -> Result<(), (ErrorCode, Option<&'static mut [u8]>, Option<&'static mut [u8]>)>
Same as SpiSlave::read_write_bytes
.
sourcefn set_polarity(&self, polarity: ClockPolarity) -> Result<(), ErrorCode>
fn set_polarity(&self, polarity: ClockPolarity) -> Result<(), ErrorCode>
Same as SpiSlave::set_polarity
.
sourcefn get_polarity(&self) -> ClockPolarity
fn get_polarity(&self) -> ClockPolarity
Return the current bus polarity.
sourcefn set_phase(&self, phase: ClockPhase) -> Result<(), ErrorCode>
fn set_phase(&self, phase: ClockPhase) -> Result<(), ErrorCode>
Same as SpiSlave::set_phase
.
sourcefn get_phase(&self) -> ClockPhase
fn get_phase(&self) -> ClockPhase
Return the current bus phase.