Struct SpiHost

Source
pub struct SpiHost<'a> { /* private fields */ }

Implementations§

Source§

impl SpiHost<'_>

Source

pub fn new(base: StaticRef<SpiHostRegisters>, cpu_clk: u32) -> Self

Source

pub fn handle_interrupt(&self)

Trait Implementations§

Source§

impl<'a> SpiMaster<'a> for SpiHost<'a>

Source§

fn hold_low(&self)

hold_low is controlled by IP based on command segments issued force holds are not supported

Source§

fn release_low(&self)

release_low is controlled by IP based on command segments issued force releases are not supported

Source§

type ChipSelect = CS

Chip select is an associated type because different SPI buses may have different numbers of chip selects. This allows peripheral implementations to define their own type.
Source§

fn init(&self) -> Result<(), ErrorCode>

Initialize this SPI interface. Call this once before invoking any other operations. Read more
Source§

fn set_client(&self, client: &'a dyn SpiMasterClient)

Change the callback handler for SpiMaster::read_write_bytes calls.
Source§

fn is_busy(&self) -> bool

Return whether the SPI peripheral is busy with a SpiMaster::read_write_bytes operation.
Source§

fn read_write_bytes( &self, tx_buf: SubSliceMut<'static, u8>, rx_buf: Option<SubSliceMut<'static, u8>>, ) -> Result<(), (ErrorCode, SubSliceMut<'static, u8>, Option<SubSliceMut<'static, u8>>)>

Perform an asynchronous read/write operation, whose completion is signaled by invoking SpiMasterClient on the client. Write-only operations may pass None for read_buffer, while read-write operations pass Some for read_buffer. Read more
Source§

fn write_byte(&self, _val: u8) -> Result<(), ErrorCode>

Synchronously write a single byte on the bus. Not for general use because it is blocking: intended for debugging. Read more
Source§

fn read_byte(&self) -> Result<u8, ErrorCode>

Synchronously write a 0 and read a single byte from the bus. Not for general use because it is blocking: intended for debugging. Read more
Source§

fn read_write_byte(&self, _val: u8) -> Result<u8, ErrorCode>

Synchronously write and read a single byte. Not for general use because it is blocking: intended for debugging. Read more
Source§

fn specify_chip_select(&self, cs: Self::ChipSelect) -> Result<(), ErrorCode>

Specify which chip select to use. Configuration settings (rate, polarity, phase) are chip-select specific and are stored for that chip select.
Source§

fn set_rate(&self, rate: u32) -> Result<u32, ErrorCode>

Set the clock/data rate for the current chip select. Read more
Source§

fn get_rate(&self) -> u32

Return the current chip select’s clock rate.
Source§

fn set_polarity(&self, polarity: ClockPolarity) -> Result<(), ErrorCode>

Set the bus polarity (whether idle is high or low) for the current chip select. Read more
Source§

fn get_polarity(&self) -> ClockPolarity

Return the current bus polarity.
Source§

fn set_phase(&self, phase: ClockPhase) -> Result<(), ErrorCode>

Set the bus phase for the current chip select (whether data is sent/received on leading or trailing edges). Read more
Source§

fn get_phase(&self) -> ClockPhase

Get the current bus phase for the current chip select.

Auto Trait Implementations§

§

impl<'a> !Freeze for SpiHost<'a>

§

impl<'a> !RefUnwindSafe for SpiHost<'a>

§

impl<'a> !Send for SpiHost<'a>

§

impl<'a> !Sync for SpiHost<'a>

§

impl<'a> Unpin for SpiHost<'a>

§

impl<'a> !UnwindSafe for SpiHost<'a>

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.