pub struct Spi<SPI, Disabled, Pins> { /* private fields */ }
Expand description
Spi Peripheral Interface
Implementations§
Source§impl Spi<SPI0, Disabled, DefaultPins>
impl Spi<SPI0, Disabled, DefaultPins>
Sourcepub 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
Sourcepub 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
Source§impl Spi<SPI0, Disabled, AltPins>
impl Spi<SPI0, Disabled, AltPins>
Source§impl Spi<SPI1, Disabled, DefaultPins>
impl Spi<SPI1, Disabled, DefaultPins>
Sourcepub 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
Sourcepub 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
Source§impl<Pins, Mode> Spi<SPI0, Enabled<Mode>, Pins>
impl<Pins, Mode> Spi<SPI0, Enabled<Mode>, Pins>
Sourcepub fn set_baudrate(&self, baudrate: Hertz, bus_freq: Hertz)
pub fn set_baudrate(&self, baudrate: Hertz, bus_freq: Hertz)
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.
Sourcepub fn set_baudrate_divisor(&self, divisor: &BaudrateDivisor)
pub fn set_baudrate_divisor(&self, divisor: &BaudrateDivisor)
Set the baud rate by directly setting the divisor
Sourcepub fn baudrate_divisor(&self) -> BaudrateDivisor
pub fn baudrate_divisor(&self) -> BaudrateDivisor
Get the current baudrate divisor
Sourcepub fn mode_fault(&self) -> bool
pub fn mode_fault(&self) -> bool
Check if mode fault occured
Source§impl<Mode, Pins> Spi<SPI0, Mode, Pins>
impl<Mode, Pins> Spi<SPI0, Mode, Pins>
Sourcepub fn read_ready(&self) -> bool
pub fn read_ready(&self) -> bool
Check if read buffer full (ready to read)
Sourcepub fn read_matches(&self) -> bool
pub fn read_matches(&self) -> bool
Check if read matches value in match register
Sourcepub fn send_ready(&self) -> bool
pub fn send_ready(&self) -> bool
Check if transmit buffer empty (ready to send)
Sourcepub fn set_hw_match(&self, value: u8)
pub fn set_hw_match(&self, value: u8)
Set the value for hardware read match
Source§impl<Pins, Mode> Spi<SPI1, Enabled<Mode>, Pins>
impl<Pins, Mode> Spi<SPI1, Enabled<Mode>, Pins>
Sourcepub fn set_baudrate(&self, baudrate: Hertz, bus_freq: Hertz)
pub fn set_baudrate(&self, baudrate: Hertz, bus_freq: Hertz)
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.
Sourcepub fn set_baudrate_divisor(&self, divisor: &BaudrateDivisor)
pub fn set_baudrate_divisor(&self, divisor: &BaudrateDivisor)
Set the baud rate by directly setting the divisor
Sourcepub fn baudrate_divisor(&self) -> BaudrateDivisor
pub fn baudrate_divisor(&self) -> BaudrateDivisor
Get the current baudrate divisor
Sourcepub fn mode_fault(&self) -> bool
pub fn mode_fault(&self) -> bool
Check if mode fault occured
Source§impl<Mode, Pins> Spi<SPI1, Mode, Pins>
impl<Mode, Pins> Spi<SPI1, Mode, Pins>
Sourcepub fn read_ready(&self) -> bool
pub fn read_ready(&self) -> bool
Check if read buffer full (ready to read)
Sourcepub fn read_matches(&self) -> bool
pub fn read_matches(&self) -> bool
Check if read matches value in match register
Sourcepub fn send_ready(&self) -> bool
pub fn send_ready(&self) -> bool
Check if transmit buffer empty (ready to send)
Sourcepub fn set_hw_match(&self, value: u8)
pub fn set_hw_match(&self, value: u8)
Set the value for hardware read match