Macro circuit_playground_express::pin_alias [−][src]
macro_rules! pin_alias {
($pins : ident.uart_rx) => { ... };
($pins : ident.uart_tx) => { ... };
($pins : ident.red_led) => { ... };
($pins : ident.sda) => { ... };
($pins : ident.scl) => { ... };
($pins : ident.neo_pixel) => { ... };
($pins : ident.speaker) => { ... };
($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) => { ... };
}
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);