Skip to content

Commit 89ae854

Browse files
committed
Fix spi pin features
1 parent 655991c commit 89ae854

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

src/spi.rs

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,44 +50,53 @@ pub trait MosiPin<SPI>: crate::private::Sealed {}
5050
impl SckPin<SPI1> for gpio::PA5<AF5<PushPull>> {}
5151
impl MisoPin<SPI1> for gpio::PA6<AF5<PushPull>> {}
5252
impl MosiPin<SPI1> for gpio::PA7<AF5<PushPull>> {}
53-
impl MosiPin<SPI1> for gpio::PB5<AF5<PushPull>> {}
5453

54+
#[cfg(not(feature = "gpio-f373"))]
55+
impl SckPin<SPI2> for gpio::PB13<AF5<PushPull>> {}
56+
#[cfg(feature = "gpio-f373")]
57+
impl SckPin<SPI2> for gpio::PB10<AF5<PushPull>> {}
5558
impl MisoPin<SPI2> for gpio::PB14<AF5<PushPull>> {}
5659
impl MosiPin<SPI2> for gpio::PB15<AF5<PushPull>> {}
5760

5861
impl MosiPin<SPI3> for gpio::PB5<AF6<PushPull>> {}
62+
5963
impl SckPin<SPI3> for gpio::PC10<AF6<PushPull>> {}
6064
impl MisoPin<SPI3> for gpio::PC11<AF6<PushPull>> {}
6165
impl MosiPin<SPI3> for gpio::PC12<AF6<PushPull>> {}
6266

6367
cfg_if::cfg_if! {
6468
if #[cfg(feature = "gpio-f373")] {
69+
impl SckPin<SPI2> for gpio::PB8<AF5<PushPull>> {}
70+
impl SckPin<SPI2> for gpio::PD7<AF5<PushPull>> {}
71+
impl SckPin<SPI2> for gpio::PD8<AF5<PushPull>> {}
72+
6573
impl SckPin<SPI1> for gpio::PA12<AF6<PushPull>> {}
66-
impl SckPin<SPI1> for gpio::PC7<AF5<PushPull>> {}
6774
impl MisoPin<SPI1> for gpio::PA13<AF6<PushPull>> {}
68-
impl MisoPin<SPI1> for gpio::PC8<AF5<PushPull>> {}
75+
6976
impl MosiPin<SPI1> for gpio::PB0<AF5<PushPull>> {}
70-
impl MosiPin<SPI1> for gpio::PC9<AF5<PushPull>> {}
7177
impl MosiPin<SPI1> for gpio::PF6<AF5<PushPull>> {}
7278

79+
impl SckPin<SPI1> for gpio::PC7<AF5<PushPull>> {}
80+
impl MisoPin<SPI1> for gpio::PC8<AF5<PushPull>> {}
81+
impl MosiPin<SPI1> for gpio::PC9<AF5<PushPull>> {}
82+
83+
7384
impl SckPin<SPI2> for gpio::PA8<AF5<PushPull>> {}
74-
impl SckPin<SPI2> for gpio::PB8<AF5<PushPull>> {}
75-
impl SckPin<SPI2> for gpio::PB10<AF5<PushPull>> {}
76-
impl SckPin<SPI2> for gpio::PD7<AF5<PushPull>> {}
77-
impl SckPin<SPI2> for gpio::PD8<AF5<PushPull>> {}
7885
impl MisoPin<SPI2> for gpio::PA9<AF5<PushPull>> {}
79-
impl MisoPin<SPI2> for gpio::PC2<AF5<PushPull>> {}
80-
impl MisoPin<SPI2> for gpio::PD3<AF5<PushPull>> {}
8186
impl MosiPin<SPI2> for gpio::PA10<AF5<PushPull>> {}
87+
88+
impl MisoPin<SPI2> for gpio::PC2<AF5<PushPull>> {}
8289
impl MisoPin<SPI2> for gpio::PC3<AF5<PushPull>> {}
90+
91+
impl MisoPin<SPI2> for gpio::PD3<AF5<PushPull>> {}
8392
impl MisoPin<SPI2> for gpio::PD4<AF5<PushPull>> {}
8493

8594
impl SckPin<SPI3> for gpio::PA1<AF6<PushPull>> {}
8695
impl MisoPin<SPI3> for gpio::PA2<AF6<PushPull>> {}
8796
impl MisoPin<SPI3> for gpio::PA3<AF6<PushPull>> {}
97+
98+
impl SckPin<SPI3> for gpio::PB3<AF6<PushPull>> {}
8899
impl MisoPin<SPI3> for gpio::PB4<AF6<PushPull>> {}
89-
} else {
90-
impl SckPin<SPI2> for gpio::PB13<AF5<PushPull>> {}
91100
}
92101
}
93102

@@ -101,10 +110,11 @@ cfg_if::cfg_if! {
101110
cfg_if::cfg_if! {
102111
if #[cfg(feature = "gpio-f303e")] {
103112
impl SckPin<SPI4> for gpio::PE2<AF5<PushPull>> {}
104-
impl SckPin<SPI4> for gpio::PE12<AF5<PushPull>> {}
105113
impl MisoPin<SPI4> for gpio::PE5<AF5<PushPull>> {}
106-
impl MisoPin<SPI4> for gpio::PE13<AF5<PushPull>> {}
107114
impl MosiPin<SPI4> for gpio::PE6<AF5<PushPull>> {}
115+
116+
impl SckPin<SPI4> for gpio::PE12<AF5<PushPull>> {}
117+
impl MisoPin<SPI4> for gpio::PE13<AF5<PushPull>> {}
108118
impl MosiPin<SPI4> for gpio::PE14<AF5<PushPull>> {}
109119
}
110120
}
@@ -127,18 +137,15 @@ cfg_if::cfg_if! {
127137
}
128138
}
129139

130-
#[cfg(all(
131-
not(feature = "stm32f301"),
132-
not(feature = "gpio-f333"),
133-
not(feature = "gpio-f303"),
134-
))]
135-
impl SckPin<SPI3> for gpio::PB3<AF6<PushPull>> {}
136-
137-
#[cfg(all(
138-
not(feature = "stm32f301"),
139-
any(feature = "gpio-f302", feature = "gpio-f303e"),
140-
))]
141-
impl MisoPin<SPI3> for gpio::PB4<AF6<PushPull>> {}
140+
cfg_if::cfg_if! {
141+
if #[cfg(all(
142+
not(feature = "stm32f301"),
143+
any(feature = "gpio-f302", feature = "gpio-f303e"),
144+
))] {
145+
impl SckPin<SPI3> for gpio::PB3<AF6<PushPull>> {}
146+
impl MisoPin<SPI3> for gpio::PB4<AF6<PushPull>> {}
147+
}
148+
}
142149

143150
/// Configuration trait for the Word Size
144151
/// used by the SPI peripheral
@@ -434,7 +441,6 @@ mod interrupts {
434441
}
435442
}
436443

437-
438444
cfg_if::cfg_if! {
439445
if #[cfg(any(feature = "gpio-f303e", feature = "svd-f302"))] {
440446
// XXX This is a hack.

0 commit comments

Comments
 (0)