Refactor SPI signal pin macro.
This commit is contained in:
parent
3dd497c1e6
commit
c00a85f9a9
@ -84,34 +84,28 @@ crate::pac::peripherals!(
|
|||||||
};
|
};
|
||||||
);
|
);
|
||||||
|
|
||||||
crate::pac::peripheral_pins!(
|
macro_rules! impl_pin {
|
||||||
($inst:ident, spi, SPI, $pin:ident, SCK, $af:expr) => {
|
($inst:ident, $pin:ident, $signal:ident, $af:expr) => {
|
||||||
impl SckPin<peripherals::$inst> for peripherals::$pin {}
|
impl $signal<peripherals::$inst> for peripherals::$pin {}
|
||||||
|
|
||||||
impl sealed::SckPin<peripherals::$inst> for peripherals::$pin {
|
impl sealed::$signal<peripherals::$inst> for peripherals::$pin {
|
||||||
fn af_num(&self) -> u8 {
|
fn af_num(&self) -> u8 {
|
||||||
$af
|
$af
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
crate::pac::peripheral_pins!(
|
||||||
|
($inst:ident, spi, SPI, $pin:ident, SCK, $af:expr) => {
|
||||||
|
impl_pin!($inst, $pin, SckPin, $af);
|
||||||
|
};
|
||||||
|
|
||||||
($inst:ident, spi, SPI, $pin:ident, MOSI, $af:expr) => {
|
($inst:ident, spi, SPI, $pin:ident, MOSI, $af:expr) => {
|
||||||
impl MosiPin<peripherals::$inst> for peripherals::$pin {}
|
impl_pin!($inst, $pin, MosiPin, $af);
|
||||||
|
|
||||||
impl sealed::MosiPin<peripherals::$inst> for peripherals::$pin {
|
|
||||||
fn af_num(&self) -> u8 {
|
|
||||||
$af
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
($inst:ident, spi, SPI, $pin:ident, MISO, $af:expr) => {
|
($inst:ident, spi, SPI, $pin:ident, MISO, $af:expr) => {
|
||||||
impl MisoPin<peripherals::$inst> for peripherals::$pin {}
|
impl_pin!($inst, $pin, MisoPin, $af);
|
||||||
|
|
||||||
impl sealed::MisoPin<peripherals::$inst> for peripherals::$pin {
|
|
||||||
fn af_num(&self) -> u8 {
|
|
||||||
$af
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user