Function teensy4_bsp::board::lpuart

source ·
pub fn lpuart<Tx, Rx, const N: u8>(
    instance: Instance<N>,
    tx: Tx,
    rx: Rx,
    baud: u32
) -> Lpuart<Pins<Tx, Rx>, N>
where Tx: Pin<Direction = Tx, Module = Const<N>>, Rx: Pin<Direction = Rx, Module = Const<N>>,
Expand description

Create a LPUART peripheral.

The specific peripheral you’re creating depends on

  • the type of instance.
  • the TX and RX pins.
  • the return type, which can be explicitly annotated.

Consider using an explicit type annotation to help catch any programming errors.

This helper assumes that the UART clock frequency equals UART_FREQUENCY.

use teensy4_bsp as bsp;
use bsp::board;

let board::T40Resources { lpuart6, lpuart2, pins, .. }
    = board::t40(board::instances());

// Explicit type:
let mut lpuart6: board::Lpuart6 = board::lpuart(
    lpuart6,
    pins.p1,
    pins.p0,
    115200,
);

// Implicit type:
let mut lpuart2 = board::lpuart(lpuart2, pins.p14, pins.p15, 9600);