Macro metro_m0::pin_alias

source ·
macro_rules! pin_alias {
    ($pins:ident . a0) => { ... };
    ($pins:ident . a1) => { ... };
    ($pins:ident . a2) => { ... };
    ($pins:ident . a3) => { ... };
    ($pins:ident . a4) => { ... };
    ($pins:ident . a5) => { ... };
    ($pins:ident . d0) => { ... };
    ($pins:ident . d1) => { ... };
    ($pins:ident . d2) => { ... };
    ($pins:ident . d3) => { ... };
    ($pins:ident . d4) => { ... };
    ($pins:ident . d5) => { ... };
    ($pins:ident . d6) => { ... };
    ($pins:ident . d7) => { ... };
    ($pins:ident . d8) => { ... };
    ($pins:ident . d9) => { ... };
    ($pins:ident . d10) => { ... };
    ($pins:ident . d11) => { ... };
    ($pins:ident . d12) => { ... };
    ($pins:ident . d13) => { ... };
    ($pins:ident . sda) => { ... };
    ($pins:ident . scl) => { ... };
    ($pins:ident . neopixel) => { ... };
    ($pins:ident . sck) => { ... };
    ($pins:ident . mosi) => { ... };
    ($pins:ident . miso) => { ... };
    ($pins:ident . flash_sck) => { ... };
    ($pins:ident . flash_mosi) => { ... };
    ($pins:ident . flash_miso) => { ... };
    ($pins:ident . flash_cs) => { ... };
    ($pins:ident . usb_dm) => { ... };
    ($pins:ident . usb_dp) => { ... };
    ($pins:ident . uart_rx) => { ... };
    ($pins:ident . uart_tx) => { ... };
    ($pins:ident . red_led) => { ... };
    ($pins:ident . sda) => { ... };
    ($pins:ident . scl) => { ... };
    ($pins:ident . sclk) => { ... };
    ($pins:ident . mosi) => { ... };
    ($pins:ident . miso) => { ... };
    ($pins:ident . flash_sclk) => { ... };
    ($pins:ident . flash_mosi) => { ... };
    ($pins:ident . flash_miso) => { ... };
    ($pins:ident . flash_cs) => { ... };
    ($pins:ident . usb_dm) => { ... };
    ($pins:ident . usb_dp) => { ... };
}
Expand description

Refer to fields of the Pins struct by alternate names

This macro can be used to access fields of the Pins struct by alternate names. See the Pins documentation for a list of the availabe pin aliases.

For example. suppose spi_mosi were an alternate name for the serial_out pin of the Pins struct. You could use the pin_alias! macro to access it like this:

let mut peripherals = pac::Peripherals::take().unwrap();
let pins = bsp::Pins::new(peripherals.PORT);
// Replace this
let mosi = pins.serial_out;
// With this
let mosi = pin_alias!(pins.spi_mosi);