[][src]Module imxrt_hal::iomuxc

IOMUX Controller

The IOMUXC controller exposes all processor pads as unique GPIO structs. Each GPIO may be transitioned into various alternatives, or modes, that support different use-cases. All GPIOs are defined in the gpio module.

The pin_config module lets users specify pin configurations, like pull-up resistors and pin speeds. See the module-level docs for more information.

Finally, the peripheral-specific modules define type tags for pins, and traits that denote peripheral-compatible pins. Each peripheral-specific module, like spi and uart, defines a Pin trait. The list of trait implementors describe which pad and alternative is needed to support that peripheral. For example, an implementor of the uart::Pin trait is GPIO_AD_B1_02<Alt2>:

impl uart::Pin for GPIO_AD_B1_02<Alt2>
   type Direction = TX
   type Module = _2

The listing indicates that, in the second alternative, GPIO_AD_B1_02 is a UART TX pin for UART2. The HAL's UART peripheral will design to that trait, accepting GPIOs that can satisfy the trait bounds:

use imxrt_hal;

let mut peripherals = imxrt_hal::Peripherals::take().unwrap();

let uarts = peripherals.uart.clock(
    // ...
);

// Use the UART2-compatible pins to create a UART peripheral
let mut uart = uarts
    .uart2
    .init(
        peripherals.iomuxc.gpio_ad_b1_02.alt2(),
        peripherals.iomuxc.gpio_ad_b1_03.alt2(),
        115_200,
    )
    .unwrap();

Modules

gpio

Pad definitions

i2c

I2C pin multiplexing

pin_config

Pin configuration

pwm

PWM pin labels

spi

SPI pin multiplexing

uart

UART pin multiplexing

Structs

Alt0

Pad alternative 0 (type tag)

Alt1

Pad alternative 1 (type tag)

Alt2

Pad alternative 2 (type tag)

Alt3

Pad alternative 3 (type tag)

Alt4

Pad alternative 4 (type tag)

Alt5

Pad alternative 5 (type tag)

Alt6

Pad alternative 6 (type tag)

Alt7

Pad alternative 7 (type tag)

Alt8

Pad alternative 8 (type tag)

Alt9

Pad alternative 9 (type tag)

GPR
IOMUXC