Skip to content

Commit 25d7773

Browse files
danielgallagher0Sh3Rm4n
authored andcommitted
Update SPI impls for STM32F318
Based on the datasheet, the following pins and peripherals are supported: - SPI2: - SCK: PB13<AF5>, PF1<AF5> - MISO: PA10<AF5>, PB14<AF5> - MOSI: PA11<AF5>, PB15<AF5> - SPI3: - SCK: PB3<AF6> - MISO: PB4<AF6> - MOSI: PB5<AF6>
1 parent 2601bf6 commit 25d7773

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/spi.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ use crate::stm32::SPI4;
2424
feature = "stm32f302xd",
2525
feature = "stm32f302xe",
2626
feature = "stm32f303xd",
27-
feature = "stm32f303xe"
27+
feature = "stm32f303xe",
28+
feature = "stm32f318",
2829
))]
2930
use crate::gpio::gpioa::{PA10, PA11};
3031
use crate::gpio::gpioa::{PA5, PA6, PA7};
@@ -40,7 +41,7 @@ use crate::gpio::gpioa::{PA5, PA6, PA7};
4041
))]
4142
use crate::gpio::gpiob::PB13;
4243
use crate::gpio::gpiob::{PB14, PB15, PB5};
43-
#[cfg(any(feature = "stm32f302", feature = "stm32f303"))]
44+
#[cfg(any(feature = "stm32f302", feature = "stm32f303", feature = "stm32f318",))]
4445
use crate::gpio::gpiob::{PB3, PB4};
4546
use crate::gpio::gpioc::{PC10, PC11, PC12};
4647
#[cfg(any(
@@ -56,7 +57,8 @@ use crate::gpio::gpioe::{PE12, PE13, PE14, PE2, PE5, PE6};
5657
feature = "stm32f302xd",
5758
feature = "stm32f302xe",
5859
feature = "stm32f303xd",
59-
feature = "stm32f303xe"
60+
feature = "stm32f303xe",
61+
feature = "stm32f318",
6062
))]
6163
use crate::gpio::gpiof::PF1;
6264
#[cfg(any(
@@ -153,7 +155,8 @@ unsafe impl SckPin<SPI2> for PB13<AF5> {}
153155
feature = "stm32f302xd",
154156
feature = "stm32f302xe",
155157
feature = "stm32f303xd",
156-
feature = "stm32f303xe"
158+
feature = "stm32f303xe",
159+
feature = "stm32f318",
157160
))]
158161
unsafe impl SckPin<SPI2> for PF1<AF5> {}
159162
#[cfg(any(
@@ -182,7 +185,8 @@ unsafe impl SckPin<SPI2> for PF10<AF5> {}
182185
#[cfg(any(
183186
feature = "stm32f302",
184187
feature = "stm32f303xd",
185-
feature = "stm32f303xe"
188+
feature = "stm32f303xe",
189+
feature = "stm32f318",
186190
))]
187191
unsafe impl SckPin<SPI3> for PB3<AF6> {}
188192
unsafe impl SckPin<SPI3> for PC10<AF6> {}
@@ -218,15 +222,17 @@ unsafe impl MisoPin<SPI1> for PB4<AF5> {}
218222
feature = "stm32f302xd",
219223
feature = "stm32f302xe",
220224
feature = "stm32f303xd",
221-
feature = "stm32f303xe"
225+
feature = "stm32f303xe",
226+
feature = "stm32f318",
222227
))]
223228
unsafe impl MisoPin<SPI2> for PA10<AF5> {}
224229
unsafe impl MisoPin<SPI2> for PB14<AF5> {}
225230

226231
#[cfg(any(
227232
feature = "stm32f302",
228233
feature = "stm32f303xd",
229-
feature = "stm32f303xe"
234+
feature = "stm32f303xe",
235+
feature = "stm32f318",
230236
))]
231237
unsafe impl MisoPin<SPI3> for PB4<AF6> {}
232238
unsafe impl MisoPin<SPI3> for PC11<AF6> {}
@@ -255,7 +261,8 @@ unsafe impl MosiPin<SPI1> for PB5<AF5> {}
255261
feature = "stm32f302xd",
256262
feature = "stm32f302xe",
257263
feature = "stm32f303xd",
258-
feature = "stm32f303xe"
264+
feature = "stm32f303xe",
265+
feature = "stm32f318",
259266
))]
260267
unsafe impl MosiPin<SPI2> for PA11<AF5> {}
261268
unsafe impl MosiPin<SPI2> for PB15<AF5> {}
@@ -471,7 +478,7 @@ hal! {
471478
feature = "stm32f301",
472479
feature = "stm32f302x6",
473480
feature = "stm32f302x8",
474-
feature = "stm32f318"
481+
feature = "stm32f318",
475482
))]
476483
hal! {
477484
SPI2: (spi2, APB1, spi2en, spi2rst, pclk1),
@@ -483,7 +490,6 @@ hal! {
483490
feature = "stm32f302xc",
484491
feature = "stm32f303xb",
485492
feature = "stm32f303xc",
486-
feature = "stm32f318",
487493
feature = "stm32f328",
488494
feature = "stm32f358",
489495
feature = "stm32f373",

0 commit comments

Comments
 (0)