pub struct SpiConfig { /* private fields */ }Expand description
Bus configuration passed to Spi::new / Spi::new_word.
Built with SpiConfig::new, which requires a prescaler; mode
and bit_order refine the defaults fluently.
ⓘ
SpiConfig::new(SpiPsc::Div16)
.mode(embedded_hal::spi::MODE_3)
.bit_order(BitOrder::LsbFirst)Implementations§
Source§impl SpiConfig
impl SpiConfig
Sourcepub const fn new(psc: SpiPsc) -> Self
pub const fn new(psc: SpiPsc) -> Self
Creates a configuration with the given prescaler, Mode 0 and MSB-first.
The prescaler is a required argument: an SCK divider has no conventional value.
Sourcepub const fn mode(self, mode: Mode) -> Self
pub const fn mode(self, mode: Mode) -> Self
Sets the clock polarity and phase (CPOL/CPHA), per the slave’s datasheet.
Sourcepub const fn bit_order(self, bit_order: BitOrder) -> Self
pub const fn bit_order(self, bit_order: BitOrder) -> Self
Sets the bit order. Defaults to BitOrder::MsbFirst.
Trait Implementations§
impl Copy for SpiConfig
impl Eq for SpiConfig
impl StructuralPartialEq for SpiConfig
Auto Trait Implementations§
impl Freeze for SpiConfig
impl RefUnwindSafe for SpiConfig
impl Send for SpiConfig
impl Sync for SpiConfig
impl Unpin for SpiConfig
impl UnsafeUnpin for SpiConfig
impl UnwindSafe for SpiConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more