@@ -9,7 +9,17 @@ 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
+ ) ) ]
18
+ use crate :: stm32:: SPI4 ;
19
+ use nb;
12
20
21
+ #[ cfg( feature = "stm32f303" ) ]
22
+ use crate :: gpio:: gpioa:: { PA10 , PA11 } ;
13
23
use crate :: gpio:: gpioa:: { PA5 , PA6 , PA7 } ;
14
24
#[ cfg( any(
15
25
feature = "stm32f301" ,
@@ -23,7 +33,23 @@ use crate::gpio::gpioa::{PA5, PA6, PA7};
23
33
) ) ]
24
34
use crate :: gpio:: gpiob:: PB13 ;
25
35
use crate :: gpio:: gpiob:: { PB14 , PB15 , PB5 } ;
36
+ #[ cfg( feature = "stm32f303" ) ]
37
+ use crate :: gpio:: gpiob:: { PB3 , PB4 } ;
26
38
use crate :: gpio:: gpioc:: { PC10 , PC11 , PC12 } ;
39
+ #[ cfg( any(
40
+ feature = "stm32f303xb" ,
41
+ feature = "stm32f303xc" ,
42
+ feature = "stm32f303xd" ,
43
+ feature = "stm32f303xe"
44
+ ) ) ]
45
+ use crate :: gpio:: gpioe:: { PE12 , PE13 , PE14 , PE2 , PE5 , PE6 } ;
46
+ #[ cfg( any(
47
+ feature = "stm32f303xb" ,
48
+ feature = "stm32f303xc" ,
49
+ feature = "stm32f303xd" ,
50
+ feature = "stm32f303xe"
51
+ ) ) ]
52
+ use crate :: gpio:: gpiof:: { PF1 , PF10 , PF9 } ;
27
53
use crate :: gpio:: { AF5 , AF6 } ;
28
54
use crate :: rcc:: Clocks ;
29
55
#[ cfg( any(
@@ -75,7 +101,8 @@ pub unsafe trait MisoPin<SPI> {}
75
101
pub unsafe trait MosiPin < SPI > { }
76
102
77
103
unsafe impl SckPin < SPI1 > for PA5 < AF5 > { }
78
- // unsafe impl SckPin<SPI1> for PB3<AF5> {}
104
+ #[ cfg( feature = "stm32f303" ) ]
105
+ unsafe impl SckPin < SPI1 > for PB3 < AF5 > { }
79
106
80
107
#[ cfg( any(
81
108
feature = "stm32f301" ,
@@ -88,26 +115,99 @@ unsafe impl SckPin<SPI1> for PA5<AF5> {}
88
115
feature = "stm32f398"
89
116
) ) ]
90
117
unsafe impl SckPin < SPI2 > for PB13 < AF5 > { }
118
+ #[ cfg( any(
119
+ feature = "stm32f303xb" ,
120
+ feature = "stm32f303xc" ,
121
+ feature = "stm32f303xd" ,
122
+ feature = "stm32f303xe"
123
+ ) ) ]
124
+ unsafe impl SckPin < SPI2 > for PF1 < AF5 > { }
125
+ #[ cfg( any(
126
+ feature = "stm32f303xb" ,
127
+ feature = "stm32f303xc" ,
128
+ feature = "stm32f303xd" ,
129
+ feature = "stm32f303xe"
130
+ ) ) ]
131
+ unsafe impl SckPin < SPI2 > for PF9 < AF5 > { }
132
+ #[ cfg( any(
133
+ feature = "stm32f303xb" ,
134
+ feature = "stm32f303xc" ,
135
+ feature = "stm32f303xd" ,
136
+ feature = "stm32f303xe"
137
+ ) ) ]
138
+ unsafe impl SckPin < SPI2 > for PF10 < AF5 > { }
91
139
92
- // unsafe impl SckPin<SPI3> for PB3<AF6> {}
140
+ #[ cfg( feature = "stm32f303" ) ]
141
+ unsafe impl SckPin < SPI3 > for PB3 < AF6 > { }
93
142
unsafe impl SckPin < SPI3 > for PC10 < AF6 > { }
94
143
144
+ #[ cfg( any(
145
+ feature = "stm32f303xb" ,
146
+ feature = "stm32f303xc" ,
147
+ feature = "stm32f303xd" ,
148
+ feature = "stm32f303xe"
149
+ ) ) ]
150
+ unsafe impl SckPin < SPI4 > for PE2 < AF5 > { }
151
+ #[ cfg( any(
152
+ feature = "stm32f303xb" ,
153
+ feature = "stm32f303xc" ,
154
+ feature = "stm32f303xd" ,
155
+ feature = "stm32f303xe"
156
+ ) ) ]
157
+ unsafe impl SckPin < SPI4 > for PE12 < AF5 > { }
158
+
95
159
unsafe impl MisoPin < SPI1 > for PA6 < AF5 > { }
96
- // unsafe impl MisoPin<SPI1> for PB4<AF5> {}
160
+ #[ cfg( feature = "stm32f303" ) ]
161
+ unsafe impl MisoPin < SPI1 > for PB4 < AF5 > { }
97
162
163
+ #[ cfg( any( feature = "stm32f303" ) ) ]
164
+ unsafe impl MisoPin < SPI2 > for PA10 < AF5 > { }
98
165
unsafe impl MisoPin < SPI2 > for PB14 < AF5 > { }
99
166
100
- // unsafe impl MisoPin<SPI3> for PB4<AF6> {}
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" ) ) ]
183
+ unsafe impl MisoPin < SPI3 > for PB4 < AF6 > { }
101
184
unsafe impl MisoPin < SPI3 > for PC11 < AF6 > { }
102
185
103
186
unsafe impl MosiPin < SPI1 > for PA7 < AF5 > { }
104
187
unsafe impl MosiPin < SPI1 > for PB5 < AF5 > { }
105
188
189
+ #[ cfg( any( feature = "stm32f303" ) ) ]
190
+ unsafe impl MosiPin < SPI2 > for PA11 < AF5 > { }
106
191
unsafe impl MosiPin < SPI2 > for PB15 < AF5 > { }
107
192
108
193
unsafe impl MosiPin < SPI3 > for PB5 < AF6 > { }
109
194
unsafe impl MosiPin < SPI3 > for PC12 < AF6 > { }
110
195
196
+ #[ cfg( any(
197
+ feature = "stm32f303xb" ,
198
+ feature = "stm32f303xc" ,
199
+ feature = "stm32f303xd" ,
200
+ feature = "stm32f303xe"
201
+ ) ) ]
202
+ unsafe impl MosiPin < SPI4 > for PE6 < AF5 > { }
203
+ #[ cfg( any(
204
+ feature = "stm32f303xb" ,
205
+ feature = "stm32f303xc" ,
206
+ feature = "stm32f303xd" ,
207
+ feature = "stm32f303xe"
208
+ ) ) ]
209
+ unsafe impl MosiPin < SPI4 > for PE14 < AF5 > { }
210
+
111
211
pub trait Word {
112
212
fn register_config ( ) -> ( FRXTH_A , DS_A ) ;
113
213
}
0 commit comments