pub fn lpspi<Sdo, Sdi, Sck, Pcs0, const N: u8>(
instance: Instance<N>,
pins: LpspiPins<Sdo, Sdi, Sck, Pcs0>,
baud: u32,
) -> Lpspi<LpspiPins<Sdo, Sdi, Sck, Pcs0>, N>where
Sdo: Pin<Signal = Sdo, Module = Const<N>>,
Sdi: Pin<Signal = Sdi, Module = Const<N>>,
Sck: Pin<Signal = Sck, Module = Const<N>>,
Pcs0: Pin<Signal = Pcs0, Module = Const<N>>,
Expand description
Create a LPSPI peripheral.
baud
is the SCK frequency, in Hz. Consider using explicit type annotations, as demonstrated
below, to simplify any errors from the compiler.
This helper assumes that the LPSPI clock frequency equals LPSPI_FREQUENCY
.
use teensy4_bsp as bsp;
use bsp::board;
let board::T40Resources { lpspi4, pins, .. }
= board::t40(board::instances());
let mut lpspi4: board::Lpspi4 = board::lpspi(
lpspi4,
board::LpspiPins {
sdo: pins.p11,
sdi: pins.p12,
sck: pins.p13,
pcs0: pins.p10,
},
1_000_000,
);