From 1e69a8c48448883fe1c617dc70113dcddd9e1702 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 23 Feb 2022 19:43:32 +0100 Subject: [PATCH] stm32: move pin trait impls from macrotables to build.rs --- embassy-stm32/build.rs | 210 +++++++++++++++++++++++ embassy-stm32/src/can/bxcan.rs | 15 -- embassy-stm32/src/dcmi.rs | 54 ------ embassy-stm32/src/eth/mod.rs | 30 ---- embassy-stm32/src/fmc/pins.rs | 300 --------------------------------- embassy-stm32/src/i2c/mod.rs | 20 --- embassy-stm32/src/pwm/mod.rs | 48 ------ embassy-stm32/src/rcc/h7.rs | 4 +- embassy-stm32/src/sdmmc/v2.rs | 36 ---- embassy-stm32/src/spi/mod.rs | 26 --- embassy-stm32/src/traits.rs | 4 +- embassy-stm32/src/usart/mod.rs | 76 --------- embassy-stm32/src/usb_otg.rs | 56 ------ 13 files changed, 214 insertions(+), 665 deletions(-) diff --git a/embassy-stm32/build.rs b/embassy-stm32/build.rs index fd9a07ce..577eb60c 100644 --- a/embassy-stm32/build.rs +++ b/embassy-stm32/build.rs @@ -230,6 +230,216 @@ fn main() { }) } + // ======== + // Generate pin_trait_impl! + + #[rustfmt::skip] + let signals: HashMap<_, _> = [ + // (kind, signal) => (trait, cfgs) + (("usart", "TX"), (quote!(crate::usart::TxPin), quote!())), + (("usart", "RX"), (quote!(crate::usart::RxPin), quote!())), + (("usart", "CTS"), (quote!(crate::usart::CtsPin), quote!())), + (("usart", "RTS"), (quote!(crate::usart::RtsPin), quote!())), + (("usart", "CK"), (quote!(crate::usart::CkPin), quote!())), + (("usart", "TX"), (quote!(crate::usart::TxPin), quote!())), + (("usart", "RX"), (quote!(crate::usart::RxPin), quote!())), + (("usart", "CTS"), (quote!(crate::usart::CtsPin), quote!())), + (("usart", "RTS"), (quote!(crate::usart::RtsPin), quote!())), + (("usart", "CK"), (quote!(crate::usart::CkPin), quote!())), + (("spi", "SCK"), (quote!(crate::spi::SckPin), quote!())), + (("spi", "MOSI"), (quote!(crate::spi::MosiPin), quote!())), + (("spi", "MISO"), (quote!(crate::spi::MisoPin), quote!())), + (("i2c", "SDA"), (quote!(crate::i2c::SdaPin), quote!())), + (("i2c", "SCL"), (quote!(crate::i2c::SclPin), quote!())), + (("dcmi", "D0"), (quote!(crate::dcmi::D0Pin), quote!())), + (("dcmi", "D1"), (quote!(crate::dcmi::D1Pin), quote!())), + (("dcmi", "D2"), (quote!(crate::dcmi::D2Pin), quote!())), + (("dcmi", "D3"), (quote!(crate::dcmi::D3Pin), quote!())), + (("dcmi", "D4"), (quote!(crate::dcmi::D4Pin), quote!())), + (("dcmi", "D5"), (quote!(crate::dcmi::D5Pin), quote!())), + (("dcmi", "D6"), (quote!(crate::dcmi::D6Pin), quote!())), + (("dcmi", "D7"), (quote!(crate::dcmi::D7Pin), quote!())), + (("dcmi", "D8"), (quote!(crate::dcmi::D8Pin), quote!())), + (("dcmi", "D9"), (quote!(crate::dcmi::D9Pin), quote!())), + (("dcmi", "D10"), (quote!(crate::dcmi::D10Pin), quote!())), + (("dcmi", "D11"), (quote!(crate::dcmi::D11Pin), quote!())), + (("dcmi", "D12"), (quote!(crate::dcmi::D12Pin), quote!())), + (("dcmi", "D13"), (quote!(crate::dcmi::D13Pin), quote!())), + (("dcmi", "HSYNC"), (quote!(crate::dcmi::HSyncPin), quote!())), + (("dcmi", "VSYNC"), (quote!(crate::dcmi::VSyncPin), quote!())), + (("dcmi", "PIXCLK"), (quote!(crate::dcmi::PixClkPin), quote!())), + (("otgfs", "DP"), (quote!(crate::usb_otg::DpPin), quote!(#[cfg(feature="usb-otg")]))), + (("otgfs", "DM"), (quote!(crate::usb_otg::DmPin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "DP"), (quote!(crate::usb_otg::DpPin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "DM"), (quote!(crate::usb_otg::DmPin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_CK"), (quote!(crate::usb_otg::UlpiClkPin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_DIR"), (quote!(crate::usb_otg::UlpiDirPin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_NXT"), (quote!(crate::usb_otg::UlpiNxtPin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_STP"), (quote!(crate::usb_otg::UlpiStpPin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_D0"), (quote!(crate::usb_otg::UlpiD0Pin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_D1"), (quote!(crate::usb_otg::UlpiD1Pin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_D2"), (quote!(crate::usb_otg::UlpiD2Pin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_D3"), (quote!(crate::usb_otg::UlpiD3Pin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_D4"), (quote!(crate::usb_otg::UlpiD4Pin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_D5"), (quote!(crate::usb_otg::UlpiD5Pin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_D6"), (quote!(crate::usb_otg::UlpiD6Pin), quote!(#[cfg(feature="usb-otg")]))), + (("otghs", "ULPI_D7"), (quote!(crate::usb_otg::UlpiD7Pin), quote!(#[cfg(feature="usb-otg")]))), + (("can", "TX"), (quote!(crate::can::TxPin), quote!())), + (("can", "RX"), (quote!(crate::can::RxPin), quote!())), + (("eth", "REF_CLK"), (quote!(crate::eth::RefClkPin), quote!(#[cfg(feature="net")]))), + (("eth", "MDIO"), (quote!(crate::eth::MDIOPin), quote!(#[cfg(feature="net")]))), + (("eth", "MDC"), (quote!(crate::eth::MDCPin), quote!(#[cfg(feature="net")]))), + (("eth", "CRS_DV"), (quote!(crate::eth::CRSPin), quote!(#[cfg(feature="net")]))), + (("eth", "RXD0"), (quote!(crate::eth::RXD0Pin), quote!(#[cfg(feature="net")]))), + (("eth", "RXD1"), (quote!(crate::eth::RXD1Pin), quote!(#[cfg(feature="net")]))), + (("eth", "TXD0"), (quote!(crate::eth::TXD0Pin), quote!(#[cfg(feature="net")]))), + (("eth", "TXD1"), (quote!(crate::eth::TXD1Pin), quote!(#[cfg(feature="net")]))), + (("eth", "TX_EN"), (quote!(crate::eth::TXEnPin), quote!(#[cfg(feature="net")]))), + (("fmc", "A0"), (quote!(crate::fmc::A0Pin), quote!())), + (("fmc", "A1"), (quote!(crate::fmc::A1Pin), quote!())), + (("fmc", "A2"), (quote!(crate::fmc::A2Pin), quote!())), + (("fmc", "A3"), (quote!(crate::fmc::A3Pin), quote!())), + (("fmc", "A4"), (quote!(crate::fmc::A4Pin), quote!())), + (("fmc", "A5"), (quote!(crate::fmc::A5Pin), quote!())), + (("fmc", "A6"), (quote!(crate::fmc::A6Pin), quote!())), + (("fmc", "A7"), (quote!(crate::fmc::A7Pin), quote!())), + (("fmc", "A8"), (quote!(crate::fmc::A8Pin), quote!())), + (("fmc", "A9"), (quote!(crate::fmc::A9Pin), quote!())), + (("fmc", "A10"), (quote!(crate::fmc::A10Pin), quote!())), + (("fmc", "A11"), (quote!(crate::fmc::A11Pin), quote!())), + (("fmc", "A12"), (quote!(crate::fmc::A12Pin), quote!())), + (("fmc", "A13"), (quote!(crate::fmc::A13Pin), quote!())), + (("fmc", "A14"), (quote!(crate::fmc::A14Pin), quote!())), + (("fmc", "A15"), (quote!(crate::fmc::A15Pin), quote!())), + (("fmc", "A16"), (quote!(crate::fmc::A16Pin), quote!())), + (("fmc", "A17"), (quote!(crate::fmc::A17Pin), quote!())), + (("fmc", "A18"), (quote!(crate::fmc::A18Pin), quote!())), + (("fmc", "A19"), (quote!(crate::fmc::A19Pin), quote!())), + (("fmc", "A20"), (quote!(crate::fmc::A20Pin), quote!())), + (("fmc", "A21"), (quote!(crate::fmc::A21Pin), quote!())), + (("fmc", "A22"), (quote!(crate::fmc::A22Pin), quote!())), + (("fmc", "A23"), (quote!(crate::fmc::A23Pin), quote!())), + (("fmc", "A24"), (quote!(crate::fmc::A24Pin), quote!())), + (("fmc", "A25"), (quote!(crate::fmc::A25Pin), quote!())), + (("fmc", "D0"), (quote!(crate::fmc::D0Pin), quote!())), + (("fmc", "D1"), (quote!(crate::fmc::D1Pin), quote!())), + (("fmc", "D2"), (quote!(crate::fmc::D2Pin), quote!())), + (("fmc", "D3"), (quote!(crate::fmc::D3Pin), quote!())), + (("fmc", "D4"), (quote!(crate::fmc::D4Pin), quote!())), + (("fmc", "D5"), (quote!(crate::fmc::D5Pin), quote!())), + (("fmc", "D6"), (quote!(crate::fmc::D6Pin), quote!())), + (("fmc", "D7"), (quote!(crate::fmc::D7Pin), quote!())), + (("fmc", "D8"), (quote!(crate::fmc::D8Pin), quote!())), + (("fmc", "D9"), (quote!(crate::fmc::D9Pin), quote!())), + (("fmc", "D10"), (quote!(crate::fmc::D10Pin), quote!())), + (("fmc", "D11"), (quote!(crate::fmc::D11Pin), quote!())), + (("fmc", "D12"), (quote!(crate::fmc::D12Pin), quote!())), + (("fmc", "D13"), (quote!(crate::fmc::D13Pin), quote!())), + (("fmc", "D14"), (quote!(crate::fmc::D14Pin), quote!())), + (("fmc", "D15"), (quote!(crate::fmc::D15Pin), quote!())), + (("fmc", "D16"), (quote!(crate::fmc::D16Pin), quote!())), + (("fmc", "D17"), (quote!(crate::fmc::D17Pin), quote!())), + (("fmc", "D18"), (quote!(crate::fmc::D18Pin), quote!())), + (("fmc", "D19"), (quote!(crate::fmc::D19Pin), quote!())), + (("fmc", "D20"), (quote!(crate::fmc::D20Pin), quote!())), + (("fmc", "D21"), (quote!(crate::fmc::D21Pin), quote!())), + (("fmc", "D22"), (quote!(crate::fmc::D22Pin), quote!())), + (("fmc", "D23"), (quote!(crate::fmc::D23Pin), quote!())), + (("fmc", "D24"), (quote!(crate::fmc::D24Pin), quote!())), + (("fmc", "D25"), (quote!(crate::fmc::D25Pin), quote!())), + (("fmc", "D26"), (quote!(crate::fmc::D26Pin), quote!())), + (("fmc", "D27"), (quote!(crate::fmc::D27Pin), quote!())), + (("fmc", "D28"), (quote!(crate::fmc::D28Pin), quote!())), + (("fmc", "D29"), (quote!(crate::fmc::D29Pin), quote!())), + (("fmc", "D30"), (quote!(crate::fmc::D30Pin), quote!())), + (("fmc", "D31"), (quote!(crate::fmc::D31Pin), quote!())), + (("fmc", "DA0"), (quote!(crate::fmc::DA0Pin), quote!())), + (("fmc", "DA1"), (quote!(crate::fmc::DA1Pin), quote!())), + (("fmc", "DA2"), (quote!(crate::fmc::DA2Pin), quote!())), + (("fmc", "DA3"), (quote!(crate::fmc::DA3Pin), quote!())), + (("fmc", "DA4"), (quote!(crate::fmc::DA4Pin), quote!())), + (("fmc", "DA5"), (quote!(crate::fmc::DA5Pin), quote!())), + (("fmc", "DA6"), (quote!(crate::fmc::DA6Pin), quote!())), + (("fmc", "DA7"), (quote!(crate::fmc::DA7Pin), quote!())), + (("fmc", "DA8"), (quote!(crate::fmc::DA8Pin), quote!())), + (("fmc", "DA9"), (quote!(crate::fmc::DA9Pin), quote!())), + (("fmc", "DA10"), (quote!(crate::fmc::DA10Pin), quote!())), + (("fmc", "DA11"), (quote!(crate::fmc::DA11Pin), quote!())), + (("fmc", "DA12"), (quote!(crate::fmc::DA12Pin), quote!())), + (("fmc", "DA13"), (quote!(crate::fmc::DA13Pin), quote!())), + (("fmc", "DA14"), (quote!(crate::fmc::DA14Pin), quote!())), + (("fmc", "DA15"), (quote!(crate::fmc::DA15Pin), quote!())), + (("fmc", "SDNWE"), (quote!(crate::fmc::SDNWEPin), quote!())), + (("fmc", "SDNCAS"), (quote!(crate::fmc::SDNCASPin), quote!())), + (("fmc", "SDNRAS"), (quote!(crate::fmc::SDNRASPin), quote!())), + (("fmc", "SDNE0"), (quote!(crate::fmc::SDNE0Pin), quote!())), + (("fmc", "SDNE1"), (quote!(crate::fmc::SDNE1Pin), quote!())), + (("fmc", "SDCKE0"), (quote!(crate::fmc::SDCKE0Pin), quote!())), + (("fmc", "SDCKE1"), (quote!(crate::fmc::SDCKE1Pin), quote!())), + (("fmc", "SDCLK"), (quote!(crate::fmc::SDCLKPin), quote!())), + (("fmc", "NBL0"), (quote!(crate::fmc::NBL0Pin), quote!())), + (("fmc", "NBL1"), (quote!(crate::fmc::NBL1Pin), quote!())), + (("fmc", "NBL2"), (quote!(crate::fmc::NBL2Pin), quote!())), + (("fmc", "NBL3"), (quote!(crate::fmc::NBL3Pin), quote!())), + (("fmc", "INT"), (quote!(crate::fmc::INTPin), quote!())), + (("fmc", "NL"), (quote!(crate::fmc::NLPin), quote!())), + (("fmc", "NWAIT"), (quote!(crate::fmc::NWaitPin), quote!())), + (("fmc", "NE1"), (quote!(crate::fmc::NE1Pin), quote!())), + (("fmc", "NE2"), (quote!(crate::fmc::NE2Pin), quote!())), + (("fmc", "NE3"), (quote!(crate::fmc::NE3Pin), quote!())), + (("fmc", "NE4"), (quote!(crate::fmc::NE4Pin), quote!())), + (("fmc", "NCE"), (quote!(crate::fmc::NCEPin), quote!())), + (("fmc", "NOE"), (quote!(crate::fmc::NOEPin), quote!())), + (("fmc", "NWE"), (quote!(crate::fmc::NWEPin), quote!())), + (("fmc", "Clk"), (quote!(crate::fmc::ClkPin), quote!())), + (("fmc", "BA0"), (quote!(crate::fmc::BA0Pin), quote!())), + (("fmc", "BA1"), (quote!(crate::fmc::BA1Pin), quote!())), + (("timer", "CH1"), (quote!(crate::pwm::Channel1Pin), quote!())), + (("timer", "CH1N"), (quote!(crate::pwm::Channel1ComplementaryPin), quote!())), + (("timer", "CH2"), (quote!(crate::pwm::Channel2Pin), quote!())), + (("timer", "CH2N"), (quote!(crate::pwm::Channel2ComplementaryPin), quote!())), + (("timer", "CH3"), (quote!(crate::pwm::Channel3Pin), quote!())), + (("timer", "CH3N"), (quote!(crate::pwm::Channel3ComplementaryPin), quote!())), + (("timer", "CH4"), (quote!(crate::pwm::Channel4Pin), quote!())), + (("timer", "CH4N"), (quote!(crate::pwm::Channel4ComplementaryPin), quote!())), + (("timer", "ETR"), (quote!(crate::pwm::ExternalTriggerPin), quote!())), + (("timer", "BKIN"), (quote!(crate::pwm::BreakInputPin), quote!())), + (("timer", "BKIN_COMP1"), (quote!(crate::pwm::BreakInputComparator1Pin), quote!())), + (("timer", "BKIN_COMP2"), (quote!(crate::pwm::BreakInputComparator2Pin), quote!())), + (("timer", "BKIN2"), (quote!(crate::pwm::BreakInput2Pin), quote!())), + (("timer", "BKIN2_COMP1"), (quote!(crate::pwm::BreakInput2Comparator1Pin), quote!())), + (("timer", "BKIN2_COMP2"), (quote!(crate::pwm::BreakInput2Comparator2Pin), quote!())), + (("sdmmc", "CK"), (quote!(crate::sdmmc::CkPin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "CMD"), (quote!(crate::sdmmc::CmdPin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "D0"), (quote!(crate::sdmmc::D0Pin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "D1"), (quote!(crate::sdmmc::D1Pin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "D2"), (quote!(crate::sdmmc::D2Pin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "D3"), (quote!(crate::sdmmc::D3Pin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "D4"), (quote!(crate::sdmmc::D4Pin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "D5"), (quote!(crate::sdmmc::D5Pin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "D6"), (quote!(crate::sdmmc::D6Pin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "D6"), (quote!(crate::sdmmc::D7Pin), quote!(#[cfg(feature="sdmmc-rs")]))), + (("sdmmc", "D8"), (quote!(crate::sdmmc::D8Pin), quote!(#[cfg(feature="sdmmc-rs")]))), + ].into(); + + for p in METADATA.peripherals { + if let Some(regs) = &p.registers { + 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 pin_name = format_ident!("{}", pin.pin); + let af = pin.af.unwrap_or(0); + + g.extend(quote! { + #cfgs + pin_trait_impl!(#tr, #peri, #pin_name, #af); + }) + } + } + } + } + // ======== // Generate dma_trait_impl! diff --git a/embassy-stm32/src/can/bxcan.rs b/embassy-stm32/src/can/bxcan.rs index 987ccad5..7fe0d193 100644 --- a/embassy-stm32/src/can/bxcan.rs +++ b/embassy-stm32/src/can/bxcan.rs @@ -112,18 +112,3 @@ crate::pac::peripherals!( pin_trait!(RxPin, Instance); pin_trait!(TxPin, Instance); - -crate::pac::peripheral_pins!( - ($inst:ident, can, CAN, $pin:ident, TX, $af:expr) => { - pin_trait_impl!(TxPin, $inst, $pin, $af); - }; - ($inst:ident, can, CAN, $pin:ident, RX, $af:expr) => { - pin_trait_impl!(RxPin, $inst, $pin, $af); - }; - ($inst:ident, can, CAN, $pin:ident, TX) => { - pin_trait_impl!(TxPin, $inst, $pin, 0); - }; - ($inst:ident, can, CAN, $pin:ident, RX) => { - pin_trait_impl!(RxPin, $inst, $pin, 0); - }; -); diff --git a/embassy-stm32/src/dcmi.rs b/embassy-stm32/src/dcmi.rs index ff6f0970..9ac96c69 100644 --- a/embassy-stm32/src/dcmi.rs +++ b/embassy-stm32/src/dcmi.rs @@ -481,57 +481,3 @@ crate::pac::interrupts! { } dma_trait!(FrameDma, Instance); - -crate::pac::peripheral_pins!( - ($inst:ident, dcmi, DCMI, $pin:ident, D0, $af:expr) => { - pin_trait_impl!(D0Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D1, $af:expr) => { - pin_trait_impl!(D1Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D2, $af:expr) => { - pin_trait_impl!(D2Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D3, $af:expr) => { - pin_trait_impl!(D3Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D4, $af:expr) => { - pin_trait_impl!(D4Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D5, $af:expr) => { - pin_trait_impl!(D5Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D6, $af:expr) => { - pin_trait_impl!(D6Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D7, $af:expr) => { - pin_trait_impl!(D7Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D8, $af:expr) => { - pin_trait_impl!(D8Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D9, $af:expr) => { - pin_trait_impl!(D9Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D10, $af:expr) => { - pin_trait_impl!(D10Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D11, $af:expr) => { - pin_trait_impl!(D11Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D12, $af:expr) => { - pin_trait_impl!(D12Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, D13, $af:expr) => { - pin_trait_impl!(D13Pin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, HSYNC, $af:expr) => { - pin_trait_impl!(HSyncPin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, VSYNC, $af:expr) => { - pin_trait_impl!(VSyncPin, $inst, $pin, $af); - }; - ($inst:ident, dcmi, DCMI, $pin:ident, PIXCLK, $af:expr) => { - pin_trait_impl!(PixClkPin, $inst, $pin, $af); - }; -); diff --git a/embassy-stm32/src/eth/mod.rs b/embassy-stm32/src/eth/mod.rs index cf145e39..1e304b78 100644 --- a/embassy-stm32/src/eth/mod.rs +++ b/embassy-stm32/src/eth/mod.rs @@ -58,33 +58,3 @@ pin_trait!(RXD1Pin, Instance); pin_trait!(TXD0Pin, Instance); pin_trait!(TXD1Pin, Instance); pin_trait!(TXEnPin, Instance); - -crate::pac::peripheral_pins!( - ($inst:ident, eth, ETH, $pin:ident, REF_CLK, $af:expr) => { - pin_trait_impl!(RefClkPin, $inst, $pin, $af); - }; - ($inst:ident, eth, ETH, $pin:ident, MDIO, $af:expr) => { - pin_trait_impl!(MDIOPin, $inst, $pin, $af); - }; - ($inst:ident, eth, ETH, $pin:ident, MDC, $af:expr) => { - pin_trait_impl!(MDCPin, $inst, $pin, $af); - }; - ($inst:ident, eth, ETH, $pin:ident, CRS_DV, $af:expr) => { - pin_trait_impl!(CRSPin, $inst, $pin, $af); - }; - ($inst:ident, eth, ETH, $pin:ident, RXD0, $af:expr) => { - pin_trait_impl!(RXD0Pin, $inst, $pin, $af); - }; - ($inst:ident, eth, ETH, $pin:ident, RXD1, $af:expr) => { - pin_trait_impl!(RXD1Pin, $inst, $pin, $af); - }; - ($inst:ident, eth, ETH, $pin:ident, TXD0, $af:expr) => { - pin_trait_impl!(TXD0Pin, $inst, $pin, $af); - }; - ($inst:ident, eth, ETH, $pin:ident, TXD1, $af:expr) => { - pin_trait_impl!(TXD1Pin, $inst, $pin, $af); - }; - ($inst:ident, eth, ETH, $pin:ident, TX_EN, $af:expr) => { - pin_trait_impl!(TXEnPin, $inst, $pin, $af); - }; -); diff --git a/embassy-stm32/src/fmc/pins.rs b/embassy-stm32/src/fmc/pins.rs index e390ad17..5062e52a 100644 --- a/embassy-stm32/src/fmc/pins.rs +++ b/embassy-stm32/src/fmc/pins.rs @@ -116,303 +116,3 @@ pin_trait!(A22Pin, Instance); pin_trait!(A23Pin, Instance); pin_trait!(A24Pin, Instance); pin_trait!(A25Pin, Instance); - -crate::pac::peripheral_pins!( - ($inst:ident, fmc, FMC, $pin:ident, A0, $af:expr) => { - pin_trait_impl!(A0Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A1, $af:expr) => { - pin_trait_impl!(A1Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A2, $af:expr) => { - pin_trait_impl!(A2Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A3, $af:expr) => { - pin_trait_impl!(A3Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A4, $af:expr) => { - pin_trait_impl!(A4Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A5, $af:expr) => { - pin_trait_impl!(A5Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A6, $af:expr) => { - pin_trait_impl!(A6Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A7, $af:expr) => { - pin_trait_impl!(A7Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A8, $af:expr) => { - pin_trait_impl!(A8Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A9, $af:expr) => { - pin_trait_impl!(A9Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A10, $af:expr) => { - pin_trait_impl!(A10Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A11, $af:expr) => { - pin_trait_impl!(A11Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A12, $af:expr) => { - pin_trait_impl!(A12Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A13, $af:expr) => { - pin_trait_impl!(A13Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A14, $af:expr) => { - pin_trait_impl!(A14Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A15, $af:expr) => { - pin_trait_impl!(A15Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A16, $af:expr) => { - pin_trait_impl!(A16Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A17, $af:expr) => { - pin_trait_impl!(A17Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A18, $af:expr) => { - pin_trait_impl!(A18Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A19, $af:expr) => { - pin_trait_impl!(A19Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A20, $af:expr) => { - pin_trait_impl!(A20Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A21, $af:expr) => { - pin_trait_impl!(A21Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A22, $af:expr) => { - pin_trait_impl!(A22Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A23, $af:expr) => { - pin_trait_impl!(A23Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A24, $af:expr) => { - pin_trait_impl!(A24Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, A25, $af:expr) => { - pin_trait_impl!(A25Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D0, $af:expr) => { - pin_trait_impl!(D0Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D1, $af:expr) => { - pin_trait_impl!(D1Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D2, $af:expr) => { - pin_trait_impl!(D2Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D3, $af:expr) => { - pin_trait_impl!(D3Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D4, $af:expr) => { - pin_trait_impl!(D4Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D5, $af:expr) => { - pin_trait_impl!(D5Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D6, $af:expr) => { - pin_trait_impl!(D6Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D7, $af:expr) => { - pin_trait_impl!(D7Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D8, $af:expr) => { - pin_trait_impl!(D8Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D9, $af:expr) => { - pin_trait_impl!(D9Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D10, $af:expr) => { - pin_trait_impl!(D10Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D11, $af:expr) => { - pin_trait_impl!(D11Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D12, $af:expr) => { - pin_trait_impl!(D12Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D13, $af:expr) => { - pin_trait_impl!(D13Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D14, $af:expr) => { - pin_trait_impl!(D14Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D15, $af:expr) => { - pin_trait_impl!(D15Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D16, $af:expr) => { - pin_trait_impl!(D16Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D17, $af:expr) => { - pin_trait_impl!(D17Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D18, $af:expr) => { - pin_trait_impl!(D18Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D19, $af:expr) => { - pin_trait_impl!(D19Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D20, $af:expr) => { - pin_trait_impl!(D20Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D21, $af:expr) => { - pin_trait_impl!(D21Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D22, $af:expr) => { - pin_trait_impl!(D22Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D23, $af:expr) => { - pin_trait_impl!(D23Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D24, $af:expr) => { - pin_trait_impl!(D24Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D25, $af:expr) => { - pin_trait_impl!(D25Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D26, $af:expr) => { - pin_trait_impl!(D26Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D27, $af:expr) => { - pin_trait_impl!(D27Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D28, $af:expr) => { - pin_trait_impl!(D28Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D29, $af:expr) => { - pin_trait_impl!(D29Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D30, $af:expr) => { - pin_trait_impl!(D30Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, D31, $af:expr) => { - pin_trait_impl!(D31Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA0, $af:expr) => { - pin_trait_impl!(DA0Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA1, $af:expr) => { - pin_trait_impl!(DA1Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA2, $af:expr) => { - pin_trait_impl!(DA2Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA3, $af:expr) => { - pin_trait_impl!(DA3Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA4, $af:expr) => { - pin_trait_impl!(DA4Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA5, $af:expr) => { - pin_trait_impl!(DA5Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA6, $af:expr) => { - pin_trait_impl!(DA6Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA7, $af:expr) => { - pin_trait_impl!(DA7Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA8, $af:expr) => { - pin_trait_impl!(DA8Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA9, $af:expr) => { - pin_trait_impl!(DA9Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA10, $af:expr) => { - pin_trait_impl!(DA10Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA11, $af:expr) => { - pin_trait_impl!(DA11Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA12, $af:expr) => { - pin_trait_impl!(DA12Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA13, $af:expr) => { - pin_trait_impl!(DA13Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA14, $af:expr) => { - pin_trait_impl!(DA14Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, DA15, $af:expr) => { - pin_trait_impl!(DA15Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, SDNWE, $af:expr) => { - pin_trait_impl!(SDNWEPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, SDNCAS, $af:expr) => { - pin_trait_impl!(SDNCASPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, SDNRAS, $af:expr) => { - pin_trait_impl!(SDNRASPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, SDNE0, $af:expr) => { - pin_trait_impl!(SDNE0Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, SDNE1, $af:expr) => { - pin_trait_impl!(SDNE1Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, SDCKE0, $af:expr) => { - pin_trait_impl!(SDCKE0Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, SDCKE1, $af:expr) => { - pin_trait_impl!(SDCKE1Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, SDCLK, $af:expr) => { - pin_trait_impl!(SDCLKPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NBL0, $af:expr) => { - pin_trait_impl!(NBL0Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NBL1, $af:expr) => { - pin_trait_impl!(NBL1Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NBL2, $af:expr) => { - pin_trait_impl!(NBL2Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NBL3, $af:expr) => { - pin_trait_impl!(NBL3Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, INT, $af:expr) => { - pin_trait_impl!(INTPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NL, $af:expr) => { - pin_trait_impl!(NLPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NWAIT, $af:expr) => { - pin_trait_impl!(NWaitPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NE1, $af:expr) => { - pin_trait_impl!(NE1Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NE2, $af:expr) => { - pin_trait_impl!(NE2Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NE3, $af:expr) => { - pin_trait_impl!(NE3Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NE4, $af:expr) => { - pin_trait_impl!(NE4Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NCE, $af:expr) => { - pin_trait_impl!(NCEPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NOE, $af:expr) => { - pin_trait_impl!(NOEPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, NWE, $af:expr) => { - pin_trait_impl!(NWEPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, Clk, $af:expr) => { - pin_trait_impl!(ClkPin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, BA0, $af:expr) => { - pin_trait_impl!(BA0Pin, $inst, $pin, $af); - }; - ($inst:ident, fmc, FMC, $pin:ident, BA1, $af:expr) => { - pin_trait_impl!(BA1Pin, $inst, $pin, $af); - }; -); diff --git a/embassy-stm32/src/i2c/mod.rs b/embassy-stm32/src/i2c/mod.rs index ff13d9f1..aad1c137 100644 --- a/embassy-stm32/src/i2c/mod.rs +++ b/embassy-stm32/src/i2c/mod.rs @@ -71,23 +71,3 @@ crate::pac::interrupts!( } }; ); - -#[cfg(not(rcc_f1))] -crate::pac::peripheral_pins!( - ($inst:ident, i2c, I2C, $pin:ident, SDA, $af:expr) => { - pin_trait_impl!(SdaPin, $inst, $pin, $af); - }; - ($inst:ident, i2c, I2C, $pin:ident, SCL, $af:expr) => { - pin_trait_impl!(SclPin, $inst, $pin, $af); - }; -); - -#[cfg(rcc_f1)] -crate::pac::peripheral_pins!( - ($inst:ident, i2c, I2C, $pin:ident, SDA) => { - pin_trait_impl!(SdaPin, $inst, $pin, 0); - }; - ($inst:ident, i2c, I2C, $pin:ident, SCL) => { - pin_trait_impl!(SdaPin, $inst, $pin, 0); - }; -); diff --git a/embassy-stm32/src/pwm/mod.rs b/embassy-stm32/src/pwm/mod.rs index 7b41e8a5..edc34fa5 100644 --- a/embassy-stm32/src/pwm/mod.rs +++ b/embassy-stm32/src/pwm/mod.rs @@ -258,51 +258,3 @@ pin_trait!(BreakInputComparator2Pin, CaptureCompare16bitInstance); pin_trait!(BreakInput2Pin, CaptureCompare16bitInstance); pin_trait!(BreakInput2Comparator1Pin, CaptureCompare16bitInstance); pin_trait!(BreakInput2Comparator2Pin, CaptureCompare16bitInstance); - -crate::pac::peripheral_pins!( - ($inst:ident, timer, $block:ident, $pin:ident, CH1, $af:expr) => { - pin_trait_impl!(Channel1Pin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, CH1N, $af:expr) => { - pin_trait_impl!(Channel1ComplementaryPin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, CH2, $af:expr) => { - pin_trait_impl!(Channel2Pin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, CH2N, $af:expr) => { - pin_trait_impl!(Channel2ComplementaryPin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, CH3, $af:expr) => { - pin_trait_impl!(Channel3Pin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, CH3N, $af:expr) => { - pin_trait_impl!(Channel3ComplementaryPin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, CH4, $af:expr) => { - pin_trait_impl!(Channel4Pin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, CH4N, $af:expr) => { - pin_trait_impl!(Channel4ComplementaryPin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, ETR, $af:expr) => { - pin_trait_impl!(ExternalTriggerPin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, BKIN, $af:expr) => { - pin_trait_impl!(BreakInputPin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, BKIN_COMP1, $af:expr) => { - pin_trait_impl!(BreakInputComparator1Pin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, BKIN_COMP2, $af:expr) => { - pin_trait_impl!(BreakInputComparator2Pin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, BKIN2, $af:expr) => { - pin_trait_impl!(BreakInput2Pin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, BKIN2_COMP1, $af:expr) => { - pin_trait_impl!(BreakInput2Comparator1Pin, $inst, $pin, $af); - }; - ($inst:ident, timer, $block:ident, $pin:ident, BKIN2_COMP2, $af:expr) => { - pin_trait_impl!(BreakInput2Comparator2Pin, $inst, $pin, $af); - }; -); diff --git a/embassy-stm32/src/rcc/h7.rs b/embassy-stm32/src/rcc/h7.rs index 1b2c595b..73ad3863 100644 --- a/embassy-stm32/src/rcc/h7.rs +++ b/embassy-stm32/src/rcc/h7.rs @@ -350,10 +350,10 @@ 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!(McoPin, MCO1, $pin, $af); + pin_trait_impl!(crate::rcc::McoPin, MCO1, $pin, $af); }; ($inst:ident, rcc, RCC, $pin:ident, MCO_2, $af:expr) => { - pin_trait_impl!(McoPin, MCO2, $pin, $af); + pin_trait_impl!(crate::rcc::McoPin, MCO2, $pin, $af); }; ); diff --git a/embassy-stm32/src/sdmmc/v2.rs b/embassy-stm32/src/sdmmc/v2.rs index 733b8fdd..77a7c28c 100644 --- a/embassy-stm32/src/sdmmc/v2.rs +++ b/embassy-stm32/src/sdmmc/v2.rs @@ -1460,42 +1460,6 @@ crate::pac::peripherals!( }; ); -crate::pac::peripheral_pins!( - ($inst:ident, sdmmc, SDMMC, $pin:ident, CK, $af:expr) => { - pin_trait_impl!(CkPin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, CMD, $af:expr) => { - pin_trait_impl!(CmdPin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, D0, $af:expr) => { - pin_trait_impl!(D0Pin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, D1, $af:expr) => { - pin_trait_impl!(D1Pin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, D2, $af:expr) => { - pin_trait_impl!(D2Pin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, D3, $af:expr) => { - pin_trait_impl!(D3Pin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, D4, $af:expr) => { - pin_trait_impl!(D4Pin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, D5, $af:expr) => { - pin_trait_impl!(D5Pin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, D6, $af:expr) => { - pin_trait_impl!(D6Pin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, D6, $af:expr) => { - pin_trait_impl!(D7Pin, $inst, $pin, $af); - }; - ($inst:ident, sdmmc, SDMMC, $pin:ident, D8, $af:expr) => { - pin_trait_impl!(D8Pin, $inst, $pin, $af); - }; -); - #[cfg(feature = "sdmmc-rs")] mod sdmmc_rs { use super::*; diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs index e91241e9..91420375 100644 --- a/embassy-stm32/src/spi/mod.rs +++ b/embassy-stm32/src/spi/mod.rs @@ -885,29 +885,3 @@ crate::pac::peripherals!( impl Instance for peripherals::$inst {} }; ); - -#[cfg(not(rcc_f1))] -crate::pac::peripheral_pins!( - ($inst:ident, spi, SPI, $pin:ident, SCK, $af:expr) => { - pin_trait_impl!(SckPin, $inst, $pin, $af); - }; - ($inst:ident, spi, SPI, $pin:ident, MOSI, $af:expr) => { - pin_trait_impl!(MosiPin, $inst, $pin, $af); - }; - ($inst:ident, spi, SPI, $pin:ident, MISO, $af:expr) => { - pin_trait_impl!(MisoPin, $inst, $pin, $af); - }; -); - -#[cfg(rcc_f1)] -crate::pac::peripheral_pins!( - ($inst:ident, spi, SPI, $pin:ident, SCK) => { - pin_trait_impl!(SckPin, $inst, $pin, 0); - }; - ($inst:ident, spi, SPI, $pin:ident, MOSI) => { - pin_trait_impl!(MosiPin, $inst, $pin, 0); - }; - ($inst:ident, spi, SPI, $pin:ident, MISO) => { - pin_trait_impl!(MisoPin, $inst, $pin, 0); - }; -); diff --git a/embassy-stm32/src/traits.rs b/embassy-stm32/src/traits.rs index e006e31a..c733f422 100644 --- a/embassy-stm32/src/traits.rs +++ b/embassy-stm32/src/traits.rs @@ -9,8 +9,8 @@ macro_rules! pin_trait { } macro_rules! pin_trait_impl { - ($signal:ident, $instance:ident, $pin:ident, $af:expr) => { - impl $signal for crate::peripherals::$pin { + (crate::$mod:ident::$trait:ident, $instance:ident, $pin:ident, $af:expr) => { + impl crate::$mod::$trait for crate::peripherals::$pin { fn af_num(&self) -> u8 { $af } diff --git a/embassy-stm32/src/usart/mod.rs b/embassy-stm32/src/usart/mod.rs index 52c2cd84..33b3a7b2 100644 --- a/embassy-stm32/src/usart/mod.rs +++ b/embassy-stm32/src/usart/mod.rs @@ -636,79 +636,3 @@ crate::pac::interrupts!( } }; ); - -#[cfg(not(rcc_f1))] -crate::pac::peripheral_pins!( - - // USART - ($inst:ident, usart, USART, $pin:ident, TX, $af:expr) => { - pin_trait_impl!(TxPin, $inst, $pin, $af); - }; - ($inst:ident, usart, USART, $pin:ident, RX, $af:expr) => { - pin_trait_impl!(RxPin, $inst, $pin, $af); - }; - ($inst:ident, usart, USART, $pin:ident, CTS, $af:expr) => { - pin_trait_impl!(CtsPin, $inst, $pin, $af); - }; - ($inst:ident, usart, USART, $pin:ident, RTS, $af:expr) => { - pin_trait_impl!(RtsPin, $inst, $pin, $af); - }; - ($inst:ident, usart, USART, $pin:ident, CK, $af:expr) => { - pin_trait_impl!(CkPin, $inst, $pin, $af); - }; - - // UART - ($inst:ident, usart, UART, $pin:ident, TX, $af:expr) => { - pin_trait_impl!(TxPin, $inst, $pin, $af); - }; - ($inst:ident, usart, UART, $pin:ident, RX, $af:expr) => { - pin_trait_impl!(RxPin, $inst, $pin, $af); - }; - ($inst:ident, usart, UART, $pin:ident, CTS, $af:expr) => { - pin_trait_impl!(CtsPin, $inst, $pin, $af); - }; - ($inst:ident, usart, UART, $pin:ident, RTS, $af:expr) => { - pin_trait_impl!(RtsPin, $inst, $pin, $af); - }; - ($inst:ident, usart, UART, $pin:ident, CK, $af:expr) => { - pin_trait_impl!(CkPin, $inst, $pin, $af); - }; -); - -#[cfg(rcc_f1)] -crate::pac::peripheral_pins!( - - // USART - ($inst:ident, usart, USART, $pin:ident, TX) => { - pin_trait_impl!(TxPin, $inst, $pin, 0); - }; - ($inst:ident, usart, USART, $pin:ident, RX) => { - pin_trait_impl!(RxPin, $inst, $pin, 0); - }; - ($inst:ident, usart, USART, $pin:ident, CTS) => { - pin_trait_impl!(CtsPin, $inst, $pin, 0); - }; - ($inst:ident, usart, USART, $pin:ident, RTS) => { - pin_trait_impl!(RtsPin, $inst, $pin, 0); - }; - ($inst:ident, usart, USART, $pin:ident, CK) => { - pin_trait_impl!(CkPin, $inst, $pin, 0); - }; - - // UART - ($inst:ident, usart, UART, $pin:ident, TX) => { - pin_trait_impl!(TxPin, $inst, $pin, 0); - }; - ($inst:ident, usart, UART, $pin:ident, RX) => { - pin_trait_impl!(RxPin, $inst, $pin, 0); - }; - ($inst:ident, usart, UART, $pin:ident, CTS) => { - pin_trait_impl!(CtsPin, $inst, $pin, 0); - }; - ($inst:ident, usart, UART, $pin:ident, RTS) => { - pin_trait_impl!(RtsPin, $inst, $pin, 0); - }; - ($inst:ident, usart, UART, $pin:ident, CK) => { - pin_trait_impl!(CkPin, $inst, $pin, 0); - }; -); diff --git a/embassy-stm32/src/usb_otg.rs b/embassy-stm32/src/usb_otg.rs index bdce6f44..6e08815d 100644 --- a/embassy-stm32/src/usb_otg.rs +++ b/embassy-stm32/src/usb_otg.rs @@ -231,59 +231,3 @@ crate::pac::interrupts!( unsafe impl USBInterrupt for crate::interrupt::$irq {} }; ); - -crate::pac::peripheral_pins!( - // FS internal phy pins - ($inst:ident, otgfs, OTG_FS, $pin:ident, DP, $af:expr) => { - pin_trait_impl!(DpPin, $inst, $pin, $af); - }; - ($inst:ident, otgfs, OTG_FS, $pin:ident, DM, $af:expr) => { - pin_trait_impl!(DmPin, $inst, $pin, $af); - }; - - // HS internal phy pins - ($inst:ident, otghs, OTG_HS, $pin:ident, DP, $af:expr) => { - pin_trait_impl!(DpPin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, DM, $af:expr) => { - pin_trait_impl!(DmPin, $inst, $pin, $af); - }; - - // HS external phy pins - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_CK, $af:expr) => { - pin_trait_impl!(UlpiClkPin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_DIR, $af:expr) => { - pin_trait_impl!(UlpiDirPin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_NXT, $af:expr) => { - pin_trait_impl!(UlpiNxtPin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_STP, $af:expr) => { - pin_trait_impl!(UlpiStpPin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_D0, $af:expr) => { - pin_trait_impl!(UlpiD0Pin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_D1, $af:expr) => { - pin_trait_impl!(UlpiD1Pin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_D2, $af:expr) => { - pin_trait_impl!(UlpiD2Pin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_D3, $af:expr) => { - pin_trait_impl!(UlpiD3Pin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_D4, $af:expr) => { - pin_trait_impl!(UlpiD4Pin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_D5, $af:expr) => { - pin_trait_impl!(UlpiD5Pin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_D6, $af:expr) => { - pin_trait_impl!(UlpiD6Pin, $inst, $pin, $af); - }; - ($inst:ident, otghs, OTG_HS, $pin:ident, ULPI_D7, $af:expr) => { - pin_trait_impl!(UlpiD7Pin, $inst, $pin, $af); - }; -);