Struct kea_hal::spi::Spi [−][src]
pub struct Spi<SPI, Disabled, Pins> { /* fields omitted */ }
Expand description
Spi Peripheral Interface
Implementations
pub fn enable_as_controller<T2, T3, T4, T5>(
self,
clock: PTB2<T2>,
sdo: PTB3<T3>,
sdi: PTB4<T4>,
cs: Option<PTB5<T5>>,
manage_cs: bool,
mode: Mode
) -> Spi<SPI0, Controller, DefaultPins>
pub fn enable_as_controller<T2, T3, T4, T5>(
self,
clock: PTB2<T2>,
sdo: PTB3<T3>,
sdi: PTB4<T4>,
cs: Option<PTB5<T5>>,
manage_cs: bool,
mode: Mode
) -> Spi<SPI0, Controller, DefaultPins>
Enable SPI0 with default pins
pub fn enable_as_peripheral<T2, T3, T4, T5>(
self,
clock: PTB2<T2>,
sdi: PTB3<T3>,
sdo: PTB4<T4>,
cs: PTB5<T5>,
mode: Mode
) -> Spi<SPI0, Enabled<Peripheral>, DefaultPins>
pub fn enable_as_peripheral<T2, T3, T4, T5>(
self,
clock: PTB2<T2>,
sdi: PTB3<T3>,
sdo: PTB4<T4>,
cs: PTB5<T5>,
mode: Mode
) -> Spi<SPI0, Enabled<Peripheral>, DefaultPins>
Enable SPI0 in peripheral mode with Alternate Pins
Enable SPI0 in controller mode with Alternate Pins
pub fn enable_as_controller<T0, T1, T2, T3>(
self,
clock: PTD0<T0>,
sdo: PTD1<T1>,
sdi: PTD2<T2>,
cs: Option<PTD3<T3>>,
manage_cs: bool,
mode: Mode
) -> Spi<SPI1, Enabled<Controller>, DefaultPins>
pub fn enable_as_controller<T0, T1, T2, T3>(
self,
clock: PTD0<T0>,
sdo: PTD1<T1>,
sdi: PTD2<T2>,
cs: Option<PTD3<T3>>,
manage_cs: bool,
mode: Mode
) -> Spi<SPI1, Enabled<Controller>, DefaultPins>
Enable SPI1 as the controller with default pins
When manage_cs is set (and the cs pin has been provided) SPI1 will automatically drive the CS pin when doing SPI transfers. If manage_cs is not set, then this pin is used to detect if there is another Controller on the bus, which throws the Master Mode Fault flag
pub fn enable_as_peripheral<T0, T1, T2, T3>(
self,
clock: PTD0<T0>,
sdi: PTD1<T1>,
sdo: PTD2<T2>,
cs: PTD3<T3>,
mode: Mode
) -> Spi<SPI1, Enabled<Peripheral>, DefaultPins>
pub fn enable_as_peripheral<T0, T1, T2, T3>(
self,
clock: PTD0<T0>,
sdi: PTD1<T1>,
sdo: PTD2<T2>,
cs: PTD3<T3>,
mode: Mode
) -> Spi<SPI1, Enabled<Peripheral>, DefaultPins>
Enable SPI1 as peripheral with default pins
Set the baud rate of transmission
This is only used when the MCU is the bus Controller. This relies on accurately inputting the bus frequency until a way to share the current bus frequency is worked out.
Set the baud rate by directly setting the divisor
Get the current baudrate divisor
Check if mode fault occured
Check if read buffer full (ready to read)
Check if read matches value in match register
Check if transmit buffer empty (ready to send)
Set the value for hardware read match
Set the baud rate of transmission
This is only used when the MCU is the bus Controller. This relies on accurately inputting the bus frequency until a way to share the current bus frequency is worked out.
Set the baud rate by directly setting the divisor
Get the current baudrate divisor
Check if mode fault occured
Check if read buffer full (ready to read)
Check if read matches value in match register
Check if transmit buffer empty (ready to send)
Set the value for hardware read match