diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index 577eb60c..41f5ce59 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs @@ -251,6 +251,8 @@ fn main() { (("spi", "MISO"), (quote!(crate::spi::MisoPin), quote!())), (("i2c", "SDA"), (quote!(crate::i2c::SdaPin), quote!())), (("i2c", "SCL"), (quote!(crate::i2c::SclPin), quote!())), + (("rcc", "MCO_1"), (quote!(crate::rcc::McoPin), quote!())), + (("rcc", "MCO_2"), (quote!(crate::rcc::McoPin), quote!())), (("dcmi", "D0"), (quote!(crate::dcmi::D0Pin), quote!())), (("dcmi", "D1"), (quote!(crate::dcmi::D1Pin), quote!())), (("dcmi", "D2"), (quote!(crate::dcmi::D2Pin), quote!())), @@ -427,10 +429,20 @@ fn main() { for pin in p.pins { let key = (regs.kind, pin.signal); if let Some((tr, cfgs)) = signals.get(&key) { - let peri = format_ident!("{}", p.name); + let mut peri = format_ident!("{}", p.name); let pin_name = format_ident!("{}", pin.pin); let af = pin.af.unwrap_or(0); + // MCO is special + if pin.signal.starts_with("MCO_") { + // Supported in H7 only for now + if regs.version == "h7" { + peri = format_ident!("{}", pin.signal.replace("_", "")); + } else { + continue; + } + } + g.extend(quote! { #cfgs pin_trait_impl!(#tr, #peri, #pin_name, #af); diff --git a/embassy-stm32/src/rcc/h7.rs b/embassy-stm32/src/rcc/h7.rs index 73ad3863..d2668525 100644 --- a/embassy-stm32/src/rcc/h7.rs +++ b/embassy-stm32/src/rcc/h7.rs @@ -348,15 +348,6 @@ macro_rules! impl_peri { impl_peri!(MCO1, Mco1, set_mco1, set_mco1pre); impl_peri!(MCO2, Mco2, set_mco2, set_mco2pre); -crate::pac::peripheral_pins!( - ($inst:ident, rcc, RCC, $pin:ident, MCO_1, $af:expr) => { - pin_trait_impl!(crate::rcc::McoPin, MCO1, $pin, $af); - }; - ($inst:ident, rcc, RCC, $pin:ident, MCO_2, $af:expr) => { - pin_trait_impl!(crate::rcc::McoPin, MCO2, $pin, $af); - }; -); - pub struct Mco<'d, T: McoInstance> { phantom: PhantomData<&'d mut T>, }