Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
board.h
Go to the documentation of this file.
1
/*
2
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
3
4
Licensed under the Apache License, Version 2.0 (the "License");
5
you may not use this file except in compliance with the License.
6
You may obtain a copy of the License at
7
8
http://www.apache.org/licenses/LICENSE-2.0
9
10
Unless required by applicable law or agreed to in writing, software
11
distributed under the License is distributed on an "AS IS" BASIS,
12
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
See the License for the specific language governing permissions and
14
limitations under the License.
15
*/
16
17
#ifndef _BOARD_H_
18
#define _BOARD_H_
19
20
/*
21
* Setup for STMicroelectronics STM32F4-Lisa MXS.
22
*/
23
24
/*
25
* Board identifier.
26
*/
27
#define BOARD_ST_STM32F4_LISA
28
#define BOARD_NAME "STMicroelectronics STM32F4-Lisa MXS"
29
30
/*
31
* Board oscillators-related settings.
32
* NOTE: LSE not fitted.
33
*/
34
#if !defined(STM32_LSECLK)
35
#define STM32_LSECLK 0
36
#endif
37
38
#if !defined(STM32_HSECLK)
39
#define STM32_HSECLK 12000000
40
#endif
41
42
43
/*
44
* Board voltages.
45
* Required for performance limits calculation.
46
*/
47
#define STM32_VDD 330
48
49
/*
50
* MCU type as defined in the ST header file stm32f4xx.h.
51
*/
52
#define STM32F405xx
53
54
/*
55
* I/O ports initial setup, this configuration is established soon after reset
56
* in the initialization code.
57
* Please refer to the STM32 Reference Manual for details.
58
*/
59
#define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
60
#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
61
#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
62
#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
63
#define PIN_ODR_LOW(n) (0U << (n))
64
#define PIN_ODR_HIGH(n) (1U << (n))
65
#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
66
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
67
#define PIN_OSPEED_2M(n) (0U << ((n) * 2U))
68
#define PIN_OSPEED_25M(n) (1U << ((n) * 2U))
69
#define PIN_OSPEED_50M(n) (2U << ((n) * 2U))
70
#define PIN_OSPEED_100M(n) (3U << ((n) * 2U))
71
#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
72
#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
73
#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
74
#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
75
76
/*
77
* Port A setup.
78
*
79
* PA0 - Alternate Push Pull output 50MHz (SERVO5-Timer5Ch1)
80
* PA1 - Alternate Push Pull output 50MHz (SERVO6-Timer5Ch2)
81
* PA2 - Alternate Push Pull output 50MHz (UART2_TX)
82
* PA3 - Digital input (UART2_RX)
83
* PA4 - Alternate Push Pull output 50MHz (EXTSPI1_SS)
84
* PA5 - Alternate Push Pull output 50MHz (EXTSPI1_SCK)
85
* PA6 - Digital input. (EXTSPI1_MISO)
86
* PA7 - Alternate Push Pull output 50MHz (EXTSPI1_MOSI)
87
* PA8 - Open Drain output 50MHz (LED1)
88
* PA9 - Alternate Push Pull output 50MHz (USB_VBUS / (UART1_Tx )
89
* PA10 - Digital input. (UART1_Rx / PPM_IN Timer1Ch3)
90
* PA11 - Alternate input (USB_DM)
91
* PA12 - Alternate input (USB_DP)
92
* PA13 - Digital input (JTAG_TMS/SWDIO)
93
* PA14 - Digital input (JTAG_TCK/SWCLCK)
94
* PA15 - Digital input (JTAG_TDI)
95
*/
96
97
98
#define VAL_GPIOA_MODER (PIN_MODE_ALTERNATE(0)| \
99
PIN_MODE_ALTERNATE(1) | \
100
PIN_MODE_ALTERNATE(2) | \
101
PIN_MODE_ALTERNATE(3) | \
102
PIN_MODE_ALTERNATE(4) | \
103
PIN_MODE_ALTERNATE(5) | \
104
PIN_MODE_ALTERNATE(6) | \
105
PIN_MODE_ALTERNATE(7) | \
106
PIN_MODE_OUTPUT(8) | \
107
PIN_MODE_ALTERNATE(9) | \
108
PIN_MODE_ALTERNATE(10) | \
109
PIN_MODE_ALTERNATE(11) | \
110
PIN_MODE_ALTERNATE(12) | \
111
PIN_MODE_ALTERNATE(13) | \
112
PIN_MODE_ALTERNATE(14) | \
113
PIN_MODE_ALTERNATE(15))
114
#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
115
PIN_OTYPE_PUSHPULL(1) | \
116
PIN_OTYPE_PUSHPULL(2) | \
117
PIN_OTYPE_PUSHPULL(3) | \
118
PIN_OTYPE_PUSHPULL(4) | \
119
PIN_OTYPE_PUSHPULL(5) | \
120
PIN_OTYPE_PUSHPULL(6) | \
121
PIN_OTYPE_PUSHPULL(7) | \
122
PIN_OTYPE_OPENDRAIN(8) | \
123
PIN_OTYPE_PUSHPULL(9) | \
124
PIN_OTYPE_PUSHPULL(10) | \
125
PIN_OTYPE_PUSHPULL(11) | \
126
PIN_OTYPE_PUSHPULL(12) | \
127
PIN_OTYPE_PUSHPULL(13) | \
128
PIN_OTYPE_PUSHPULL(14) | \
129
PIN_OTYPE_PUSHPULL(15))
130
#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_50M(0) | \
131
PIN_OSPEED_50M(1) | \
132
PIN_OSPEED_50M(2) | \
133
PIN_OSPEED_50M(3) | \
134
PIN_OSPEED_50M(4) | \
135
PIN_OSPEED_50M(5) | \
136
PIN_OSPEED_50M(6) | \
137
PIN_OSPEED_50M(7) | \
138
PIN_OSPEED_50M(8) | \
139
PIN_OSPEED_50M(9) | \
140
PIN_OSPEED_50M(10) | \
141
PIN_OSPEED_50M(11) | \
142
PIN_OSPEED_50M(12) | \
143
PIN_OSPEED_100M(13) | \
144
PIN_OSPEED_100M(14) | \
145
PIN_OSPEED_100M(15))
146
#define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(0) | \
147
PIN_PUPDR_FLOATING(1) | \
148
PIN_PUPDR_FLOATING(2) | \
149
PIN_PUPDR_FLOATING(3) | \
150
PIN_PUPDR_FLOATING(4) | \
151
PIN_PUPDR_FLOATING(5) | \
152
PIN_PUPDR_FLOATING(6) | \
153
PIN_PUPDR_FLOATING(7) | \
154
PIN_PUPDR_FLOATING(8) | \
155
PIN_PUPDR_FLOATING(9) | \
156
PIN_PUPDR_FLOATING(10) | \
157
PIN_PUPDR_FLOATING(11) | \
158
PIN_PUPDR_FLOATING(12) | \
159
PIN_PUPDR_FLOATING(13) | \
160
PIN_PUPDR_FLOATING(14) | \
161
PIN_PUPDR_FLOATING(15))
162
#define VAL_GPIOA_ODR (PIN_ODR_HIGH(0) | \
163
PIN_ODR_HIGH(1) | \
164
PIN_ODR_HIGH(2) | \
165
PIN_ODR_HIGH(3) | \
166
PIN_ODR_HIGH(4) | \
167
PIN_ODR_HIGH(5) | \
168
PIN_ODR_HIGH(6) | \
169
PIN_ODR_HIGH(7) | \
170
PIN_ODR_HIGH(8) | \
171
PIN_ODR_HIGH(9) | \
172
PIN_ODR_HIGH(10) | \
173
PIN_ODR_HIGH(11) | \
174
PIN_ODR_HIGH(12) | \
175
PIN_ODR_HIGH(13) | \
176
PIN_ODR_HIGH(14) | \
177
PIN_ODR_HIGH(15))
178
#define VAL_GPIOA_AFRL (PIN_AFIO_AF(0, 0) | \
179
PIN_AFIO_AF(1, 1) | \
180
PIN_AFIO_AF(2, 7) | \
181
PIN_AFIO_AF(3, 7) | \
182
PIN_AFIO_AF(4, 5) | \
183
PIN_AFIO_AF(5, 5) | \
184
PIN_AFIO_AF(6, 5) | \
185
PIN_AFIO_AF(7, 5))
186
#define VAL_GPIOA_AFRH (PIN_AFIO_AF(8, 0) | \
187
PIN_AFIO_AF(9, 7) | \
188
PIN_AFIO_AF(10, 7) | \
189
PIN_AFIO_AF(11, 10) | \
190
PIN_AFIO_AF(12, 10) | \
191
PIN_AFIO_AF(13, 0) | \
192
PIN_AFIO_AF(14, 0) | \
193
PIN_AFIO_AF(15, 0))
194
195
/*
196
* Port B setup:
197
* PB0 - Digital input (BARO_DRDY)
198
* PB1 - Digital input (EXTSPI1_DRDY)
199
* PB2 - Digital input (IMU_ACC_DRDY)
200
* PB3 - Digital input (JTAG_TDO/SWD)
201
* PB4 - Open Drain output 50MHz (LED2)
202
* PB5 - Digital input (IMU_MAG_DRDY)
203
* PB6 - Alternate Push Pull output 50MHz (SERVO7-Timer4Ch1)/USART1_TX/I2C1_SCL
204
* PB7 - Alternate Push Pull output 50MHz (SERVO8-Timer4Ch2)/USART1_RX/I2C1_SDA
205
* PB8 - Digital input. (CAN_RX)
206
* PB9 - Open Drain output 50MHz. (CAN_TX)
207
* PB10 - Alternate Open Drain output 2MHz.(I2C2_SCL)
208
* PB11 - Alternate Open Drain output 2MHz.(I2C2_SDA)
209
* PB12 - Push Pull output 50MHz. (IMU_ACC_SPI2_CS)
210
* PB13 - Alternate Push Pull output 50MHz (IMU_SPI2_SCK)
211
* PB14 - Digital input (IMU_SPI2_MISO)
212
* PB15 - Alternate Push Pull output 50MHz (IMU_SPI_MOSI)
213
*/
214
#define VAL_GPIOB_MODER (PIN_MODE_INPUT(0) | \
215
PIN_MODE_INPUT(1) | \
216
PIN_MODE_INPUT(2) | \
217
PIN_MODE_ALTERNATE(3) | \
218
PIN_MODE_OUTPUT(4) | \
219
PIN_MODE_INPUT(5) | \
220
PIN_MODE_ALTERNATE(6) | \
221
PIN_MODE_ALTERNATE(7) | \
222
PIN_MODE_ALTERNATE(8) | \
223
PIN_MODE_ALTERNATE(9) | \
224
PIN_MODE_ALTERNATE(10) | \
225
PIN_MODE_ALTERNATE(11) | \
226
PIN_MODE_OUTPUT(12) | \
227
PIN_MODE_ALTERNATE(13) | \
228
PIN_MODE_ALTERNATE(14) | \
229
PIN_MODE_ALTERNATE(15))
230
#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
231
PIN_OTYPE_PUSHPULL(1) | \
232
PIN_OTYPE_PUSHPULL(2) | \
233
PIN_OTYPE_PUSHPULL(3) | \
234
PIN_OTYPE_OPENDRAIN(4) | \
235
PIN_OTYPE_PUSHPULL(5) | \
236
PIN_OTYPE_OPENDRAIN(6) | \
237
PIN_OTYPE_OPENDRAIN(7) | \
238
PIN_OTYPE_PUSHPULL(8) | \
239
PIN_OTYPE_OPENDRAIN(9) | \
240
PIN_OTYPE_PUSHPULL(10) | \
241
PIN_OTYPE_PUSHPULL(11) | \
242
PIN_OTYPE_PUSHPULL(12) | \
243
PIN_OTYPE_PUSHPULL(13) | \
244
PIN_OTYPE_PUSHPULL(14) | \
245
PIN_OTYPE_PUSHPULL(15))
246
#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_50M(0) | \
247
PIN_OSPEED_50M(1) | \
248
PIN_OSPEED_50M(2) | \
249
PIN_OSPEED_100M(3) | \
250
PIN_OSPEED_50M(4) | \
251
PIN_OSPEED_50M(5) | \
252
PIN_OSPEED_50M(6) | \
253
PIN_OSPEED_50M(7) | \
254
PIN_OSPEED_50M(8) | \
255
PIN_OSPEED_50M(9) | \
256
PIN_OSPEED_50M(10) | \
257
PIN_OSPEED_50M(11) | \
258
PIN_OSPEED_50M(12) | \
259
PIN_OSPEED_50M(13) | \
260
PIN_OSPEED_50M(14) | \
261
PIN_OSPEED_50M(15))
262
#define VAL_GPIOB_PUPDR (PIN_PUPDR_FLOATING(0) | \
263
PIN_PUPDR_FLOATING(1) | \
264
PIN_PUPDR_FLOATING(2) | \
265
PIN_PUPDR_FLOATING(3) | \
266
PIN_PUPDR_FLOATING(4) | \
267
PIN_PUPDR_FLOATING(5) | \
268
PIN_PUPDR_PULLUP(6) | \
269
PIN_PUPDR_PULLUP(7) | \
270
PIN_PUPDR_FLOATING(8) | \
271
PIN_PUPDR_FLOATING(9) | \
272
PIN_PUPDR_FLOATING(10) | \
273
PIN_PUPDR_FLOATING(11) | \
274
PIN_PUPDR_FLOATING(12) | \
275
PIN_PUPDR_FLOATING(13) | \
276
PIN_PUPDR_FLOATING(14) | \
277
PIN_PUPDR_FLOATING(15))
278
#define VAL_GPIOB_ODR (PIN_ODR_HIGH(0) | \
279
PIN_ODR_HIGH(1) | \
280
PIN_ODR_HIGH(2) | \
281
PIN_ODR_HIGH(3) | \
282
PIN_ODR_HIGH(4) | \
283
PIN_ODR_HIGH(5) | \
284
PIN_ODR_HIGH(6) | \
285
PIN_ODR_HIGH(7) | \
286
PIN_ODR_HIGH(8) | \
287
PIN_ODR_HIGH(9) | \
288
PIN_ODR_HIGH(10) | \
289
PIN_ODR_HIGH(11) | \
290
PIN_ODR_HIGH(12) | \
291
PIN_ODR_HIGH(13) | \
292
PIN_ODR_HIGH(14) | \
293
PIN_ODR_HIGH(15))
294
#define VAL_GPIOB_AFRL (PIN_AFIO_AF(0, 0) | \
295
PIN_AFIO_AF(1, 0) | \
296
PIN_AFIO_AF(2, 0) | \
297
PIN_AFIO_AF(3, 0) | \
298
PIN_AFIO_AF(4, 0) | \
299
PIN_AFIO_AF(5, 0) | \
300
PIN_AFIO_AF(6, 4) | \
301
PIN_AFIO_AF(7, 4))
302
#define VAL_GPIOB_AFRH (PIN_AFIO_AF(8, 9) | \
303
PIN_AFIO_AF(9, 9) | \
304
PIN_AFIO_AF(10, 7) | \
305
PIN_AFIO_AF(11, 7) | \
306
PIN_AFIO_AF(12, 0) | \
307
PIN_AFIO_AF(13, 5) | \
308
PIN_AFIO_AF(14, 5) | \
309
PIN_AFIO_AF(15, 5))
310
311
/*
312
* Port C setup:
313
* PC0 - Analog input (ADC2)
314
* PC1 - Analog input (ADC3)
315
* PC2 - Open Drain output 50MHz (LED3)
316
* PC3 - Analog input (ADC1)
317
* PC4 - Analog input (VBAT_MEAS)
318
* PC5 - Open Drain output 50MHz (LED4)
319
* PC6 - Alternate Push Pull output 50MHz (SERVO1-Timer3Ch1)
320
* PC7 - Alternate Push Pull output 50MHz (SERVO2-Timer3Ch2)
321
* PC8 - Alternate Push Pull output 50MHz (SERVO3-Timer3Ch3)
322
* PC9 - Alternate Push Pull output 50MHz (SERVO4-Timer3Ch4)
323
* PC10 - Alternate Push Pull output 50MHz (UART3_TX)
324
* PC11 - Digital input (UART3_RX)
325
* PC12 - Alternate Push Pull output 50MHz (PC12-UART5_TX)
326
* PC13 - Push Pull output 50MHz. (IMU_GYRO_SS-Baro_SS_SPI2)
327
* PC14 - Digital input (IMU_GYRO_DRDY)
328
* PC15 - Open Drain output 50MHz (LED5)
329
*/
330
#define VAL_GPIOC_MODER (PIN_MODE_INPUT(0) |\
331
PIN_MODE_INPUT(1) | \
332
PIN_MODE_OUTPUT(2) | \
333
PIN_MODE_INPUT(3) | \
334
PIN_MODE_INPUT(4) | \
335
PIN_MODE_OUTPUT(5) | \
336
PIN_MODE_ALTERNATE(6) | \
337
PIN_MODE_ALTERNATE(7) | \
338
PIN_MODE_ALTERNATE(8) | \
339
PIN_MODE_ALTERNATE(9) | \
340
PIN_MODE_ALTERNATE(10) | \
341
PIN_MODE_ALTERNATE(11) | \
342
PIN_MODE_ALTERNATE(12) | \
343
PIN_MODE_OUTPUT(13) | \
344
PIN_MODE_INPUT(14) | \
345
PIN_MODE_OUTPUT(15))
346
#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(0) |\
347
PIN_OTYPE_PUSHPULL(1) | \
348
PIN_OTYPE_OPENDRAIN(2) | \
349
PIN_OTYPE_PUSHPULL(3) | \
350
PIN_OTYPE_PUSHPULL(4) | \
351
PIN_OTYPE_OPENDRAIN(5) | \
352
PIN_OTYPE_PUSHPULL(6) | \
353
PIN_OTYPE_PUSHPULL(7) | \
354
PIN_OTYPE_PUSHPULL(8) | \
355
PIN_OTYPE_PUSHPULL(9) | \
356
PIN_OTYPE_PUSHPULL(10) | \
357
PIN_OTYPE_PUSHPULL(11) | \
358
PIN_OTYPE_PUSHPULL(12) | \
359
PIN_OTYPE_PUSHPULL(13) | \
360
PIN_OTYPE_PUSHPULL(14) | \
361
PIN_OTYPE_OPENDRAIN(15))
362
#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_50M(0) |\
363
PIN_OSPEED_50M(1) | \
364
PIN_OSPEED_50M(2) | \
365
PIN_OSPEED_50M(3) | \
366
PIN_OSPEED_50M(4) | \
367
PIN_OSPEED_50M(5) | \
368
PIN_OSPEED_50M(6) | \
369
PIN_OSPEED_50M(7) | \
370
PIN_OSPEED_50M(8) | \
371
PIN_OSPEED_50M(9) | \
372
PIN_OSPEED_50M(10) | \
373
PIN_OSPEED_50M(11) | \
374
PIN_OSPEED_50M(12) | \
375
PIN_OSPEED_50M(13) | \
376
PIN_OSPEED_50M(14) | \
377
PIN_OSPEED_50M(15))
378
#define VAL_GPIOC_PUPDR (PIN_PUPDR_FLOATING(0) |\
379
PIN_PUPDR_FLOATING(1) | \
380
PIN_PUPDR_FLOATING(2) | \
381
PIN_PUPDR_FLOATING(3) | \
382
PIN_PUPDR_FLOATING(4) | \
383
PIN_PUPDR_FLOATING(5) | \
384
PIN_PUPDR_FLOATING(6) | \
385
PIN_PUPDR_FLOATING(7) | \
386
PIN_PUPDR_FLOATING(8) | \
387
PIN_PUPDR_FLOATING(9) | \
388
PIN_PUPDR_FLOATING(10) | \
389
PIN_PUPDR_FLOATING(11) | \
390
PIN_PUPDR_FLOATING(12) | \
391
PIN_PUPDR_FLOATING(13) | \
392
PIN_PUPDR_FLOATING(14) | \
393
PIN_PUPDR_FLOATING(15))
394
#define VAL_GPIOC_ODR (PIN_ODR_HIGH(0) | \
395
PIN_ODR_HIGH(1) | \
396
PIN_ODR_HIGH(2) | \
397
PIN_ODR_HIGH(3) | \
398
PIN_ODR_HIGH(4) | \
399
PIN_ODR_HIGH(5) | \
400
PIN_ODR_HIGH(6) | \
401
PIN_ODR_HIGH(7) | \
402
PIN_ODR_HIGH(8) | \
403
PIN_ODR_HIGH(9) | \
404
PIN_ODR_HIGH(10) | \
405
PIN_ODR_HIGH(11) | \
406
PIN_ODR_HIGH(12) | \
407
PIN_ODR_HIGH(13) | \
408
PIN_ODR_HIGH(14) | \
409
PIN_ODR_HIGH(15))
410
#define VAL_GPIOC_AFRL (PIN_AFIO_AF(0, 0) |\
411
PIN_AFIO_AF(1, 0) | \
412
PIN_AFIO_AF(2, 0) | \
413
PIN_AFIO_AF(3, 0) | \
414
PIN_AFIO_AF(4, 0) | \
415
PIN_AFIO_AF(5, 0) | \
416
PIN_AFIO_AF(6, 2) | \
417
PIN_AFIO_AF(7, 2))
418
#define VAL_GPIOC_AFRH (PIN_AFIO_AF(8, 2) | \
419
PIN_AFIO_AF(9, 2) | \
420
PIN_AFIO_AF(10, 8) | \
421
PIN_AFIO_AF(11, 8) | \
422
PIN_AFIO_AF(12, 8) | \
423
PIN_AFIO_AF(13, 0) | \
424
PIN_AFIO_AF(14, 0) | \
425
PIN_AFIO_AF(15, 0))
426
427
/*
428
* Port D setup:
429
* PD0 - Digital input with PullUp or PullDown resistor depending on ODR. (OSC_IN).
430
* PD1 - Digital input with PullUp or PullDown resistor depending on ODR. (OSC_OUT).
431
* PD2 - Digital input (UART5_RX).
432
* PD3 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
433
* PD4 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
434
* PD5 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
435
* PD6 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
436
* PD7 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
437
* PD8 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
438
* PD9 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
439
* PD10 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
440
* PD11 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
441
* PD12 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
442
* PD13 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
443
* PD14 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
444
* PD15 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
445
*/
446
#define VAL_GPIOD_MODER (PIN_MODE_INPUT(0) | \
447
PIN_MODE_INPUT(1) | \
448
PIN_MODE_ALTERNATE(2) | \
449
PIN_MODE_INPUT(3) | \
450
PIN_MODE_INPUT(4) | \
451
PIN_MODE_INPUT(5) | \
452
PIN_MODE_INPUT(6) | \
453
PIN_MODE_INPUT(7) | \
454
PIN_MODE_INPUT(8) | \
455
PIN_MODE_INPUT(9) | \
456
PIN_MODE_INPUT(10) | \
457
PIN_MODE_INPUT(11) | \
458
PIN_MODE_INPUT(12) | \
459
PIN_MODE_INPUT(13) | \
460
PIN_MODE_INPUT(14) | \
461
PIN_MODE_INPUT(15))
462
#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
463
PIN_OTYPE_PUSHPULL(1) | \
464
PIN_OTYPE_PUSHPULL(2) | \
465
PIN_OTYPE_PUSHPULL(3) | \
466
PIN_OTYPE_PUSHPULL(4) | \
467
PIN_OTYPE_PUSHPULL(5) |\
468
PIN_OTYPE_PUSHPULL(6) | \
469
PIN_OTYPE_PUSHPULL(7) | \
470
PIN_OTYPE_PUSHPULL(8) | \
471
PIN_OTYPE_PUSHPULL(9) | \
472
PIN_OTYPE_PUSHPULL(10) | \
473
PIN_OTYPE_PUSHPULL(11) | \
474
PIN_OTYPE_PUSHPULL(12) | \
475
PIN_OTYPE_PUSHPULL(13) | \
476
PIN_OTYPE_PUSHPULL(14) | \
477
PIN_OTYPE_PUSHPULL(15))
478
#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_100M(0) | \
479
PIN_OSPEED_100M(1) | \
480
PIN_OSPEED_50M(2) | \
481
PIN_OSPEED_100M(3) | \
482
PIN_OSPEED_100M(4) | \
483
PIN_OSPEED_100M(5) | \
484
PIN_OSPEED_100M(6) | \
485
PIN_OSPEED_100M(7) | \
486
PIN_OSPEED_100M(8) | \
487
PIN_OSPEED_100M(9) | \
488
PIN_OSPEED_100M(10) | \
489
PIN_OSPEED_100M(11) | \
490
PIN_OSPEED_100M(12) | \
491
PIN_OSPEED_100M(13) | \
492
PIN_OSPEED_100M(14) | \
493
PIN_OSPEED_100M(15))
494
#define VAL_GPIOD_PUPDR (PIN_PUPDR_FLOATING(0) | \
495
PIN_PUPDR_FLOATING(1) | \
496
PIN_PUPDR_FLOATING(2) | \
497
PIN_PUPDR_FLOATING(3) | \
498
PIN_PUPDR_FLOATING(4) | \
499
PIN_PUPDR_FLOATING(5) |\
500
PIN_PUPDR_FLOATING(6) | \
501
PIN_PUPDR_FLOATING(7) | \
502
PIN_PUPDR_FLOATING(8) | \
503
PIN_PUPDR_FLOATING(9) | \
504
PIN_PUPDR_FLOATING(10) | \
505
PIN_PUPDR_FLOATING(11) | \
506
PIN_PUPDR_FLOATING(12) | \
507
PIN_PUPDR_FLOATING(13) | \
508
PIN_PUPDR_FLOATING(14) | \
509
PIN_PUPDR_FLOATING(15))
510
#define VAL_GPIOD_ODR (PIN_ODR_HIGH(0) | \
511
PIN_ODR_HIGH(1) | \
512
PIN_ODR_HIGH(2) | \
513
PIN_ODR_HIGH(3) | \
514
PIN_ODR_HIGH(4) | \
515
PIN_ODR_HIGH(5) | \
516
PIN_ODR_HIGH(6) | \
517
PIN_ODR_HIGH(7) | \
518
PIN_ODR_HIGH(8) | \
519
PIN_ODR_HIGH(9) | \
520
PIN_ODR_HIGH(10) | \
521
PIN_ODR_HIGH(11) | \
522
PIN_ODR_HIGH(12) | \
523
PIN_ODR_HIGH(13) | \
524
PIN_ODR_HIGH(14) | \
525
PIN_ODR_HIGH(15))
526
#define VAL_GPIOD_AFRL (PIN_AFIO_AF(0, 0) | \
527
PIN_AFIO_AF(1, 0) | \
528
PIN_AFIO_AF(2, 8) | \
529
PIN_AFIO_AF(3, 0) | \
530
PIN_AFIO_AF(4, 0) | \
531
PIN_AFIO_AF(5, 0) | \
532
PIN_AFIO_AF(6, 0) | \
533
PIN_AFIO_AF(7, 0))
534
#define VAL_GPIOD_AFRH (PIN_AFIO_AF(8, 0) | \
535
PIN_AFIO_AF(9, 0) | \
536
PIN_AFIO_AF(10, 0) | \
537
PIN_AFIO_AF(11, 0) | \
538
PIN_AFIO_AF(12, 0) | \
539
PIN_AFIO_AF(13, 0) | \
540
PIN_AFIO_AF(14, 0) | \
541
PIN_AFIO_AF(15, 0))
542
543
/*
544
* Port E setup.
545
* PE0 - PE15 - floating input
546
*/
547
#define VAL_GPIOE_MODER (PIN_MODE_INPUT(0) | \
548
PIN_MODE_INPUT(1) | \
549
PIN_MODE_INPUT(2) | \
550
PIN_MODE_INPUT(3) | \
551
PIN_MODE_INPUT(4) | \
552
PIN_MODE_INPUT(5) | \
553
PIN_MODE_INPUT(6) | \
554
PIN_MODE_INPUT(7) | \
555
PIN_MODE_INPUT(8) | \
556
PIN_MODE_INPUT(9) | \
557
PIN_MODE_INPUT(10) | \
558
PIN_MODE_INPUT(11) | \
559
PIN_MODE_INPUT(12) | \
560
PIN_MODE_INPUT(13) | \
561
PIN_MODE_INPUT(14) | \
562
PIN_MODE_INPUT(15))
563
#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
564
PIN_OTYPE_PUSHPULL(1) | \
565
PIN_OTYPE_PUSHPULL(2) | \
566
PIN_OTYPE_PUSHPULL(3) | \
567
PIN_OTYPE_PUSHPULL(4) | \
568
PIN_OTYPE_PUSHPULL(5) | \
569
PIN_OTYPE_PUSHPULL(6) | \
570
PIN_OTYPE_PUSHPULL(7) | \
571
PIN_OTYPE_PUSHPULL(8) | \
572
PIN_OTYPE_PUSHPULL(9) | \
573
PIN_OTYPE_PUSHPULL(10) | \
574
PIN_OTYPE_PUSHPULL(11) | \
575
PIN_OTYPE_PUSHPULL(12) | \
576
PIN_OTYPE_PUSHPULL(13) | \
577
PIN_OTYPE_PUSHPULL(14) | \
578
PIN_OTYPE_PUSHPULL(15))
579
#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_100M(0) | \
580
PIN_OSPEED_100M(1) | \
581
PIN_OSPEED_100M(2) | \
582
PIN_OSPEED_100M(3) | \
583
PIN_OSPEED_100M(4) | \
584
PIN_OSPEED_100M(5) | \
585
PIN_OSPEED_100M(6) | \
586
PIN_OSPEED_100M(7) | \
587
PIN_OSPEED_100M(8) | \
588
PIN_OSPEED_100M(9) | \
589
PIN_OSPEED_100M(10) | \
590
PIN_OSPEED_100M(11) | \
591
PIN_OSPEED_100M(12) | \
592
PIN_OSPEED_100M(13) | \
593
PIN_OSPEED_100M(14) | \
594
PIN_OSPEED_100M(15))
595
#define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(0) | \
596
PIN_PUPDR_FLOATING(1) | \
597
PIN_PUPDR_FLOATING(2) | \
598
PIN_PUPDR_FLOATING(3) | \
599
PIN_PUPDR_FLOATING(4) | \
600
PIN_PUPDR_FLOATING(5) | \
601
PIN_PUPDR_FLOATING(6) | \
602
PIN_PUPDR_FLOATING(7) | \
603
PIN_PUPDR_FLOATING(8) | \
604
PIN_PUPDR_FLOATING(9) | \
605
PIN_PUPDR_FLOATING(10) | \
606
PIN_PUPDR_FLOATING(11) | \
607
PIN_PUPDR_FLOATING(12) | \
608
PIN_PUPDR_FLOATING(13) | \
609
PIN_PUPDR_FLOATING(14) | \
610
PIN_PUPDR_FLOATING(15))
611
#define VAL_GPIOE_ODR (PIN_ODR_HIGH(0) | \
612
PIN_ODR_HIGH(1) | \
613
PIN_ODR_HIGH(2) | \
614
PIN_ODR_HIGH(3) | \
615
PIN_ODR_HIGH(4) | \
616
PIN_ODR_HIGH(5) | \
617
PIN_ODR_HIGH(6) | \
618
PIN_ODR_HIGH(7) | \
619
PIN_ODR_HIGH(8) | \
620
PIN_ODR_HIGH(9) | \
621
PIN_ODR_HIGH(10) | \
622
PIN_ODR_HIGH(11) | \
623
PIN_ODR_HIGH(12) | \
624
PIN_ODR_HIGH(13) | \
625
PIN_ODR_HIGH(14) | \
626
PIN_ODR_HIGH(15))
627
#define VAL_GPIOE_AFRL (PIN_AFIO_AF(0, 0) | \
628
PIN_AFIO_AF(1, 0) | \
629
PIN_AFIO_AF(2, 0) | \
630
PIN_AFIO_AF(3, 0) | \
631
PIN_AFIO_AF(4, 0) | \
632
PIN_AFIO_AF(5, 0) | \
633
PIN_AFIO_AF(6, 0) | \
634
PIN_AFIO_AF(7, 0))
635
#define VAL_GPIOE_AFRH (PIN_AFIO_AF(8, 0) | \
636
PIN_AFIO_AF(9, 0) | \
637
PIN_AFIO_AF(10, 0) | \
638
PIN_AFIO_AF(11, 0) | \
639
PIN_AFIO_AF(12, 0) | \
640
PIN_AFIO_AF(13, 0) | \
641
PIN_AFIO_AF(14, 0) | \
642
PIN_AFIO_AF(15, 0))
643
644
/*
645
* GPIOF setup:
646
*
647
* PF0 - PF15 (input floating).
648
*/
649
#define VAL_GPIOF_MODER (PIN_MODE_INPUT(0) | \
650
PIN_MODE_INPUT(1) | \
651
PIN_MODE_INPUT(2) | \
652
PIN_MODE_INPUT(3) | \
653
PIN_MODE_INPUT(4) | \
654
PIN_MODE_INPUT(5) | \
655
PIN_MODE_INPUT(6) | \
656
PIN_MODE_INPUT(7) | \
657
PIN_MODE_INPUT(8) | \
658
PIN_MODE_INPUT(9) | \
659
PIN_MODE_INPUT(10) | \
660
PIN_MODE_INPUT(11) | \
661
PIN_MODE_INPUT(12) | \
662
PIN_MODE_INPUT(13) | \
663
PIN_MODE_INPUT(14) | \
664
PIN_MODE_INPUT(15))
665
#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
666
PIN_OTYPE_PUSHPULL(1) | \
667
PIN_OTYPE_PUSHPULL(2) | \
668
PIN_OTYPE_PUSHPULL(3) | \
669
PIN_OTYPE_PUSHPULL(4) | \
670
PIN_OTYPE_PUSHPULL(5) | \
671
PIN_OTYPE_PUSHPULL(6) | \
672
PIN_OTYPE_PUSHPULL(7) | \
673
PIN_OTYPE_PUSHPULL(8) | \
674
PIN_OTYPE_PUSHPULL(9) | \
675
PIN_OTYPE_PUSHPULL(10) | \
676
PIN_OTYPE_PUSHPULL(11) | \
677
PIN_OTYPE_PUSHPULL(12) | \
678
PIN_OTYPE_PUSHPULL(13) | \
679
PIN_OTYPE_PUSHPULL(14) | \
680
PIN_OTYPE_PUSHPULL(15))
681
#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_100M(0) | \
682
PIN_OSPEED_100M(1) | \
683
PIN_OSPEED_100M(2) | \
684
PIN_OSPEED_100M(3) | \
685
PIN_OSPEED_100M(4) | \
686
PIN_OSPEED_100M(5) | \
687
PIN_OSPEED_100M(6) | \
688
PIN_OSPEED_100M(7) | \
689
PIN_OSPEED_100M(8) | \
690
PIN_OSPEED_100M(9) | \
691
PIN_OSPEED_100M(10) | \
692
PIN_OSPEED_100M(11) | \
693
PIN_OSPEED_100M(12) | \
694
PIN_OSPEED_100M(13) | \
695
PIN_OSPEED_100M(14) | \
696
PIN_OSPEED_100M(15))
697
#define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(0) | \
698
PIN_PUPDR_FLOATING(1) | \
699
PIN_PUPDR_FLOATING(2) | \
700
PIN_PUPDR_FLOATING(3) | \
701
PIN_PUPDR_FLOATING(4) | \
702
PIN_PUPDR_FLOATING(5) | \
703
PIN_PUPDR_FLOATING(6) | \
704
PIN_PUPDR_FLOATING(7) | \
705
PIN_PUPDR_FLOATING(8) | \
706
PIN_PUPDR_FLOATING(9) | \
707
PIN_PUPDR_FLOATING(10) | \
708
PIN_PUPDR_FLOATING(11) | \
709
PIN_PUPDR_FLOATING(12) | \
710
PIN_PUPDR_FLOATING(13) | \
711
PIN_PUPDR_FLOATING(14) | \
712
PIN_PUPDR_FLOATING(15))
713
#define VAL_GPIOF_ODR (PIN_ODR_HIGH(0) | \
714
PIN_ODR_HIGH(1) | \
715
PIN_ODR_HIGH(2) | \
716
PIN_ODR_HIGH(3) | \
717
PIN_ODR_HIGH(4) | \
718
PIN_ODR_HIGH(5) | \
719
PIN_ODR_HIGH(6) | \
720
PIN_ODR_HIGH(7) | \
721
PIN_ODR_HIGH(8) | \
722
PIN_ODR_HIGH(9) | \
723
PIN_ODR_HIGH(10) | \
724
PIN_ODR_HIGH(11) | \
725
PIN_ODR_HIGH(12) | \
726
PIN_ODR_HIGH(13) | \
727
PIN_ODR_HIGH(14) | \
728
PIN_ODR_HIGH(15))
729
#define VAL_GPIOF_AFRL (PIN_AFIO_AF(0, 0) | \
730
PIN_AFIO_AF(1, 0) | \
731
PIN_AFIO_AF(2, 0) | \
732
PIN_AFIO_AF(3, 0) | \
733
PIN_AFIO_AF(4, 0) | \
734
PIN_AFIO_AF(5, 0) | \
735
PIN_AFIO_AF(6, 0) | \
736
PIN_AFIO_AF(7, 0))
737
#define VAL_GPIOF_AFRH (PIN_AFIO_AF(8, 0) | \
738
PIN_AFIO_AF(9, 0) | \
739
PIN_AFIO_AF(10, 0) | \
740
PIN_AFIO_AF(11, 0) | \
741
PIN_AFIO_AF(12, 0) | \
742
PIN_AFIO_AF(13, 0) | \
743
PIN_AFIO_AF(14, 0) | \
744
PIN_AFIO_AF(15, 0))
745
746
/*
747
* GPIOG setup:
748
*
749
* PG0 - PG15 (input floating).
750
*/
751
#define VAL_GPIOG_MODER (PIN_MODE_INPUT(0) | \
752
PIN_MODE_INPUT(1) | \
753
PIN_MODE_INPUT(2) | \
754
PIN_MODE_INPUT(3) | \
755
PIN_MODE_INPUT(4) | \
756
PIN_MODE_INPUT(5) | \
757
PIN_MODE_INPUT(6) | \
758
PIN_MODE_INPUT(7) | \
759
PIN_MODE_INPUT(8) | \
760
PIN_MODE_INPUT(9) | \
761
PIN_MODE_INPUT(10) | \
762
PIN_MODE_INPUT(11) | \
763
PIN_MODE_INPUT(12) | \
764
PIN_MODE_INPUT(13) | \
765
PIN_MODE_INPUT(14) | \
766
PIN_MODE_INPUT(15))
767
#define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
768
PIN_OTYPE_PUSHPULL(1) | \
769
PIN_OTYPE_PUSHPULL(2) | \
770
PIN_OTYPE_PUSHPULL(3) | \
771
PIN_OTYPE_PUSHPULL(4) | \
772
PIN_OTYPE_PUSHPULL(5) | \
773
PIN_OTYPE_PUSHPULL(6) | \
774
PIN_OTYPE_PUSHPULL(7) | \
775
PIN_OTYPE_PUSHPULL(8) | \
776
PIN_OTYPE_PUSHPULL(9) | \
777
PIN_OTYPE_PUSHPULL(10) | \
778
PIN_OTYPE_PUSHPULL(11) | \
779
PIN_OTYPE_PUSHPULL(12) | \
780
PIN_OTYPE_PUSHPULL(13) | \
781
PIN_OTYPE_PUSHPULL(14) | \
782
PIN_OTYPE_PUSHPULL(15))
783
#define VAL_GPIOG_OSPEEDR (PIN_OSPEED_100M(0) | \
784
PIN_OSPEED_100M(1) | \
785
PIN_OSPEED_100M(2) | \
786
PIN_OSPEED_100M(3) | \
787
PIN_OSPEED_100M(4) | \
788
PIN_OSPEED_100M(5) | \
789
PIN_OSPEED_100M(6) | \
790
PIN_OSPEED_100M(7) | \
791
PIN_OSPEED_100M(8) | \
792
PIN_OSPEED_100M(9) | \
793
PIN_OSPEED_100M(10) | \
794
PIN_OSPEED_100M(11) | \
795
PIN_OSPEED_100M(12) | \
796
PIN_OSPEED_100M(13) | \
797
PIN_OSPEED_100M(14) | \
798
PIN_OSPEED_100M(15))
799
#define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(0) | \
800
PIN_PUPDR_FLOATING(1) | \
801
PIN_PUPDR_FLOATING(2) | \
802
PIN_PUPDR_FLOATING(3) | \
803
PIN_PUPDR_FLOATING(4) | \
804
PIN_PUPDR_FLOATING(5) | \
805
PIN_PUPDR_FLOATING(6) | \
806
PIN_PUPDR_FLOATING(7) | \
807
PIN_PUPDR_FLOATING(8) | \
808
PIN_PUPDR_FLOATING(9) | \
809
PIN_PUPDR_FLOATING(10) | \
810
PIN_PUPDR_FLOATING(11) | \
811
PIN_PUPDR_FLOATING(12) | \
812
PIN_PUPDR_FLOATING(13) | \
813
PIN_PUPDR_FLOATING(14) | \
814
PIN_PUPDR_FLOATING(15))
815
#define VAL_GPIOG_ODR (PIN_ODR_HIGH(0) | \
816
PIN_ODR_HIGH(1) | \
817
PIN_ODR_HIGH(2) | \
818
PIN_ODR_HIGH(3) | \
819
PIN_ODR_HIGH(4) | \
820
PIN_ODR_HIGH(5) | \
821
PIN_ODR_HIGH(6) | \
822
PIN_ODR_HIGH(7) | \
823
PIN_ODR_HIGH(8) | \
824
PIN_ODR_HIGH(9) | \
825
PIN_ODR_HIGH(10) | \
826
PIN_ODR_HIGH(11) | \
827
PIN_ODR_HIGH(12) | \
828
PIN_ODR_HIGH(13) | \
829
PIN_ODR_HIGH(14) | \
830
PIN_ODR_HIGH(15))
831
#define VAL_GPIOG_AFRL (PIN_AFIO_AF(0, 0) | \
832
PIN_AFIO_AF(1, 0) | \
833
PIN_AFIO_AF(2, 0) | \
834
PIN_AFIO_AF(3, 0) | \
835
PIN_AFIO_AF(4, 0) | \
836
PIN_AFIO_AF(5, 0) | \
837
PIN_AFIO_AF(6, 0) | \
838
PIN_AFIO_AF(7, 0))
839
#define VAL_GPIOG_AFRH (PIN_AFIO_AF(8, 0) | \
840
PIN_AFIO_AF(9, 0) | \
841
PIN_AFIO_AF(10, 0) | \
842
PIN_AFIO_AF(11, 0) | \
843
PIN_AFIO_AF(12, 0) | \
844
PIN_AFIO_AF(13, 0) | \
845
PIN_AFIO_AF(14, 0) | \
846
PIN_AFIO_AF(15, 0))
847
848
/*
849
* GPIOH setup:
850
*
851
* PH0 - PH15 (input floating).
852
*/
853
#define VAL_GPIOH_MODER (PIN_MODE_INPUT(0) | \
854
PIN_MODE_INPUT(1) | \
855
PIN_MODE_INPUT(2) | \
856
PIN_MODE_INPUT(3) | \
857
PIN_MODE_INPUT(4) | \
858
PIN_MODE_INPUT(5) | \
859
PIN_MODE_INPUT(6) | \
860
PIN_MODE_INPUT(7) | \
861
PIN_MODE_INPUT(8) | \
862
PIN_MODE_INPUT(9) | \
863
PIN_MODE_INPUT(10) | \
864
PIN_MODE_INPUT(11) | \
865
PIN_MODE_INPUT(12) | \
866
PIN_MODE_INPUT(13) | \
867
PIN_MODE_INPUT(14) | \
868
PIN_MODE_INPUT(15))
869
#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
870
PIN_OTYPE_PUSHPULL(1) | \
871
PIN_OTYPE_PUSHPULL(2) | \
872
PIN_OTYPE_PUSHPULL(3) | \
873
PIN_OTYPE_PUSHPULL(4) | \
874
PIN_OTYPE_PUSHPULL(5) | \
875
PIN_OTYPE_PUSHPULL(6) | \
876
PIN_OTYPE_PUSHPULL(7) | \
877
PIN_OTYPE_PUSHPULL(8) | \
878
PIN_OTYPE_PUSHPULL(9) | \
879
PIN_OTYPE_PUSHPULL(10) | \
880
PIN_OTYPE_PUSHPULL(11) | \
881
PIN_OTYPE_PUSHPULL(12) | \
882
PIN_OTYPE_PUSHPULL(13) | \
883
PIN_OTYPE_PUSHPULL(14) | \
884
PIN_OTYPE_PUSHPULL(15))
885
#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_100M(0) | \
886
PIN_OSPEED_100M(1) | \
887
PIN_OSPEED_100M(2) | \
888
PIN_OSPEED_100M(3) | \
889
PIN_OSPEED_100M(4) | \
890
PIN_OSPEED_100M(5) | \
891
PIN_OSPEED_100M(6) | \
892
PIN_OSPEED_100M(7) | \
893
PIN_OSPEED_100M(8) | \
894
PIN_OSPEED_100M(9) | \
895
PIN_OSPEED_100M(10) | \
896
PIN_OSPEED_100M(11) | \
897
PIN_OSPEED_100M(12) | \
898
PIN_OSPEED_100M(13) | \
899
PIN_OSPEED_100M(14) | \
900
PIN_OSPEED_100M(15))
901
#define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(0) | \
902
PIN_PUPDR_FLOATING(1) | \
903
PIN_PUPDR_FLOATING(2) | \
904
PIN_PUPDR_FLOATING(3) | \
905
PIN_PUPDR_FLOATING(4) | \
906
PIN_PUPDR_FLOATING(5) | \
907
PIN_PUPDR_FLOATING(6) | \
908
PIN_PUPDR_FLOATING(7) | \
909
PIN_PUPDR_FLOATING(8) | \
910
PIN_PUPDR_FLOATING(9) | \
911
PIN_PUPDR_FLOATING(10) | \
912
PIN_PUPDR_FLOATING(11) | \
913
PIN_PUPDR_FLOATING(12) | \
914
PIN_PUPDR_FLOATING(13) | \
915
PIN_PUPDR_FLOATING(14) | \
916
PIN_PUPDR_FLOATING(15))
917
#define VAL_GPIOH_ODR (PIN_ODR_HIGH(0) | \
918
PIN_ODR_HIGH(1) | \
919
PIN_ODR_HIGH(2) | \
920
PIN_ODR_HIGH(3) | \
921
PIN_ODR_HIGH(4) | \
922
PIN_ODR_HIGH(5) | \
923
PIN_ODR_HIGH(6) | \
924
PIN_ODR_HIGH(7) | \
925
PIN_ODR_HIGH(8) | \
926
PIN_ODR_HIGH(9) | \
927
PIN_ODR_HIGH(10) | \
928
PIN_ODR_HIGH(11) | \
929
PIN_ODR_HIGH(12) | \
930
PIN_ODR_HIGH(13) | \
931
PIN_ODR_HIGH(14) | \
932
PIN_ODR_HIGH(15))
933
#define VAL_GPIOH_AFRL (PIN_AFIO_AF(0, 0) | \
934
PIN_AFIO_AF(1, 0) | \
935
PIN_AFIO_AF(2, 0) | \
936
PIN_AFIO_AF(3, 0) | \
937
PIN_AFIO_AF(4, 0) | \
938
PIN_AFIO_AF(5, 0) | \
939
PIN_AFIO_AF(6, 0) | \
940
PIN_AFIO_AF(7, 0))
941
#define VAL_GPIOH_AFRH (PIN_AFIO_AF(8, 0) | \
942
PIN_AFIO_AF(9, 0) | \
943
PIN_AFIO_AF(10, 0) | \
944
PIN_AFIO_AF(11, 0) | \
945
PIN_AFIO_AF(12, 0) | \
946
PIN_AFIO_AF(13, 0) | \
947
PIN_AFIO_AF(14, 0) | \
948
PIN_AFIO_AF(15, 0))
949
950
/*
951
* GPIOI setup:
952
*
953
* PI0 - PI15 (input floating).
954
*/
955
#define VAL_GPIOI_MODER (PIN_MODE_INPUT(0) | \
956
PIN_MODE_INPUT(1) | \
957
PIN_MODE_INPUT(2) | \
958
PIN_MODE_INPUT(3) | \
959
PIN_MODE_INPUT(4) | \
960
PIN_MODE_INPUT(5) | \
961
PIN_MODE_INPUT(6) | \
962
PIN_MODE_INPUT(7) | \
963
PIN_MODE_INPUT(8) | \
964
PIN_MODE_INPUT(9) | \
965
PIN_MODE_INPUT(10) | \
966
PIN_MODE_INPUT(11) | \
967
PIN_MODE_INPUT(12) | \
968
PIN_MODE_INPUT(13) | \
969
PIN_MODE_INPUT(14) | \
970
PIN_MODE_INPUT(15))
971
#define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
972
PIN_OTYPE_PUSHPULL(1) | \
973
PIN_OTYPE_PUSHPULL(2) | \
974
PIN_OTYPE_PUSHPULL(3) | \
975
PIN_OTYPE_PUSHPULL(4) | \
976
PIN_OTYPE_PUSHPULL(5) | \
977
PIN_OTYPE_PUSHPULL(6) | \
978
PIN_OTYPE_PUSHPULL(7) | \
979
PIN_OTYPE_PUSHPULL(8) | \
980
PIN_OTYPE_PUSHPULL(9) | \
981
PIN_OTYPE_PUSHPULL(10) | \
982
PIN_OTYPE_PUSHPULL(11) | \
983
PIN_OTYPE_PUSHPULL(12) | \
984
PIN_OTYPE_PUSHPULL(13) | \
985
PIN_OTYPE_PUSHPULL(14) | \
986
PIN_OTYPE_PUSHPULL(15))
987
#define VAL_GPIOI_OSPEEDR (PIN_OSPEED_100M(0) | \
988
PIN_OSPEED_100M(1) | \
989
PIN_OSPEED_100M(2) | \
990
PIN_OSPEED_100M(3) | \
991
PIN_OSPEED_100M(4) | \
992
PIN_OSPEED_100M(5) | \
993
PIN_OSPEED_100M(6) | \
994
PIN_OSPEED_100M(7) | \
995
PIN_OSPEED_100M(8) | \
996
PIN_OSPEED_100M(9) | \
997
PIN_OSPEED_100M(10) | \
998
PIN_OSPEED_100M(11) | \
999
PIN_OSPEED_100M(12) | \
1000
PIN_OSPEED_100M(13) | \
1001
PIN_OSPEED_100M(14) | \
1002
PIN_OSPEED_100M(15))
1003
#define VAL_GPIOI_PUPDR (PIN_PUPDR_FLOATING(0) | \
1004
PIN_PUPDR_FLOATING(1) | \
1005
PIN_PUPDR_FLOATING(2) | \
1006
PIN_PUPDR_FLOATING(3) | \
1007
PIN_PUPDR_FLOATING(4) | \
1008
PIN_PUPDR_FLOATING(5) | \
1009
PIN_PUPDR_FLOATING(6) | \
1010
PIN_PUPDR_FLOATING(7) | \
1011
PIN_PUPDR_FLOATING(8) | \
1012
PIN_PUPDR_FLOATING(9) | \
1013
PIN_PUPDR_FLOATING(10) | \
1014
PIN_PUPDR_FLOATING(11) | \
1015
PIN_PUPDR_FLOATING(12) | \
1016
PIN_PUPDR_FLOATING(13) | \
1017
PIN_PUPDR_FLOATING(14) | \
1018
PIN_PUPDR_FLOATING(15))
1019
#define VAL_GPIOI_ODR (PIN_ODR_HIGH(0) | \
1020
PIN_ODR_HIGH(1) | \
1021
PIN_ODR_HIGH(2) | \
1022
PIN_ODR_HIGH(3) | \
1023
PIN_ODR_HIGH(4) | \
1024
PIN_ODR_HIGH(5) | \
1025
PIN_ODR_HIGH(6) | \
1026
PIN_ODR_HIGH(7) | \
1027
PIN_ODR_HIGH(8) | \
1028
PIN_ODR_HIGH(9) | \
1029
PIN_ODR_HIGH(10) | \
1030
PIN_ODR_HIGH(11) | \
1031
PIN_ODR_HIGH(12) | \
1032
PIN_ODR_HIGH(13) | \
1033
PIN_ODR_HIGH(14) | \
1034
PIN_ODR_HIGH(15))
1035
#define VAL_GPIOI_AFRL (PIN_AFIO_AF(0, 0) | \
1036
PIN_AFIO_AF(1, 0) | \
1037
PIN_AFIO_AF(2, 0) | \
1038
PIN_AFIO_AF(3, 0) | \
1039
PIN_AFIO_AF(4, 0) | \
1040
PIN_AFIO_AF(5, 0) | \
1041
PIN_AFIO_AF(6, 0) | \
1042
PIN_AFIO_AF(7, 0))
1043
#define VAL_GPIOI_AFRH (PIN_AFIO_AF(8, 0) | \
1044
PIN_AFIO_AF(9, 0) | \
1045
PIN_AFIO_AF(10, 0) | \
1046
PIN_AFIO_AF(11, 0) | \
1047
PIN_AFIO_AF(12, 0) | \
1048
PIN_AFIO_AF(13, 0) | \
1049
PIN_AFIO_AF(14, 0) | \
1050
PIN_AFIO_AF(15, 0))
1051
1052
1053
/*
1054
* AHB_CLK
1055
*/
1056
#define AHB_CLK STM32_HCLK
1057
1058
1059
/*
1060
* LEDs
1061
*/
1062
/* 1 red, on PA8 */
1063
#ifndef USE_LED_1
1064
#define USE_LED_1 1
1065
#endif
1066
#define LED_1_GPIO GPIOA
1067
#define LED_1_GPIO_PIN 8
1068
#define LED_1_GPIO_ON gpio_clear
1069
#define LED_1_GPIO_OFF gpio_set
1070
1071
/* 2 green, shared with JTAG_TRST */
1072
#ifndef USE_LED_2
1073
#define USE_LED_2 1
1074
#endif
1075
#define LED_2_GPIO GPIOB
1076
#define LED_2_GPIO_PIN 4
1077
#define LED_2_GPIO_ON gpio_clear
1078
#define LED_2_GPIO_OFF gpio_set
1079
1080
/* 3 green, shared with ADC12 (ADC_6 on connector ANALOG2) */
1081
#ifndef USE_LED_3
1082
#define USE_LED_3 1
1083
#endif
1084
#define LED_3_GPIO GPIOC
1085
#define LED_3_GPIO_PIN 2
1086
#define LED_3_GPIO_ON gpio_clear
1087
#define LED_3_GPIO_OFF gpio_set
1088
1089
/* 4 red, shared with ADC15 (ADC_4 on connector ANALOG2) */
1090
#ifndef USE_LED_4
1091
#define USE_LED_4 1
1092
#endif
1093
#define LED_4_GPIO GPIOC
1094
#define LED_4_GPIO_PIN 5
1095
#define LED_4_GPIO_ON gpio_clear
1096
#define LED_4_GPIO_OFF gpio_set
1097
1098
/* 5 green, on PC15 */
1099
#ifndef USE_LED_5
1100
#define USE_LED_5 0
1101
#endif
1102
#define LED_5_GPIO GPIOC
1103
#define LED_5_GPIO_PIN 15
1104
#define LED_5_GPIO_ON gpio_set
1105
#define LED_5_GPIO_OFF gpio_clear
1106
1107
/*
1108
* ADCs
1109
*/
1110
// AUX 1
1111
#if USE_ADC_1
1112
#define AD1_1_CHANNEL ADC_CHANNEL_IN13
1113
#define ADC_1 AD1_1
1114
#define ADC_1_GPIO_PORT GPIOC
1115
#define ADC_1_GPIO_PIN GPIO3
1116
#endif
1117
1118
// AUX 2
1119
#if USE_ADC_2
1120
#define AD1_2_CHANNEL ADC_CHANNEL_IN10
1121
#define ADC_2 AD1_2
1122
#define ADC_2_GPIO_PORT GPIOC
1123
#define ADC_2_GPIO_PIN GPIO0
1124
#endif
1125
1126
// AUX 3
1127
#if USE_ADC_3
1128
#define AD1_3_CHANNEL ADC_CHANNEL_IN11
1129
#define ADC_3 AD1_3
1130
#define ADC_3_GPIO_PORT GPIOC
1131
#define ADC_3_GPIO_PIN GPIO1
1132
#endif
1133
1134
// Internal ADC for battery enabled by default
1135
#ifndef USE_ADC_4
1136
#define USE_ADC_4 1
1137
#endif
1138
#if USE_ADC_4
1139
#define AD1_4_CHANNEL ADC_CHANNEL_IN14
1140
#define ADC_4 AD1_4
1141
#define ADC_4_GPIO_PORT GPIOC
1142
#define ADC_4_GPIO_PIN GPIO4
1143
#endif
1144
1145
// Internal Temperature sensor enabled by default
1146
#ifndef USE_ADC_5
1147
#define USE_ADC_5 1
1148
#define USE_ADC_SENSOR 1
1149
#endif
1150
#if USE_ADC_5
1151
#define AD1_5_CHANNEL ADC_CHANNEL_SENSOR
1152
#define ADC_5 AD1_5
1153
#define ADC_5_GPIO_PORT GPIOC
1154
#define ADC_5_GPIO_PIN GPIO4
1155
#endif
1156
1157
1158
1159
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
1160
#ifndef ADC_CHANNEL_VSUPPLY
1161
#define ADC_CHANNEL_VSUPPLY ADC_4
1162
#endif
1163
1164
#define DefaultVoltageOfAdc(adc) (0.004489*adc)
1165
1166
/*
1167
* PWM TIM defines
1168
* enable TIM 3, 4 and 5 by default
1169
*/
1170
#ifndef USE_PWM_TIM3
1171
#define USE_PWM_TIM3 1
1172
#endif
1173
1174
#ifndef USE_PWM_TIM4
1175
#ifdef USE_SERVOS_7AND8
1176
#define USE_PWM_TIM4 1
1177
#else
1178
#define USE_PWM_TIM4 0
1179
#endif
1180
#endif
1181
1182
#ifndef USE_PWM_TIM5
1183
#define USE_PWM_TIM5 1
1184
#endif
1185
1186
/*
1187
* PWM defines
1188
*/
1189
#ifndef USE_PWM0
1190
#define USE_PWM0 1
1191
#endif
1192
#if USE_PWM0
1193
#define PWM_SERVO_0 0
1194
#define PWM_SERVO_0_GPIO GPIOC
1195
#define PWM_SERVO_0_PIN GPIO6
1196
#define PWM_SERVO_0_AF GPIO_AF2
1197
#define PWM_SERVO_0_DRIVER PWMD3
1198
#define PWM_SERVO_0_CHANNEL 0
1199
#define PWM_SERVO_0_CONF pwmcfg3
1200
#endif
1201
1202
#ifndef USE_PWM1
1203
#define USE_PWM1 1
1204
#endif
1205
#if USE_PWM1
1206
#define PWM_SERVO_1 1
1207
#define PWM_SERVO_1_GPIO GPIOC
1208
#define PWM_SERVO_1_PIN GPIO7
1209
#define PWM_SERVO_1_AF GPIO_AF2
1210
#define PWM_SERVO_1_DRIVER PWMD3
1211
#define PWM_SERVO_1_CHANNEL 1
1212
#define PWM_SERVO_1_CONF pwmcfg3
1213
#endif
1214
1215
#ifndef USE_PWM2
1216
#define USE_PWM2 1
1217
#endif
1218
#if USE_PWM2
1219
#define PWM_SERVO_2 2
1220
#define PWM_SERVO_2_GPIO GPIOC
1221
#define PWM_SERVO_2_PIN GPIO8
1222
#define PWM_SERVO_2_AF GPIO_AF2
1223
#define PWM_SERVO_2_DRIVER PWMD3
1224
#define PWM_SERVO_2_CHANNEL 2
1225
#define PWM_SERVO_2_CONF pwmcfg3
1226
#endif
1227
1228
#ifndef USE_PWM3
1229
#define USE_PWM3 1
1230
#endif
1231
#if USE_PWM3
1232
#define PWM_SERVO_3 3
1233
#define PWM_SERVO_3_GPIO GPIOC
1234
#define PWM_SERVO_3_PIN GPIO9
1235
#define PWM_SERVO_3_AF GPIO_AF2
1236
#define PWM_SERVO_3_DRIVER PWMD3
1237
#define PWM_SERVO_3_CHANNEL 3
1238
#define PWM_SERVO_3_CONF pwmcfg3
1239
#endif
1240
1241
#ifndef USE_PWM4
1242
#define USE_PWM4 1
1243
#endif
1244
#if USE_PWM4
1245
#define PWM_SERVO_4 4
1246
#define PWM_SERVO_4_GPIO GPIOA
1247
#define PWM_SERVO_4_PIN GPIO0
1248
#define PWM_SERVO_4_AF GPIO_AF2
1249
#define PWM_SERVO_4_DRIVER PWMD5
1250
#define PWM_SERVO_4_CHANNEL 0
1251
#define PWM_SERVO_4_CONF pwmcfg5
1252
#endif
1253
1254
#ifndef USE_PWM5
1255
#define USE_PWM5 1
1256
#endif
1257
#if USE_PWM5
1258
#define PWM_SERVO_5 5
1259
#define PWM_SERVO_5_GPIO GPIOA
1260
#define PWM_SERVO_5_PIN GPIO1
1261
#define PWM_SERVO_5_AF GPIO_AF2
1262
#define PWM_SERVO_5_DRIVER PWMD5
1263
#define PWM_SERVO_5_CHANNEL 1
1264
#define PWM_SERVO_5_CONF pwmcfg5
1265
#endif
1266
1267
1268
#if USE_SERVOS_7AND8
1269
#if USE_I2C1
1270
#error "You cannot USE_SERVOS_7AND8 and USE_I2C1 at the same time"
1271
#else
/* !USE_I2C1 */
1272
#if USE_PWM6
1273
#define PWM_SERVO_6 6
1274
#define PWM_SERVO_6_GPIO GPIOB
1275
#define PWM_SERVO_6_PIN GPIO6
1276
#define PWM_SERVO_6_AF GPIO_AF2
1277
#define PWM_SERVO_6_DRIVER PWMD4
1278
#define PWM_SERVO_6_CHANNEL 0
1279
#define PWM_SERVO_6_CONF pwmcfg4
1280
#endif
1281
1282
#if USE_PWM7
1283
#define PWM_SERVO_7 7
1284
#define PWM_SERVO_7_GPIO GPIOB
1285
#define PWM_SERVO_7_PIN GPIO7
1286
#define PWM_SERVO_7_AF GPIO_AF2
1287
#define PWM_SERVO_7_DRIVER PWMD4
1288
#define PWM_SERVO_7_CHANNEL 1
1289
#define PWM_SERVO_7_CONF pwmcfg4
1290
#endif
1291
#endif
/* USE_I2C1 */
1292
#endif
/* USE_SERVOS_7AND8 */
1293
1294
1298
#define RC_PPM_TICKS_PER_USEC 6
1299
#define PPM_TIMER_FREQUENCY 6000000
1300
#define PPM_CHANNEL ICU_CHANNEL_2
1301
#define PPM_TIMER ICUD2
1302
1306
#define LINE_I2C1_SCL PAL_LINE(GPIOB, 6U)
1307
#define LINE_I2C1_SDA PAL_LINE(GPIOB, 7U)
1308
#define I2C1_CLOCK_SPEED 400000
1309
#define I2C1_CFG_DEF { \
1310
OPMODE_I2C, \
1311
I2C1_CLOCK_SPEED, \
1312
FAST_DUTY_CYCLE_2, \
1313
}
1314
1315
#define LINE_I2C2_SCL PAL_LINE(GPIOB, 10U)
1316
#define LINE_I2C2_SDA PAL_LINE(GPIOB, 11U)
1317
#define I2C2_CLOCK_SPEED 400000
1318
#define I2C2_CFG_DEF { \
1319
OPMODE_I2C, \
1320
I2C2_CLOCK_SPEED, \
1321
FAST_DUTY_CYCLE_2, \
1322
}
1323
1327
#define SPI_SELECT_SLAVE0_PORT GPIOA
1328
#define SPI_SELECT_SLAVE0_PIN GPIO15
1329
1330
#define SPI_SELECT_SLAVE1_PORT GPIOA
1331
#define SPI_SELECT_SLAVE1_PIN GPIO4
1332
1333
#define SPI_SELECT_SLAVE2_PORT GPIOB
1334
#define SPI_SELECT_SLAVE2_PIN GPIO12
1335
1336
#define SPI_SELECT_SLAVE3_PORT GPIOC
1337
#define SPI_SELECT_SLAVE3_PIN GPIO13
1338
1339
#define SPI_SELECT_SLAVE4_PORT GPIOC
1340
#define SPI_SELECT_SLAVE4_PIN GPIO12
1341
1342
#define SPI_SELECT_SLAVE5_PORT GPIOC
1343
#define SPI_SELECT_SLAVE5_PIN GPIO4
1344
1345
#define SPI1_GPIO_PORT_NSS GPIOA
1346
#define SPI1_GPIO_NSS GPIO4
1347
1348
#define SPI2_GPIO_PORT_NSS GPIOB
1349
#define SPI2_GPIO_NSS GPIO12
1350
1351
#define SPI3_GPIO_PORT_NSS GPIO
1352
1359
#ifndef USE_BARO_BOARD
1360
#define USE_BARO_BOARD 1
1361
#endif
1362
1363
/*
1364
* Actuators for fixedwing
1365
*/
1366
/* Default actuators driver */
1367
#define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
1368
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
1369
#define ActuatorsDefaultInit() ActuatorsPwmInit()
1370
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
1371
1372
#if !defined(_FROM_ASM_)
1373
#ifdef __cplusplus
1374
extern
"C"
{
1375
#endif
1376
void
boardInit
(
void
);
1377
#ifdef __cplusplus
1378
}
1379
#endif
1380
#endif
/* _FROM_ASM_ */
1381
1382
#endif
/* _BOARD_H_ */
boardInit
void boardInit(void)
Board-specific initialization code.
Definition:
board.c:317
sw
airborne
boards
lisa_mxs
chibios
v1.0
board.h
Generated on Fri Nov 8 2024 14:10:44 for Paparazzi UAS by
1.9.1