1use super::{HwCsProvider, PinMiso0, PinMiso1, PinMosi0, PinMosi1, PinSck0, PinSck1};
2use crate::FunctionSelect;
3use crate::gpio::{DynPinId, PinId};
4use crate::pins::AnyPin;
5
6use crate::pins::{
7 Pa10, Pa11, Pa12, Pa13, Pa14, Pa15, Pa16, Pa17, Pa18, Pa19, Pa20, Pa21, Pa22, Pa23, Pa24, Pa25,
8 Pa26, Pa27, Pa28, Pa29, Pa30, Pa31, Pb0, Pb1, Pb2, Pb3, Pb4, Pb5, Pb6, Pb7, Pb8, Pb9, Pb10,
9 Pb11, Pb12, Pb13, Pb14, Pb15, Pb16, Pb17, Pb18, Pb19, Pb22, Pb23, Pin,
10};
11
12use super::{Bank, HwChipSelectId};
13
14impl PinSck0 for Pin<Pa31> {
17 const SPI_ID: Bank = Bank::Spi0;
18 const FUN_SEL: FunctionSelect = FunctionSelect::Sel1;
19}
20impl PinMosi0 for Pin<Pa30> {
21 const SPI_ID: Bank = Bank::Spi0;
22 const FUN_SEL: FunctionSelect = FunctionSelect::Sel1;
23}
24impl PinMiso0 for Pin<Pa29> {
25 const SPI_ID: Bank = Bank::Spi0;
26 const FUN_SEL: FunctionSelect = FunctionSelect::Sel1;
27}
28
29impl PinSck0 for Pin<Pb9> {
30 const SPI_ID: Bank = Bank::Spi0;
31 const FUN_SEL: FunctionSelect = FunctionSelect::Sel2;
32}
33impl PinMosi0 for Pin<Pb8> {
34 const SPI_ID: Bank = Bank::Spi0;
35 const FUN_SEL: FunctionSelect = FunctionSelect::Sel2;
36}
37impl PinMiso0 for Pin<Pb7> {
38 const SPI_ID: Bank = Bank::Spi0;
39 const FUN_SEL: FunctionSelect = FunctionSelect::Sel2;
40}
41
42hw_cs_pins!(
43 Bank::Spi0,
44 (Pb0, FunctionSelect::Sel2, HwChipSelectId::Id1),
45 (Pb1, FunctionSelect::Sel2, HwChipSelectId::Id2),
46 (Pb2, FunctionSelect::Sel2, HwChipSelectId::Id3),
47 (Pb3, FunctionSelect::Sel2, HwChipSelectId::Id4),
48 (Pb4, FunctionSelect::Sel2, HwChipSelectId::Id5),
49 (Pb5, FunctionSelect::Sel2, HwChipSelectId::Id6),
50 (Pb6, FunctionSelect::Sel2, HwChipSelectId::Id0),
51 (Pa24, FunctionSelect::Sel1, HwChipSelectId::Id4),
52 (Pa25, FunctionSelect::Sel1, HwChipSelectId::Id3),
53 (Pa26, FunctionSelect::Sel1, HwChipSelectId::Id2),
54 (Pa27, FunctionSelect::Sel1, HwChipSelectId::Id1),
55 (Pa28, FunctionSelect::Sel1, HwChipSelectId::Id0),
56);
57
58hw_cs_multi_pin!(
59 PinPb0SpiaHwCsId1,
60 Pb0,
61 Bank::Spi0,
62 FunctionSelect::Sel2,
63 HwChipSelectId::Id1
64);
65hw_cs_multi_pin!(
66 PinPb1SpiaHwCsId2,
67 Pb1,
68 Bank::Spi0,
69 FunctionSelect::Sel2,
70 HwChipSelectId::Id2
71);
72hw_cs_multi_pin!(
73 PinPb2SpiaHwCsId3,
74 Pb2,
75 Bank::Spi0,
76 FunctionSelect::Sel2,
77 HwChipSelectId::Id3
78);
79
80hw_cs_multi_pin!(
81 PinPa21SpiaHwCsId7,
82 Pa21,
83 Bank::Spi0,
84 FunctionSelect::Sel1,
85 HwChipSelectId::Id7
86);
87hw_cs_multi_pin!(
88 PinPa22SpiaHwCsId6,
89 Pa22,
90 Bank::Spi0,
91 FunctionSelect::Sel1,
92 HwChipSelectId::Id6
93);
94hw_cs_multi_pin!(
95 PinPa23SpiaHwCsId5,
96 Pa23,
97 Bank::Spi0,
98 FunctionSelect::Sel1,
99 HwChipSelectId::Id5
100);
101
102impl PinSck1 for Pin<Pa20> {
105 const SPI_ID: Bank = Bank::Spi1;
106 const FUN_SEL: FunctionSelect = FunctionSelect::Sel2;
107}
108impl PinMosi1 for Pin<Pa19> {
109 const SPI_ID: Bank = Bank::Spi1;
110 const FUN_SEL: FunctionSelect = FunctionSelect::Sel2;
111}
112impl PinMiso1 for Pin<Pa18> {
113 const SPI_ID: Bank = Bank::Spi1;
114 const FUN_SEL: FunctionSelect = FunctionSelect::Sel2;
115}
116
117pub type SpiBPortASck = Pin<Pa20>;
118pub type SpiBPortAMosi = Pin<Pa19>;
119pub type SpiBPortAMiso = Pin<Pa18>;
120
121impl PinSck1 for Pin<Pb19> {
122 const SPI_ID: Bank = Bank::Spi1;
123 const FUN_SEL: FunctionSelect = FunctionSelect::Sel1;
124}
125impl PinMosi1 for Pin<Pb18> {
126 const SPI_ID: Bank = Bank::Spi1;
127 const FUN_SEL: FunctionSelect = FunctionSelect::Sel1;
128}
129impl PinMiso1 for Pin<Pb17> {
130 const SPI_ID: Bank = Bank::Spi1;
131 const FUN_SEL: FunctionSelect = FunctionSelect::Sel1;
132}
133
134impl PinSck1 for Pin<Pb5> {
135 const SPI_ID: Bank = Bank::Spi1;
136 const FUN_SEL: FunctionSelect = FunctionSelect::Sel1;
137}
138impl PinMosi1 for Pin<Pb4> {
139 const SPI_ID: Bank = Bank::Spi1;
140 const FUN_SEL: FunctionSelect = FunctionSelect::Sel1;
141}
142impl PinMiso1 for Pin<Pb3> {
143 const SPI_ID: Bank = Bank::Spi1;
144 const FUN_SEL: FunctionSelect = FunctionSelect::Sel1;
145}
146
147hw_cs_pins!(
148 Bank::Spi1,
149 (Pb16, FunctionSelect::Sel1, HwChipSelectId::Id0),
150 (Pb15, FunctionSelect::Sel1, HwChipSelectId::Id1),
151 (Pb14, FunctionSelect::Sel1, HwChipSelectId::Id2),
152 (Pb13, FunctionSelect::Sel1, HwChipSelectId::Id3),
153 (Pa17, FunctionSelect::Sel2, HwChipSelectId::Id0),
154 (Pa16, FunctionSelect::Sel2, HwChipSelectId::Id1),
155 (Pa15, FunctionSelect::Sel2, HwChipSelectId::Id2),
156 (Pa14, FunctionSelect::Sel2, HwChipSelectId::Id3),
157 (Pa13, FunctionSelect::Sel2, HwChipSelectId::Id4),
158 (Pa12, FunctionSelect::Sel2, HwChipSelectId::Id5),
159 (Pa11, FunctionSelect::Sel2, HwChipSelectId::Id6),
160 (Pa10, FunctionSelect::Sel2, HwChipSelectId::Id7),
161);
162
163hw_cs_multi_pin!(
164 PinPb0SpibHwCsId2,
165 Pb0,
166 Bank::Spi1,
167 FunctionSelect::Sel1,
168 HwChipSelectId::Id2
169);
170hw_cs_multi_pin!(
171 PinPb1SpibHwCsId1,
172 Pb1,
173 Bank::Spi1,
174 FunctionSelect::Sel1,
175 HwChipSelectId::Id1
176);
177hw_cs_multi_pin!(
178 PinPb2SpibHwCsId0,
179 Pb2,
180 Bank::Spi1,
181 FunctionSelect::Sel1,
182 HwChipSelectId::Id0
183);
184
185hw_cs_multi_pin!(
186 PinPb10SpibHwCsId6,
187 Pb10,
188 Bank::Spi1,
189 FunctionSelect::Sel1,
190 HwChipSelectId::Id6
191);
192hw_cs_multi_pin!(
193 PinPb11SpibHwCsId5,
194 Pb11,
195 Bank::Spi1,
196 FunctionSelect::Sel1,
197 HwChipSelectId::Id5
198);
199hw_cs_multi_pin!(
200 PinPb12SpibHwCsId4,
201 Pb12,
202 Bank::Spi1,
203 FunctionSelect::Sel1,
204 HwChipSelectId::Id4
205);
206
207hw_cs_multi_pin!(
208 PinPb10SpibHwCsId2,
209 Pb10,
210 Bank::Spi1,
211 FunctionSelect::Sel2,
212 HwChipSelectId::Id2
213);
214hw_cs_multi_pin!(
215 PinPb11SpibHwCsId1,
216 Pb11,
217 Bank::Spi1,
218 FunctionSelect::Sel2,
219 HwChipSelectId::Id1
220);
221hw_cs_multi_pin!(
222 PinPb12SpibHwCsId0,
223 Pb12,
224 Bank::Spi1,
225 FunctionSelect::Sel2,
226 HwChipSelectId::Id0
227);
228
229hw_cs_multi_pin!(
230 PinPa21SpibHwCsId7,
231 Pa21,
232 Bank::Spi1,
233 FunctionSelect::Sel2,
234 HwChipSelectId::Id7
235);
236hw_cs_multi_pin!(
237 PinPa22SpibHwCsId6,
238 Pa22,
239 Bank::Spi1,
240 FunctionSelect::Sel2,
241 HwChipSelectId::Id6
242);
243hw_cs_multi_pin!(
244 PinPa23SpibHwCsId5,
245 Pa23,
246 Bank::Spi1,
247 FunctionSelect::Sel2,
248 HwChipSelectId::Id5
249);
250
251hw_cs_pins!(
254 Bank::Spi2,
255 (Pb9, FunctionSelect::Sel3, HwChipSelectId::Id1),
256 (Pb8, FunctionSelect::Sel3, HwChipSelectId::Id2),
257 (Pb7, FunctionSelect::Sel3, HwChipSelectId::Id3),
258 (Pb23, FunctionSelect::Sel3, HwChipSelectId::Id2),
259 (Pb22, FunctionSelect::Sel3, HwChipSelectId::Id1),
260 (Pa20, FunctionSelect::Sel1, HwChipSelectId::Id1),
261 (Pa19, FunctionSelect::Sel1, HwChipSelectId::Id2),
262 (Pb18, FunctionSelect::Sel1, HwChipSelectId::Id3),
263);
264
265hw_cs_multi_pin!(
266 PinPa21SpicHwCsId3,
267 Pa21,
268 Bank::Spi2,
269 FunctionSelect::Sel3,
270 HwChipSelectId::Id3
271);
272hw_cs_multi_pin!(
273 PinPa22SpicHwCsId2,
274 Pa22,
275 Bank::Spi2,
276 FunctionSelect::Sel3,
277 HwChipSelectId::Id2
278);
279hw_cs_multi_pin!(
280 PinPa23SpicHwCsId1,
281 Pa23,
282 Bank::Spi2,
283 FunctionSelect::Sel3,
284 HwChipSelectId::Id1
285);
286
287hw_cs_multi_pin!(
288 PinPa20SpicHwCsId1,
289 Pa20,
290 Bank::Spi2,
291 FunctionSelect::Sel1,
292 HwChipSelectId::Id1
293);
294hw_cs_multi_pin!(
295 PinPa20SpicHwCsId4,
296 Pa20,
297 Bank::Spi2,
298 FunctionSelect::Sel3,
299 HwChipSelectId::Id4
300);