Skip to content

Commit 40fea79

Browse files
danielgallagher0Sh3Rm4n
authored andcommitted
Update SPI impls for STM32F398
Based on the datasheet, the following pins and peripherals are supported: - SPI1: - SCK: PA5<AF5>, PB3<AF5> - MISO: PA6<AF5>, PB4<AF5> - MOSI: PA7<AF5>, PB5<AF5> - SPI2: - SCK: PB13<AF5>, PF1<AF5>, PF9<AF5>, PF10<AF5> - MISO: PA10<AF5>, PB14<AF5> - MOSI: PA11<AF5>, PB15<AF5> - SPI3: - SCK: PB3<AF6>, PC10<AF6> - MISO: PB4<AF6>, PC11<AF6> - MOSI: PB5<AF6>, PC12<AF6> - SPI4: - SCK: PE2<AF5>, PE12<AF5> - MISO: PE5<AF5>, PE13<AF5> - MOSI: PE6<AF5>, PE14<AF5>
1 parent 3519f37 commit 40fea79

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

src/spi.rs

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ use crate::stm32::spi1;
1414
feature = "stm32f302xd",
1515
feature = "stm32f302xe",
1616
feature = "stm32f303xd",
17-
feature = "stm32f303xe"
17+
feature = "stm32f303xe",
18+
feature = "stm32f398",
1819
))]
1920
use crate::stm32::SPI4;
2021

@@ -28,6 +29,7 @@ use crate::gpio::gpioa::{PA1, PA10, PA12, PA13, PA2, PA3, PA8, PA9};
2829
feature = "stm32f303xd",
2930
feature = "stm32f303xe",
3031
feature = "stm32f318",
32+
feature = "stm32f398",
3133
))]
3234
use crate::gpio::gpioa::{PA10, PA11};
3335
use crate::gpio::gpioa::{PA5, PA6, PA7};
@@ -52,6 +54,7 @@ use crate::gpio::gpiob::{PB14, PB15, PB5};
5254
feature = "stm32f358",
5355
feature = "stm32f373",
5456
feature = "stm32f378",
57+
feature = "stm32f398",
5558
))]
5659
use crate::gpio::gpiob::{PB3, PB4};
5760
use crate::gpio::gpioc::{PC10, PC11, PC12};
@@ -63,7 +66,8 @@ use crate::gpio::gpiod::{PD3, PD4, PD7, PD8};
6366
feature = "stm32f302xd",
6467
feature = "stm32f302xe",
6568
feature = "stm32f303xd",
66-
feature = "stm32f303xe"
69+
feature = "stm32f303xe",
70+
feature = "stm32f398",
6771
))]
6872
use crate::gpio::gpioe::{PE12, PE13, PE14, PE2, PE5, PE6};
6973
#[cfg(any(
@@ -74,6 +78,7 @@ use crate::gpio::gpioe::{PE12, PE13, PE14, PE2, PE5, PE6};
7478
feature = "stm32f303xd",
7579
feature = "stm32f303xe",
7680
feature = "stm32f318",
81+
feature = "stm32f398",
7782
))]
7883
use crate::gpio::gpiof::PF1;
7984
#[cfg(any(feature = "stm32f373", feature = "stm32f378"))]
@@ -88,6 +93,7 @@ use crate::gpio::gpiof::PF6;
8893
feature = "stm32f303xd",
8994
feature = "stm32f303xe",
9095
feature = "stm32f358",
96+
feature = "stm32f398",
9197
))]
9298
use crate::gpio::gpiof::{PF10, PF9};
9399
use crate::gpio::{AF5, AF6};
@@ -158,6 +164,7 @@ unsafe impl SckPin<SPI1> for PA12<AF6> {}
158164
feature = "stm32f358",
159165
feature = "stm32f373",
160166
feature = "stm32f378",
167+
feature = "stm32f398",
161168
))]
162169
unsafe impl SckPin<SPI1> for PB3<AF5> {}
163170
#[cfg(any(feature = "stm32f373", feature = "stm32f378"))]
@@ -191,6 +198,7 @@ unsafe impl SckPin<SPI2> for PD8<AF5> {}
191198
feature = "stm32f303xd",
192199
feature = "stm32f303xe",
193200
feature = "stm32f318",
201+
feature = "stm32f398",
194202
))]
195203
unsafe impl SckPin<SPI2> for PF1<AF5> {}
196204
#[cfg(any(
@@ -203,6 +211,7 @@ unsafe impl SckPin<SPI2> for PF1<AF5> {}
203211
feature = "stm32f303xd",
204212
feature = "stm32f303xe",
205213
feature = "stm32f358",
214+
feature = "stm32f398",
206215
))]
207216
unsafe impl SckPin<SPI2> for PF9<AF5> {}
208217
#[cfg(any(
@@ -215,6 +224,7 @@ unsafe impl SckPin<SPI2> for PF9<AF5> {}
215224
feature = "stm32f303xd",
216225
feature = "stm32f303xe",
217226
feature = "stm32f358",
227+
feature = "stm32f398",
218228
))]
219229
unsafe impl SckPin<SPI2> for PF10<AF5> {}
220230

