Module imxrt_iomuxc::imxrt106x [−][src]
imxrt106x
only.Pads for the i.MX RT 106x processor family
The module exports all of the i.MX RT 106x processor’s pads. Pads that can support peripheral
functions are tagged with imxrt-iomuxc
traits.
Example
In the example below, we implement a hypothetical uart_new
function, which is responsible
for preparing a UART peripheral. To properly configure the peripheral, we need the two
pads that represent a peripheral’s TX and RX pins. The implementation will use the
imxrt_iomuxc::uart::prepare()
function to prepare the pins.
Note the trait bounds on uart_new
. The usage requires that
- the user provides one TX and one RX pin
- the modules for each pin match
use imxrt_iomuxc as iomuxc; use iomuxc::uart::{Pin, TX, RX}; /// Creates a UART peripheral from the TX and RX pads, and a baud rate fn uart_new<T, R>(mut tx: T, mut rx: R, baud: u32) -> UART where T: Pin<Direction = TX>, R: Pin<Direction = RX, Module = <T as Pin>::Module>, { // Check the imxrt-iomuxc documentation to understand why // this is unsafe. unsafe { iomuxc::uart::prepare(&mut tx); iomuxc::uart::prepare(&mut rx); } // Prepare the rest of the UART peripheral, and return it... } // AD_B0_13 and AD_B0_12 are a suitable pair of UART pins uart_new(ad_b0_12, ad_b0_13, 115_200);
Specifically, the trait bounds guard against non-UART pins:
// Neither pad is a valid UART pin uart_new(ad_b0_10, ad_b0_11, 115_200);
It also guards against mismatched UART pins:
// AD_B1_02 is a UART2 TX pin, but AD_B0_13 is a UART1 RX pin uart_new(ad_b1_02, ad_b0_13, 115_200);
Modules
ad_b0 | Pads with the prefix ‘AD_B0’ |
ad_b1 | Pads with the prefix ‘AD_B1’ |
b0 | Pads with the prefix ‘B0’ |
b1 | Pads with the prefix ‘B1’ |
emc | Pads with the prefix ‘EMC’ |
sd_b0 | Pads with the prefix ‘SD_B0’ |
sd_b1 | Pads with the prefix ‘SD_B1’ |
Structs
ErasedPads | All of the pads, with all types erased |
Pads | All of the pads |