@@ -9,16 +9,12 @@ use crate::pac::{
9
9
SPI1 , SPI2 , SPI3 ,
10
10
} ;
11
11
use crate :: stm32:: spi1;
12
- #[ cfg( any(
13
- feature = "stm32f303xb" ,
14
- feature = "stm32f303xc" ,
15
- feature = "stm32f303xd" ,
16
- feature = "stm32f303xe"
17
- ) ) ]
12
+
13
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
18
14
use crate :: stm32:: SPI4 ;
19
15
use nb;
20
16
21
- #[ cfg( feature = "stm32f303" ) ]
17
+ #[ cfg( any ( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
22
18
use crate :: gpio:: gpioa:: { PA10 , PA11 } ;
23
19
use crate :: gpio:: gpioa:: { PA5 , PA6 , PA7 } ;
24
20
#[ cfg( any(
@@ -36,26 +32,26 @@ use crate::gpio::gpiob::{PB14, PB15, PB5};
36
32
#[ cfg( feature = "stm32f303" ) ]
37
33
use crate :: gpio:: gpiob:: { PB3 , PB4 } ;
38
34
use crate :: gpio:: gpioc:: { PC10 , PC11 , PC12 } ;
39
- #[ cfg( any(
40
- feature = "stm32f303xb" ,
41
- feature = "stm32f303xc" ,
42
- feature = "stm32f303xd" ,
43
- feature = "stm32f303xe"
44
- ) ) ]
35
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
45
36
use crate :: gpio:: gpioe:: { PE12 , PE13 , PE14 , PE2 , PE5 , PE6 } ;
37
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
38
+ use crate :: gpio:: gpiof:: PF1 ;
46
39
#[ cfg( any(
47
40
feature = "stm32f303xb" ,
48
41
feature = "stm32f303xc" ,
49
42
feature = "stm32f303xd" ,
50
43
feature = "stm32f303xe"
51
44
) ) ]
52
- use crate :: gpio:: gpiof:: { PF1 , PF10 , PF9 } ;
45
+ use crate :: gpio:: gpiof:: { PF10 , PF9 } ;
53
46
use crate :: gpio:: { AF5 , AF6 } ;
54
47
use crate :: rcc:: Clocks ;
55
48
#[ cfg( any(
56
49
feature = "stm32f301" ,
57
50
feature = "stm32f302" ,
58
- feature = "stm32f303" ,
51
+ feature = "stm32f303xb" ,
52
+ feature = "stm32f303xc" ,
53
+ feature = "stm32f303xd" ,
54
+ feature = "stm32f303xe" ,
59
55
feature = "stm32f318" ,
60
56
feature = "stm32f328" ,
61
57
feature = "stm32f358" ,
@@ -115,12 +111,7 @@ unsafe impl SckPin<SPI1> for PB3<AF5> {}
115
111
feature = "stm32f398"
116
112
) ) ]
117
113
unsafe impl SckPin < SPI2 > for PB13 < AF5 > { }
118
- #[ cfg( any(
119
- feature = "stm32f303xb" ,
120
- feature = "stm32f303xc" ,
121
- feature = "stm32f303xd" ,
122
- feature = "stm32f303xe"
123
- ) ) ]
114
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
124
115
unsafe impl SckPin < SPI2 > for PF1 < AF5 > { }
125
116
#[ cfg( any(
126
117
feature = "stm32f303xb" ,
@@ -137,75 +128,45 @@ unsafe impl SckPin<SPI2> for PF9<AF5> {}
137
128
) ) ]
138
129
unsafe impl SckPin < SPI2 > for PF10 < AF5 > { }
139
130
140
- #[ cfg( feature = "stm32f303" ) ]
131
+ #[ cfg( any ( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
141
132
unsafe impl SckPin < SPI3 > for PB3 < AF6 > { }
142
133
unsafe impl SckPin < SPI3 > for PC10 < AF6 > { }
143
134
144
- #[ cfg( any(
145
- feature = "stm32f303xb" ,
146
- feature = "stm32f303xc" ,
147
- feature = "stm32f303xd" ,
148
- feature = "stm32f303xe"
149
- ) ) ]
135
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
150
136
unsafe impl SckPin < SPI4 > for PE2 < AF5 > { }
151
- #[ cfg( any(
152
- feature = "stm32f303xb" ,
153
- feature = "stm32f303xc" ,
154
- feature = "stm32f303xd" ,
155
- feature = "stm32f303xe"
156
- ) ) ]
137
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
157
138
unsafe impl SckPin < SPI4 > for PE12 < AF5 > { }
158
139
159
140
unsafe impl MisoPin < SPI1 > for PA6 < AF5 > { }
160
141
#[ cfg( feature = "stm32f303" ) ]
161
142
unsafe impl MisoPin < SPI1 > for PB4 < AF5 > { }
162
143
163
- #[ cfg( any( feature = "stm32f303 " ) ) ]
144
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe ") ) ]
164
145
unsafe impl MisoPin < SPI2 > for PA10 < AF5 > { }
165
146
unsafe impl MisoPin < SPI2 > for PB14 < AF5 > { }
166
147
167
- #[ cfg( any(
168
- feature = "stm32f303xb" ,
169
- feature = "stm32f303xc" ,
170
- feature = "stm32f303xd" ,
171
- feature = "stm32f303xe"
172
- ) ) ]
173
- unsafe impl MisoPin < SPI4 > for PE5 < AF5 > { }
174
- #[ cfg( any(
175
- feature = "stm32f303xb" ,
176
- feature = "stm32f303xc" ,
177
- feature = "stm32f303xd" ,
178
- feature = "stm32f303xe"
179
- ) ) ]
180
- unsafe impl MisoPin < SPI4 > for PE13 < AF5 > { }
181
-
182
- #[ cfg( any( feature = "stm32f303" ) ) ]
148
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
183
149
unsafe impl MisoPin < SPI3 > for PB4 < AF6 > { }
184
150
unsafe impl MisoPin < SPI3 > for PC11 < AF6 > { }
185
151
152
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
153
+ unsafe impl MisoPin < SPI4 > for PE5 < AF5 > { }
154
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
155
+ unsafe impl MisoPin < SPI4 > for PE13 < AF5 > { }
156
+
186
157
unsafe impl MosiPin < SPI1 > for PA7 < AF5 > { }
187
158
unsafe impl MosiPin < SPI1 > for PB5 < AF5 > { }
188
159
189
- #[ cfg( any( feature = "stm32f303 " ) ) ]
160
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe ") ) ]
190
161
unsafe impl MosiPin < SPI2 > for PA11 < AF5 > { }
191
162
unsafe impl MosiPin < SPI2 > for PB15 < AF5 > { }
192
163
193
164
unsafe impl MosiPin < SPI3 > for PB5 < AF6 > { }
194
165
unsafe impl MosiPin < SPI3 > for PC12 < AF6 > { }
195
166
196
- #[ cfg( any(
197
- feature = "stm32f303xb" ,
198
- feature = "stm32f303xc" ,
199
- feature = "stm32f303xd" ,
200
- feature = "stm32f303xe"
201
- ) ) ]
167
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
202
168
unsafe impl MosiPin < SPI4 > for PE6 < AF5 > { }
203
- #[ cfg( any(
204
- feature = "stm32f303xb" ,
205
- feature = "stm32f303xc" ,
206
- feature = "stm32f303xd" ,
207
- feature = "stm32f303xe"
208
- ) ) ]
169
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
209
170
unsafe impl MosiPin < SPI4 > for PE14 < AF5 > { }
210
171
211
172
pub trait Word {
@@ -388,7 +349,11 @@ macro_rules! hal {
388
349
}
389
350
}
390
351
391
- #[ cfg( feature = "stm32f334" ) ]
352
+ #[ cfg( any(
353
+ feature = "stm32f303x6" ,
354
+ feature = "stm32f303x8" ,
355
+ feature = "stm32f334" ,
356
+ ) ) ]
392
357
hal ! {
393
358
SPI1 : ( spi1, APB2 , spi1en, spi1rst, pclk2) ,
394
359
}
@@ -401,7 +366,9 @@ hal! {
401
366
402
367
#[ cfg( any(
403
368
feature = "stm32f302" ,
404
- feature = "stm32f303" ,
369
+ feature = "stm32f303xb" ,
370
+ feature = "stm32f303xc" ,
371
+ feature = "stm32f318" ,
405
372
feature = "stm32f328" ,
406
373
feature = "stm32f358" ,
407
374
feature = "stm32f373" ,
@@ -414,6 +381,14 @@ hal! {
414
381
SPI3 : ( spi3, APB1 , spi3en, spi3rst, pclk1) ,
415
382
}
416
383
384
+ #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
385
+ hal ! {
386
+ SPI1 : ( spi1, APB2 , spi1en, spi1rst, pclk2) ,
387
+ SPI2 : ( spi2, APB1 , spi2en, spi2rst, pclk1) ,
388
+ SPI3 : ( spi3, APB1 , spi3en, spi3rst, pclk1) ,
389
+ SPI4 : ( spi4, APB2 , spi4en, spi4rst, pclk2) ,
390
+ }
391
+
417
392
// FIXME not working
418
393
// TODO measure if this actually faster than the default implementation
419
394
// impl ::hal::blocking::spi::Write<u8> for Spi {
0 commit comments