@@ -227,6 +237,7 @@ unsafe impl SckPin<SPI3> for PA1<AF6> {}
227237
feature = "stm32f318",
228238
feature = "stm32f373",
229239
feature = "stm32f378",
240+
feature = "stm32f398",
230241
))]
231242
unsafe impl SckPin<SPI3> for PB3<AF6> {}
232243
unsafe impl SckPin<SPI3> for PC10<AF6> {}
@@ -235,14 +246,16 @@ unsafe impl SckPin<SPI3> for PC10<AF6> {}
235246
feature = "stm32f302xd",
236247
feature = "stm32f302xe",
237248
feature = "stm32f303xd",
238-
feature = "stm32f303xe"
249+
feature = "stm32f303xe",
250+
feature = "stm32f398",
239251
))]
240252
unsafe impl SckPin<SPI4> for PE2<AF5> {}
241253
#[cfg(any(
242254
feature = "stm32f302xd",
243255
feature = "stm32f302xe",
244256
feature = "stm32f303xd",
245-
feature = "stm32f303xe"
257+
feature = "stm32f303xe",
258+
feature = "stm32f398",
246259
))]
247260
unsafe impl SckPin<SPI4> for PE12<AF5> {}
248261

@@ -259,6 +272,7 @@ unsafe impl MisoPin<SPI1> for PA13<AF6> {}
259272
feature = "stm32f358",
260273
feature = "stm32f373",
261274
feature = "stm32f378",
275+
feature = "stm32f398",
262276
))]
263277
unsafe impl MisoPin<SPI1> for PB4<AF5> {}
264278
#[cfg(any(feature = "stm32f373", feature = "stm32f378"))]
@@ -274,6 +288,7 @@ unsafe impl MisoPin<SPI2> for PA9<AF5> {}
274288
feature = "stm32f303xd",
275289
feature = "stm32f303xe",
276290
feature = "stm32f318",
291+
feature = "stm32f398",
277292
))]
278293
unsafe impl MisoPin<SPI2> for PA10<AF5> {}
279294
unsafe impl MisoPin<SPI2> for PB14<AF5> {}
@@ -291,6 +306,7 @@ unsafe impl MisoPin<SPI3> for PA2<AF6> {}
291306
feature = "stm32f318",
292307
feature = "stm32f373",
293308
feature = "stm32f378",
309+
feature = "stm32f398",
294310
))]
295311
unsafe impl MisoPin<SPI3> for PB4<AF6> {}
296312
unsafe impl MisoPin<SPI3> for PC11<AF6> {}
@@ -299,14 +315,16 @@ unsafe impl MisoPin<SPI3> for PC11<AF6> {}
299315
feature = "stm32f302xd",
300316
feature = "stm32f302xe",
301317
feature = "stm32f303xd",
302-
feature = "stm32f303xe"
318+
feature = "stm32f303xe",
319+
feature = "stm32f398",
303320
))]
304321
unsafe impl MisoPin<SPI4> for PE5<AF5> {}
305322
#[cfg(any(
306323
feature = "stm32f302xd",
307324
feature = "stm32f302xe",
308325
feature = "stm32f303xd",
309-
feature = "stm32f303xe"
326+
feature = "stm32f303xe",
327+
feature = "stm32f398",
310328
))]
311329
unsafe impl MisoPin<SPI4> for PE13<AF5> {}
312330

@@ -329,6 +347,7 @@ unsafe impl MosiPin<SPI2> for PA10<AF5> {}
329347
feature = "stm32f303xd",
330348
feature = "stm32f303xe",
331349
feature = "stm32f318",
350+
feature = "stm32f398",
332351
))]
333352
unsafe impl MosiPin<SPI2> for PA11<AF5> {}
334353
unsafe impl MosiPin<SPI2> for PB15<AF5> {}
@@ -346,14 +365,16 @@ unsafe impl MosiPin<SPI3> for PC12<AF6> {}
346365
feature = "stm32f302xd",
347366
feature = "stm32f302xe",
348367
feature = "stm32f303xd",
349-
feature = "stm32f303xe"
368+
feature = "stm32f303xe",
369+
feature = "stm32f398",
350370
))]
351371
unsafe impl MosiPin<SPI4> for PE6<AF5> {}
352372
#[cfg(any(
353373
feature = "stm32f302xd",
354374
feature = "stm32f302xe",
355375
feature = "stm32f303xd",
356-
feature = "stm32f303xe"
376+
feature = "stm32f303xe",
377+
feature = "stm32f398",
357378
))]
358379
unsafe impl MosiPin<SPI4> for PE14<AF5> {}
359380

@@ -566,7 +587,6 @@ hal! {
566587
feature = "stm32f358",
567588
feature = "stm32f373",
568589
feature = "stm32f378",
569-
feature = "stm32f398"
570590
))]
571591
hal! {
572592
SPI1: (spi1, APB2, spi1en, spi1rst, pclk2),
@@ -578,7 +598,8 @@ hal! {
578598
feature = "stm32f302xd",
579599
feature = "stm32f302xe",
580600
feature = "stm32f303xd",
581-
feature = "stm32f303xe"
601+
feature = "stm32f303xe",
602+
feature = "stm32f398",
582603
))]
583604
hal! {
584605
SPI1: (spi1, APB2, spi1en, spi1rst, pclk2),

0 commit comments

Comments
 (0)