pub struct SPI<Miso, Mosi, Sck, Timer>{ /* private fields */ }Expand description
A Full-Duplex SPI implementation, takes 3 pins, and a timer running at 2x the desired SPI frequency.
Implementations§
Source§impl<Miso, Mosi, Sck, Timer, E> SPI<Miso, Mosi, Sck, Timer>
impl<Miso, Mosi, Sck, Timer, E> SPI<Miso, Mosi, Sck, Timer>
Sourcepub fn set_bit_order(&mut self, order: BitOrder)
pub fn set_bit_order(&mut self, order: BitOrder)
Set transmission bit order
Sourcepub fn access_timer<F>(&mut self, f: F)where
F: FnOnce(Timer) -> Timer,
pub fn access_timer<F>(&mut self, f: F)where
F: FnOnce(Timer) -> Timer,
Allows for an access to the timer type. This can be used to change the speed.
In closure you get ownership of the timer so you can destruct it and build it up again if necessary.
§Example
spi.access_timer(|mut timer| {
timer.set_freq(4.mhz());
timer
});Trait Implementations§
Source§impl<Miso, Mosi, Sck, Timer, E> FullDuplex<u8> for SPI<Miso, Mosi, Sck, Timer>
impl<Miso, Mosi, Sck, Timer, E> FullDuplex<u8> for SPI<Miso, Mosi, Sck, Timer>
impl<Miso, Mosi, Sck, Timer, E> Default<u8> for SPI<Miso, Mosi, Sck, Timer>
impl<Miso, Mosi, Sck, Timer, E> Default<u8> for SPI<Miso, Mosi, Sck, Timer>
Auto Trait Implementations§
impl<Miso, Mosi, Sck, Timer> Freeze for SPI<Miso, Mosi, Sck, Timer>
impl<Miso, Mosi, Sck, Timer> RefUnwindSafe for SPI<Miso, Mosi, Sck, Timer>
impl<Miso, Mosi, Sck, Timer> Send for SPI<Miso, Mosi, Sck, Timer>
impl<Miso, Mosi, Sck, Timer> Sync for SPI<Miso, Mosi, Sck, Timer>
impl<Miso, Mosi, Sck, Timer> Unpin for SPI<Miso, Mosi, Sck, Timer>
impl<Miso, Mosi, Sck, Timer> UnwindSafe for SPI<Miso, Mosi, Sck, Timer>
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