Refactor some I2c signal pin macro.
This commit is contained in:
parent
00892c7362
commit
3dd497c1e6
@ -51,24 +51,24 @@ crate::pac::peripherals!(
|
|||||||
};
|
};
|
||||||
);
|
);
|
||||||
|
|
||||||
crate::pac::peripheral_pins!(
|
macro_rules! impl_pin {
|
||||||
($inst:ident, i2c, I2C, $pin:ident, SDA, $af:expr) => {
|
($inst:ident, $pin:ident, $signal:ident, $af:expr) => {
|
||||||
impl SdaPin<peripherals::$inst> for peripherals::$pin {}
|
impl $signal<peripherals::$inst> for peripherals::$pin {}
|
||||||
|
|
||||||
impl sealed::SdaPin<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, i2c, I2C, $pin:ident, SDA, $af:expr) => {
|
||||||
|
impl_pin!($inst, $pin, SdaPin, $af);
|
||||||
|
};
|
||||||
|
|
||||||
($inst:ident, i2c, I2C, $pin:ident, SCL, $af:expr) => {
|
($inst:ident, i2c, I2C, $pin:ident, SCL, $af:expr) => {
|
||||||
impl SclPin<peripherals::$inst> for peripherals::$pin {}
|
impl_pin!($inst, $pin, SclPin, $af);
|
||||||
|
|
||||||
impl sealed::SclPin<peripherals::$inst> for peripherals::$pin {
|
|
||||||
fn af_num(&self) -> u8 {
|
|
||||||
$af
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user