Struct RegisterBlock

Source
#[repr(C)]
pub struct RegisterBlock { pub cr1: u32, pub cr2: u32, pub sr: u32, pub dr: u32, pub crcpr: u32, pub rxcrcr: u32, pub txcrcr: u32, pub i2scfgr: u32, pub i2spr: u32, }

Fields§

§cr1: u32§cr2: u32§sr: u32§dr: u32§crcpr: u32§rxcrcr: u32§txcrcr: u32§i2scfgr: u32§i2spr: u32

Implementations§

Source§

impl RegisterBlock

Source

pub fn enable(&mut self)

Enable SPI

Source

pub fn disable(&mut self)

Disable SPI

Source

pub fn set_mode(&mut self, mode: SpiMode)

Set SPI mode (CPOL/CPHA)

Source

pub fn set_master(&mut self)

Set master mode

Source

pub fn set_slave(&mut self)

Set slave mode

Source

pub fn set_baud_rate(&mut self, baudrate: SpiBaudRate)

Set baud rate prescaler

Source

pub fn is_tx_empty(&self) -> bool

Check if transmit buffer is empty

Source

pub fn is_rx_not_empty(&self) -> bool

Check if receive buffer is not empty

Source

pub fn is_busy(&self) -> bool

Check if SPI is busy

Source

pub fn write_data(&mut self, data: u16)

Write data

Source

pub fn read_data(&self) -> u16

Read data

Source

pub fn transfer_byte(&mut self, data: u8) -> u8

Transfer a single byte (blocking)

Auto Trait Implementations§

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.