k210_soc::spi

Struct SPIImpl

Source
pub struct SPIImpl<IF> { /* private fields */ }

Implementations§

Source§

impl<IF: SPI01> SPIImpl<IF>

Source

pub fn new(spi: IF) -> Self

Trait Implementations§

Source§

impl<IF: SPI01> SPI for SPIImpl<IF>

Source§

fn configure( &self, work_mode: work_mode, frame_format: frame_format, data_bit_length: u8, endian: u32, instruction_length: u8, address_length: u8, wait_cycles: u8, instruction_address_trans_mode: aitm, tmod: tmod, )

Configure SPI transaction

Source§

fn set_clk_rate(&self, spi_clk: u32) -> u32

Set SPI clock rate

Source§

fn recv_data<X: TruncU32>(&self, chip_select: u32, rx: &mut [X])

Receive arbitrary data

Source§

fn recv_data_dma( &self, dmac: &DMAC, channel_num: dma_channel, chip_select: u32, rx: &mut [u32], )

Receive 32-bit data using DMA.

Source§

fn send_data<X: Into<u32> + Copy>(&self, chip_select: u32, tx: &[X])

Send arbitrary data

Source§

fn send_data_dma( &self, dmac: &DMAC, channel_num: dma_channel, chip_select: u32, tx: &[u32], )

Send 32-bit data using DMA. If you want to use this function to send 8-bit or 16-bit data, you need to wrap each data unit in a 32-bit word. This is intentionally left to the caller: the difficulty here is to avoid the need for alloc/freeing() buffers every time as the SDK does because this is highly undesirable!

Source§

fn fill_data(&self, chip_select: u32, value: u32, tx_len: usize)

Send repeated data

Source§

fn fill_data_dma( &self, dmac: &DMAC, channel_num: dma_channel, chip_select: u32, value: u32, tx_len: usize, )

Send repeated data (using DMA)

Auto Trait Implementations§

§

impl<IF> Freeze for SPIImpl<IF>
where IF: Freeze,

§

impl<IF> RefUnwindSafe for SPIImpl<IF>
where IF: RefUnwindSafe,

§

impl<IF> Send for SPIImpl<IF>
where IF: Send,

§

impl<IF> Sync for SPIImpl<IF>
where IF: Sync,

§

impl<IF> Unpin for SPIImpl<IF>
where IF: Unpin,

§

impl<IF> UnwindSafe for SPIImpl<IF>
where IF: UnwindSafe,

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.