# SPIImpl in k210_soc::spi - Rust
API documentation for the Rust `SPIImpl` struct in crate `k210_soc`.
Keywords: rust, rustlang, rust-lang, SPIImpl

# Struct k210_soc::spi::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> 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,

const: unstable · source

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more

source

### impl<T> BorrowMut<T> for T where
T: ?Sized,

const: unstable · source

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more

source

### impl<T> From<T> for T

const: unstable · source

#### fn from(t: T) -> T

Returns the argument unchanged.

source

### impl<T, U> Into<U> for T where
U: From<T>,

const: unstable · 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>,

#### type Error = Infallible

The type returned in the event of a conversion error.

const: unstable · 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>,

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

const: unstable · source

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.