teensy4_bsp::board

Function lpi2c

Source
pub fn lpi2c<Scl, Sda, const N: u8>(
    instance: Instance<N>,
    scl: Scl,
    sda: Sda,
    clock_speed: Lpi2cClockSpeed,
) -> Lpi2c<Pins<Scl, Sda>, N>
where Scl: Pin<Signal = Scl, Module = Const<N>>, Sda: Pin<Signal = Sda, Module = Const<N>>,
Expand description

Create a LPI2C peripheral.

Consider using explicit type annotations, as demonstrated below, to simplify any errors from the compiler.

This helper assumes that the actual LPI2C clock frequency equals LPI2C_FREQUENCY.

use teensy4_bsp as bsp;
use bsp::board;

let board::Resources { lpi2c3, pins, ..}
    = board::t40(board::instances());

let mut lpi2c: board::Lpi2c3 = board::lpi2c(
    lpi2c3,
    pins.p16,
    pins.p17,
    board::Lpi2cClockSpeed::KHz400,
);