@@ -10,11 +10,22 @@ use crate::pac::{
10
10
} ;
11
11
use crate :: stm32:: spi1;
12
12
13
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
13
+ #[ cfg( any(
14
+ feature = "stm32f302xd" ,
15
+ feature = "stm32f302xe" ,
16
+ feature = "stm32f303xd" ,
17
+ feature = "stm32f303xe"
18
+ ) ) ]
14
19
use crate :: stm32:: SPI4 ;
15
- use nb;
16
20
17
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
21
+ #[ cfg( any(
22
+ feature = "stm32f302x6" ,
23
+ feature = "stm32f302x8" ,
24
+ feature = "stm32f302xd" ,
25
+ feature = "stm32f302xe" ,
26
+ feature = "stm32f303xd" ,
27
+ feature = "stm32f303xe"
28
+ ) ) ]
18
29
use crate :: gpio:: gpioa:: { PA10 , PA11 } ;
19
30
use crate :: gpio:: gpioa:: { PA5 , PA6 , PA7 } ;
20
31
#[ cfg( any(
@@ -29,14 +40,30 @@ use crate::gpio::gpioa::{PA5, PA6, PA7};
29
40
) ) ]
30
41
use crate :: gpio:: gpiob:: PB13 ;
31
42
use crate :: gpio:: gpiob:: { PB14 , PB15 , PB5 } ;
32
- #[ cfg( feature = "stm32f303" ) ]
43
+ #[ cfg( any ( feature = "stm32f302" , feature = " stm32f303") ) ]
33
44
use crate :: gpio:: gpiob:: { PB3 , PB4 } ;
34
45
use crate :: gpio:: gpioc:: { PC10 , PC11 , PC12 } ;
35
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
46
+ #[ cfg( any(
47
+ feature = "stm32f302xd" ,
48
+ feature = "stm32f302xe" ,
49
+ feature = "stm32f303xd" ,
50
+ feature = "stm32f303xe"
51
+ ) ) ]
36
52
use crate :: gpio:: gpioe:: { PE12 , PE13 , PE14 , PE2 , PE5 , PE6 } ;
37
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
53
+ #[ cfg( any(
54
+ feature = "stm32f302x6" ,
55
+ feature = "stm32f302x8" ,
56
+ feature = "stm32f302xd" ,
57
+ feature = "stm32f302xe" ,
58
+ feature = "stm32f303xd" ,
59
+ feature = "stm32f303xe"
60
+ ) ) ]
38
61
use crate :: gpio:: gpiof:: PF1 ;
39
62
#[ cfg( any(
63
+ feature = "stm32f302xb" ,
64
+ feature = "stm32f302xc" ,
65
+ feature = "stm32f302xd" ,
66
+ feature = "stm32f302xe" ,
40
67
feature = "stm32f303xb" ,
41
68
feature = "stm32f303xc" ,
42
69
feature = "stm32f303xd" ,
@@ -61,7 +88,10 @@ use crate::rcc::Clocks;
61
88
) ) ]
62
89
use crate :: rcc:: APB1 ;
63
90
#[ cfg( any(
64
- feature = "stm32f302" ,
91
+ feature = "stm32f302xb" ,
92
+ feature = "stm32f302xc" ,
93
+ feature = "stm32f302xd" ,
94
+ feature = "stm32f302xe" ,
65
95
feature = "stm32f303" ,
66
96
feature = "stm32f328" ,
67
97
feature = "stm32f334" ,
@@ -97,7 +127,13 @@ pub unsafe trait MisoPin<SPI> {}
97
127
pub unsafe trait MosiPin < SPI > { }
98
128
99
129
unsafe impl SckPin < SPI1 > for PA5 < AF5 > { }
100
- #[ cfg( feature = "stm32f303" ) ]
130
+ #[ cfg( any(
131
+ feature = "stm32f302xb" ,
132
+ feature = "stm32f302xc" ,
133
+ feature = "stm32f302xd" ,
134
+ feature = "stm32f302xe" ,
135
+ feature = "stm32f303"
136
+ ) ) ]
101
137
unsafe impl SckPin < SPI1 > for PB3 < AF5 > { }
102
138
103
139
#[ cfg( any(
@@ -111,62 +147,135 @@ unsafe impl SckPin<SPI1> for PB3<AF5> {}
111
147
feature = "stm32f398"
112
148
) ) ]
113
149
unsafe impl SckPin < SPI2 > for PB13 < AF5 > { }
114
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
150
+ #[ cfg( any(
151
+ feature = "stm32f302x6" ,
152
+ feature = "stm32f302x8" ,
153
+ feature = "stm32f302xd" ,
154
+ feature = "stm32f302xe" ,
155
+ feature = "stm32f303xd" ,
156
+ feature = "stm32f303xe"
157
+ ) ) ]
115
158
unsafe impl SckPin < SPI2 > for PF1 < AF5 > { }
116
159
#[ cfg( any(
160
+ feature = "stm32f302xb" ,
161
+ feature = "stm32f302xc" ,
162
+ feature = "stm32f302xd" ,
163
+ feature = "stm32f302xe" ,
117
164
feature = "stm32f303xb" ,
118
165
feature = "stm32f303xc" ,
119
166
feature = "stm32f303xd" ,
120
167
feature = "stm32f303xe"
121
168
) ) ]
122
169
unsafe impl SckPin < SPI2 > for PF9 < AF5 > { }
123
170
#[ cfg( any(
171
+ feature = "stm32f302xb" ,
172
+ feature = "stm32f302xc" ,
173
+ feature = "stm32f302xd" ,
174
+ feature = "stm32f302xe" ,
124
175
feature = "stm32f303xb" ,
125
176
feature = "stm32f303xc" ,
126
177
feature = "stm32f303xd" ,
127
178
feature = "stm32f303xe"
128
179
) ) ]
129
180
unsafe impl SckPin < SPI2 > for PF10 < AF5 > { }
130
181
131
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
182
+ #[ cfg( any(
183
+ feature = "stm32f302" ,
184
+ feature = "stm32f303xd" ,
185
+ feature = "stm32f303xe"
186
+ ) ) ]
132
187
unsafe impl SckPin < SPI3 > for PB3 < AF6 > { }
133
188
unsafe impl SckPin < SPI3 > for PC10 < AF6 > { }
134
189
135
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
190
+ #[ cfg( any(
191
+ feature = "stm32f302xd" ,
192
+ feature = "stm32f302xe" ,
193
+ feature = "stm32f303xd" ,
194
+ feature = "stm32f303xe"
195
+ ) ) ]
136
196
unsafe impl SckPin < SPI4 > for PE2 < AF5 > { }
137
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
197
+ #[ cfg( any(
198
+ feature = "stm32f302xd" ,
199
+ feature = "stm32f302xe" ,
200
+ feature = "stm32f303xd" ,
201
+ feature = "stm32f303xe"
202
+ ) ) ]
138
203
unsafe impl SckPin < SPI4 > for PE12 < AF5 > { }
139
204
140
205
unsafe impl MisoPin < SPI1 > for PA6 < AF5 > { }
141
- #[ cfg( feature = "stm32f303" ) ]
206
+ #[ cfg( any(
207
+ feature = "stm32f302xb" ,
208
+ feature = "stm32f302xc" ,
209
+ feature = "stm32f302xd" ,
210
+ feature = "stm32f302xe" ,
211
+ feature = "stm32f303"
212
+ ) ) ]
142
213
unsafe impl MisoPin < SPI1 > for PB4 < AF5 > { }
143
214
144
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
215
+ #[ cfg( any(
216
+ feature = "stm32f302x6" ,
217
+ feature = "stm32f302x8" ,
218
+ feature = "stm32f302xd" ,
219
+ feature = "stm32f302xe" ,
220
+ feature = "stm32f303xd" ,
221
+ feature = "stm32f303xe"
222
+ ) ) ]
145
223
unsafe impl MisoPin < SPI2 > for PA10 < AF5 > { }
146
224
unsafe impl MisoPin < SPI2 > for PB14 < AF5 > { }
147
225
148
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
226
+ #[ cfg( any(
227
+ feature = "stm32f302" ,
228
+ feature = "stm32f303xd" ,
229
+ feature = "stm32f303xe"
230
+ ) ) ]
149
231
unsafe impl MisoPin < SPI3 > for PB4 < AF6 > { }
150
232
unsafe impl MisoPin < SPI3 > for PC11 < AF6 > { }
151
233
152
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
234
+ #[ cfg( any(
235
+ feature = "stm32f302xd" ,
236
+ feature = "stm32f302xe" ,
237
+ feature = "stm32f303xd" ,
238
+ feature = "stm32f303xe"
239
+ ) ) ]
153
240
unsafe impl MisoPin < SPI4 > for PE5 < AF5 > { }
154
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
241
+ #[ cfg( any(
242
+ feature = "stm32f302xd" ,
243
+ feature = "stm32f302xe" ,
244
+ feature = "stm32f303xd" ,
245
+ feature = "stm32f303xe"
246
+ ) ) ]
155
247
unsafe impl MisoPin < SPI4 > for PE13 < AF5 > { }
156
248
157
249
unsafe impl MosiPin < SPI1 > for PA7 < AF5 > { }
158
250
unsafe impl MosiPin < SPI1 > for PB5 < AF5 > { }
159
251
160
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
252
+ #[ cfg( any(
253
+ feature = "stm32f302x6" ,
254
+ feature = "stm32f302x8" ,
255
+ feature = "stm32f302xd" ,
256
+ feature = "stm32f302xe" ,
257
+ feature = "stm32f303xd" ,
258
+ feature = "stm32f303xe"
259
+ ) ) ]
161
260
unsafe impl MosiPin < SPI2 > for PA11 < AF5 > { }
162
261
unsafe impl MosiPin < SPI2 > for PB15 < AF5 > { }
163
262
164
263
unsafe impl MosiPin < SPI3 > for PB5 < AF6 > { }
165
264
unsafe impl MosiPin < SPI3 > for PC12 < AF6 > { }
166
265
167
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
266
+ #[ cfg( any(
267
+ feature = "stm32f302xd" ,
268
+ feature = "stm32f302xe" ,
269
+ feature = "stm32f303xd" ,
270
+ feature = "stm32f303xe"
271
+ ) ) ]
168
272
unsafe impl MosiPin < SPI4 > for PE6 < AF5 > { }
169
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
273
+ #[ cfg( any(
274
+ feature = "stm32f302xd" ,
275
+ feature = "stm32f302xe" ,
276
+ feature = "stm32f303xd" ,
277
+ feature = "stm32f303xe"
278
+ ) ) ]
170
279
unsafe impl MosiPin < SPI4 > for PE14 < AF5 > { }
171
280
172
281
pub trait Word {
@@ -358,14 +467,20 @@ hal! {
358
467
SPI1 : ( spi1, APB2 , spi1en, spi1rst, pclk2) ,
359
468
}
360
469
361
- #[ cfg( any( feature = "stm32f301" , feature = "stm32f318" ) ) ]
470
+ #[ cfg( any(
471
+ feature = "stm32f301" ,
472
+ feature = "stm32f302x6" ,
473
+ feature = "stm32f302x8" ,
474
+ feature = "stm32f318"
475
+ ) ) ]
362
476
hal ! {
363
477
SPI2 : ( spi2, APB1 , spi2en, spi2rst, pclk1) ,
364
478
SPI3 : ( spi3, APB1 , spi3en, spi3rst, pclk1) ,
365
479
}
366
480
367
481
#[ cfg( any(
368
- feature = "stm32f302" ,
482
+ feature = "stm32f302xb" ,
483
+ feature = "stm32f302xc" ,
369
484
feature = "stm32f303xb" ,
370
485
feature = "stm32f303xc" ,
371
486
feature = "stm32f318" ,
@@ -381,7 +496,12 @@ hal! {
381
496
SPI3 : ( spi3, APB1 , spi3en, spi3rst, pclk1) ,
382
497
}
383
498
384
- #[ cfg( any( feature = "stm32f303xd" , feature = "stm32f303xe" ) ) ]
499
+ #[ cfg( any(
500
+ feature = "stm32f302xd" ,
501
+ feature = "stm32f302xe" ,
502
+ feature = "stm32f303xd" ,
503
+ feature = "stm32f303xe"
504
+ ) ) ]
385
505
hal ! {
386
506
SPI1 : ( spi1, APB2 , spi1en, spi1rst, pclk2) ,
387
507
SPI2 : ( spi2, APB1 , spi2en, spi2rst, pclk1) ,
0 commit comments