aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-stm32/src/spi/mod.rs30
1 files changed, 12 insertions, 18 deletions
diff --git a/embassy-stm32/src/spi/mod.rs b/embassy-stm32/src/spi/mod.rs
index a888622de..730169ec0 100644
--- a/embassy-stm32/src/spi/mod.rs
+++ b/embassy-stm32/src/spi/mod.rs
@@ -84,34 +84,28 @@ crate::pac::peripherals!(
84 }; 84 };
85); 85);
86 86
87crate::pac::peripheral_pins!( 87macro_rules! impl_pin {
88 ($inst:ident, spi, SPI, $pin:ident, SCK, $af:expr) => { 88 ($inst:ident, $pin:ident, $signal:ident, $af:expr) => {
89 impl SckPin<peripherals::$inst> for peripherals::$pin {} 89 impl $signal<peripherals::$inst> for peripherals::$pin {}
90 90
91 impl sealed::SckPin<peripherals::$inst> for peripherals::$pin { 91 impl sealed::$signal<peripherals::$inst> for peripherals::$pin {
92 fn af_num(&self) -> u8 { 92 fn af_num(&self) -> u8 {
93 $af 93 $af
94 } 94 }
95 } 95 }
96 }; 96 };
97}
97 98
98 ($inst:ident, spi, SPI, $pin:ident, MOSI, $af:expr) => { 99crate::pac::peripheral_pins!(
99 impl MosiPin<peripherals::$inst> for peripherals::$pin {} 100 ($inst:ident, spi, SPI, $pin:ident, SCK, $af:expr) => {
101 impl_pin!($inst, $pin, SckPin, $af);
102 };
100 103
101 impl sealed::MosiPin<peripherals::$inst> for peripherals::$pin { 104 ($inst:ident, spi, SPI, $pin:ident, MOSI, $af:expr) => {
102 fn af_num(&self) -> u8 { 105 impl_pin!($inst, $pin, MosiPin, $af);
103 $af
104 }
105 }
106 }; 106 };
107 107
108 ($inst:ident, spi, SPI, $pin:ident, MISO, $af:expr) => { 108 ($inst:ident, spi, SPI, $pin:ident, MISO, $af:expr) => {
109 impl MisoPin<peripherals::$inst> for peripherals::$pin {} 109 impl_pin!($inst, $pin, MisoPin, $af);
110
111 impl sealed::MisoPin<peripherals::$inst> for peripherals::$pin {
112 fn af_num(&self) -> u8 {
113 $af
114 }
115 }
116 }; 110 };
117); 111);