macro_rules! periph_alias {
($peripherals:ident . spi_sercom) => { ... };
($peripherals:ident . i2c_sercom) => { ... };
($peripherals:ident . sd_sercom) => { ... };
($peripherals:ident . uart_sercom) => { ... };
}Expand description
Refer to fields of the Peripherals
struct by alternate names
This macro can be used to access fields of the Peripherals
struct by alternate names. The available aliases are:
SERCOM1can be refered to with the type aliasSpiSercomand accessed as the field namespi_sercomSERCOM2can be refered to with the type aliasI2cSercomand accessed as the field namei2c_sercomSERCOM4can be refered to with the type aliasSdSercomand accessed as the field namesd_sercomSERCOM5can be refered to with the type aliasUartSercomand accessed as the field nameuart_sercom
For example. suppose display_spi were an alternate name for
the SERCOM4 peripheral. You could use the periph_alias!
macro to access it like this:
let mut peripherals = pac::Peripherals::take().unwrap();
// Replace this
let display_spi = peripherals.SERCOM4;
// With this
let display_spi = periph_alias!(peripherals.display_spi);