Paparazzi UAS
v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
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 MX.
22
*/
23
24
/*
25
* Board identifier.
26
*/
27
#define BOARD_ST_STM32F4_ECU
28
#define BOARD_NAME "STMicroelectronics STM32F4-Ecu"
29
30
31
/*
32
* Board oscillators-related settings.
33
* NOTE: LSE not fitted.
34
*/
35
#if !defined(STM32_LSECLK)
36
#define STM32_LSECLK 0
37
#endif
38
39
#if !defined(STM32_HSECLK)
40
#define STM32_HSECLK 25000000
41
#endif
42
43
44
/*
45
* Board voltages.
46
* Required for performance limits calculation.
47
*/
48
#define STM32_VDD 330
49
50
/*
51
* MCU type as defined in the ST header file stm32f4xx.h.
52
*/
53
#define STM32F407xx
54
55
56
/*
57
* I/O ports initial setup, this configuration is established soon after reset
58
* in the initialization code.
59
* Please refer to the STM32 Reference Manual for details.
60
*/
61
#define PIN_MODE_INPUT(n) (0U << ((n) * 2U))
62
#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U))
63
#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U))
64
#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U))
65
#define PIN_ODR_LOW(n) (0U << (n))
66
#define PIN_ODR_HIGH(n) (1U << (n))
67
#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
68
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
69
#define PIN_OSPEED_2M(n) (0U << ((n) * 2U))
70
#define PIN_OSPEED_25M(n) (1U << ((n) * 2U))
71
#define PIN_OSPEED_50M(n) (2U << ((n) * 2U))
72
#define PIN_OSPEED_100M(n) (3U << ((n) * 2U))
73
#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U))
74
#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U))
75
#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U))
76
#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
77
78
/*
79
* Port A setup.
80
*
81
* PA0 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
82
* PA1 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
83
* PA2 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
84
* PA3 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
85
* PA4 - Analog output (DAC1) - set up as INPUT ANALOG (per reference manual)
86
* PA5 - Analog output (DAC2) - set up as INPUT ANALOG (per reference manual)
87
* PA6 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
88
* PA7 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
89
* PA8 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
90
* PA9 - Alternate output (UART1_Tx)
91
* PA10 - Alternate input (UART1_Rx)
92
* PA11 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
93
* PA12 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
94
* PA13 - Digital input (JTAG_TMS/SWDIO)
95
* PA14 - Digital input (JTAG_TCK/SWCLCK)
96
* PA15 - Digital input (JTAG_TDI)
97
*/
98
#define VAL_GPIOA_MODER (PIN_MODE_INPUT(0)| \
99
PIN_MODE_INPUT(1) | \
100
PIN_MODE_INPUT(2) | \
101
PIN_MODE_INPUT(3) | \
102
PIN_MODE_INPUT(4) | \
103
PIN_MODE_INPUT(5) | \
104
PIN_MODE_INPUT(6) | \
105
PIN_MODE_INPUT(7) | \
106
PIN_MODE_INPUT(8) | \
107
PIN_MODE_ALTERNATE(9) | \
108
PIN_MODE_ALTERNATE(10) | \
109
PIN_MODE_INPUT(11) | \
110
PIN_MODE_INPUT(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_PUSHPULL(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_100M(0) | \
131
PIN_OSPEED_100M(1) | \
132
PIN_OSPEED_100M(2) | \
133
PIN_OSPEED_100M(3) | \
134
PIN_OSPEED_100M(4) | \
135
PIN_OSPEED_100M(5) | \
136
PIN_OSPEED_100M(6) | \
137
PIN_OSPEED_100M(7) | \
138
PIN_OSPEED_100M(8) | \
139
PIN_OSPEED_100M(9) | \
140
PIN_OSPEED_100M(10) | \
141
PIN_OSPEED_100M(11) | \
142
PIN_OSPEED_100M(12) | \
143
PIN_OSPEED_100M(13) | \
144
PIN_OSPEED_100M(14) | \
145
PIN_OSPEED_100M(15))
146
#define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLDOWN(0) | \
147
PIN_PUPDR_PULLDOWN(1) | \
148
PIN_PUPDR_PULLDOWN(2) | \
149
PIN_PUPDR_PULLDOWN(3) | \
150
PIN_PUPDR_FLOATING(4) | \
151
PIN_PUPDR_FLOATING(5) | \
152
PIN_PUPDR_PULLDOWN(6) | \
153
PIN_PUPDR_PULLDOWN(7) | \
154
PIN_PUPDR_PULLDOWN(8) | \
155
PIN_PUPDR_FLOATING(9) | \
156
PIN_PUPDR_FLOATING(10) | \
157
PIN_PUPDR_PULLDOWN(11) | \
158
PIN_PUPDR_PULLDOWN(12) | \
159
PIN_PUPDR_FLOATING(13) | \
160
PIN_PUPDR_FLOATING(14) | \
161
PIN_PUPDR_FLOATING(15))
162
#define VAL_GPIOA_ODR (PIN_ODR_LOW(0) | \
163
PIN_ODR_LOW(1) | \
164
PIN_ODR_LOW(2) | \
165
PIN_ODR_LOW(3) | \
166
PIN_ODR_HIGH(4) | \
167
PIN_ODR_HIGH(5) | \
168
PIN_ODR_LOW(6) | \
169
PIN_ODR_LOW(7) | \
170
PIN_ODR_LOW(8) | \
171
PIN_ODR_HIGH(9) | \
172
PIN_ODR_LOW(10) | \
173
PIN_ODR_LOW(11) | \
174
PIN_ODR_LOW(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, 0) | \
180
PIN_AFIO_AF(2, 0) | \
181
PIN_AFIO_AF(3, 0) | \
182
PIN_AFIO_AF(4, 0) | \
183
PIN_AFIO_AF(5, 0) | \
184
PIN_AFIO_AF(6, 0) | \
185
PIN_AFIO_AF(7, 0))
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, 0) | \
190
PIN_AFIO_AF(12, 0) | \
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 with PullUp or PullDown resistor depending on ODR. (unconnected)
198
* PB1 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
199
* PB2 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
200
* PB3 - Digital input (JTAG_TDO/SWD)
201
* PB4 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
202
* PB5 - Alternate Digital input. (CAN2_RX)
203
* PB6 - Alternate Open Drain output 50MHz. (CAN2_TX)
204
* PB7 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
205
* PB8 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
206
* PB9 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
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_SPI2_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_INPUT(4) | \
219
PIN_MODE_ALTERNATE(5) | \
220
PIN_MODE_ALTERNATE(6) | \
221
PIN_MODE_INPUT(7) | \
222
PIN_MODE_INPUT(8) | \
223
PIN_MODE_INPUT(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_PUSHPULL(4) | \
235
PIN_OTYPE_PUSHPULL(5) | \
236
PIN_OTYPE_PUSHPULL(6) | \
237
PIN_OTYPE_PUSHPULL(7) | \
238
PIN_OTYPE_PUSHPULL(8) | \
239
PIN_OTYPE_PUSHPULL(9) | \
240
PIN_OTYPE_OPENDRAIN(10) | \
241
PIN_OTYPE_OPENDRAIN(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_100M(0) | \
247
PIN_OSPEED_100M(1) | \
248
PIN_OSPEED_100M(2) | \
249
PIN_OSPEED_100M(3) | \
250
PIN_OSPEED_100M(4) | \
251
PIN_OSPEED_100M(5) | \
252
PIN_OSPEED_50M(6) | \
253
PIN_OSPEED_100M(7) | \
254
PIN_OSPEED_100M(8) | \
255
PIN_OSPEED_100M(9) | \
256
PIN_OSPEED_2M(10) | \
257
PIN_OSPEED_2M(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_PULLDOWN(0) | \
263
PIN_PUPDR_PULLDOWN(1) | \
264
PIN_PUPDR_PULLDOWN(2) | \
265
PIN_PUPDR_FLOATING(3) | \
266
PIN_PUPDR_PULLDOWN(4) | \
267
PIN_PUPDR_FLOATING(5) | \
268
PIN_PUPDR_FLOATING(6) | \
269
PIN_PUPDR_PULLDOWN(7) | \
270
PIN_PUPDR_PULLDOWN(8) | \
271
PIN_PUPDR_PULLDOWN(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_LOW(0) | \
279
PIN_ODR_LOW(1) | \
280
PIN_ODR_LOW(2) | \
281
PIN_ODR_HIGH(3) | \
282
PIN_ODR_LOW(4) | \
283
PIN_ODR_HIGH(5) | \
284
PIN_ODR_HIGH(6) | \
285
PIN_ODR_LOW(7) | \
286
PIN_ODR_LOW(8) | \
287
PIN_ODR_LOW(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, 9) | \
300
PIN_AFIO_AF(6, 9) | \
301
PIN_AFIO_AF(7, 0))
302
#define VAL_GPIOB_AFRH (PIN_AFIO_AF(8, 0) | \
303
PIN_AFIO_AF(9, 0) | \
304
PIN_AFIO_AF(10, 4) | \
305
PIN_AFIO_AF(11, 4) | \
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 (ADC1)
314
* PC1 - Analog input (ADC2)
315
* PC2 - Analog input (ADC3)
316
* PC3 - Analog input (ADC4)
317
* PC4 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
318
* PC5 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
319
* PC6 - Alternate Push Pull output 50MHz (UART6_TX)
320
* PC7 - Alternate input (UART7_RX)
321
* PC8 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
322
* PC9 - Push Pull output 50MHz (SPI3_NSS)
323
* PC10 - Alternate Push Pull output 50MHz (SPI3_SCK)
324
* PC11 - Alternate Digital input (SPI3_MISO)
325
* PC12 - Alternate Push Pull output 50MHz (SPI3_MOSI)
326
* PC13 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
327
* PC14 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
328
* PC15 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected)
329
*/
330
#define VAL_GPIOC_MODER (PIN_MODE_INPUT(0) |\
331
PIN_MODE_INPUT(1) | \
332
PIN_MODE_INPUT(2) | \
333
PIN_MODE_INPUT(3) | \
334
PIN_MODE_INPUT(4) | \
335
PIN_MODE_INPUT(5) | \
336
PIN_MODE_ALTERNATE(6) | \
337
PIN_MODE_ALTERNATE(7) | \
338
PIN_MODE_INPUT(8) | \
339
PIN_MODE_OUTPUT(9) | \
340
PIN_MODE_ALTERNATE(10) | \
341
PIN_MODE_ALTERNATE(11) | \
342
PIN_MODE_ALTERNATE(12) | \
343
PIN_MODE_INPUT(13) | \
344
PIN_MODE_INPUT(14) | \
345
PIN_MODE_INPUT(15))
346
#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(0) |\
347
PIN_OTYPE_PUSHPULL(1) | \
348
PIN_OTYPE_PUSHPULL(2) | \
349
PIN_OTYPE_PUSHPULL(3) | \
350
PIN_OTYPE_PUSHPULL(4) | \
351
PIN_OTYPE_PUSHPULL(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_PUSHPULL(15))
362
#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_100M(0) |\
363
PIN_OSPEED_100M(1) | \
364
PIN_OSPEED_100M(2) | \
365
PIN_OSPEED_100M(3) | \
366
PIN_OSPEED_100M(4) | \
367
PIN_OSPEED_100M(5) | \
368
PIN_OSPEED_50M(6) | \
369
PIN_OSPEED_50M(7) | \
370
PIN_OSPEED_100M(8) | \
371
PIN_OSPEED_50M(9) | \
372
PIN_OSPEED_50M(10) | \
373
PIN_OSPEED_50M(11) | \
374
PIN_OSPEED_50M(12) | \
375
PIN_OSPEED_100M(13) | \
376
PIN_OSPEED_100M(14) | \
377
PIN_OSPEED_100M(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_PULLDOWN(4) | \
383
PIN_PUPDR_PULLDOWN(5) | \
384
PIN_PUPDR_FLOATING(6) | \
385
PIN_PUPDR_FLOATING(7) | \
386
PIN_PUPDR_PULLDOWN(8) | \
387
PIN_PUPDR_FLOATING(9) | \
388
PIN_PUPDR_FLOATING(10) | \
389
PIN_PUPDR_FLOATING(11) | \
390
PIN_PUPDR_FLOATING(12) | \
391
PIN_PUPDR_PULLDOWN(13) | \
392
PIN_PUPDR_PULLDOWN(14) | \
393
PIN_PUPDR_PULLDOWN(15))
394
#define VAL_GPIOC_ODR (PIN_ODR_LOW(0) | \
395
PIN_ODR_LOW(1) | \
396
PIN_ODR_LOW(2) | \
397
PIN_ODR_LOW(3) | \
398
PIN_ODR_LOW(4) | \
399
PIN_ODR_LOW(5) | \
400
PIN_ODR_HIGH(6) | \
401
PIN_ODR_HIGH(7) | \
402
PIN_ODR_LOW(8) | \
403
PIN_ODR_HIGH(9) | \
404
PIN_ODR_HIGH(10) | \
405
PIN_ODR_HIGH(11) | \
406
PIN_ODR_HIGH(12) | \
407
PIN_ODR_LOW(13) | \
408
PIN_ODR_LOW(14) | \
409
PIN_ODR_LOW(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, 8) | \
417
PIN_AFIO_AF(7, 8))
418
#define VAL_GPIOC_AFRH (PIN_AFIO_AF(8, 0) | \
419
PIN_AFIO_AF(9, 0) | \
420
PIN_AFIO_AF(10, 6) | \
421
PIN_AFIO_AF(11, 6) | \
422
PIN_AFIO_AF(12, 6) | \
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 - Alternate Digital input. (CAN1_RX).
430
* PD1 - Alternate Open Drain output 50MHz (CAN1_TX).
431
* PD2 - Digital input (CARD_DETECT).
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 - Alternate Push Pull output 50MHz. (UART2_TX).
435
* PD6 - Alternate Digital input. (UART2_RX).
436
* PD7 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
437
* PD8 - Alternate Push Pull output 50MHz. (UART3_TX).
438
* PD9 - Alternate Digital input. (UART3_RX).
439
* PD10 - Digital output. (DOUT_LS1).
440
* PD11 - Digital output. (DOUT_LS2).
441
* PD12 - Digital output. (DOUT_LS3).
442
* PD13 - Digital output. (DOUT_LS4).
443
* PD14 - Digital output. (DOUT_HS1).
444
* PD15 - Digital output. (DOUT_HS2).
445
*/
446
#define VAL_GPIOD_MODER (PIN_MODE_ALTERNATE(0) | \
447
PIN_MODE_ALTERNATE(1) | \
448
PIN_MODE_INPUT(2) | \
449
PIN_MODE_INPUT(3) | \
450
PIN_MODE_INPUT(4) | \
451
PIN_MODE_ALTERNATE(5) | \
452
PIN_MODE_ALTERNATE(6) | \
453
PIN_MODE_INPUT(7) | \
454
PIN_MODE_ALTERNATE(8) | \
455
PIN_MODE_ALTERNATE(9) | \
456
PIN_MODE_OUTPUT(10) | \
457
PIN_MODE_OUTPUT(11) | \
458
PIN_MODE_OUTPUT(12) | \
459
PIN_MODE_OUTPUT(13) | \
460
PIN_MODE_OUTPUT(14) | \
461
PIN_MODE_OUTPUT(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_50M(0) | \
479
PIN_OSPEED_50M(1) | \
480
PIN_OSPEED_100M(2) | \
481
PIN_OSPEED_100M(3) | \
482
PIN_OSPEED_100M(4) | \
483
PIN_OSPEED_50M(5) | \
484
PIN_OSPEED_50M(6) | \
485
PIN_OSPEED_100M(7) | \
486
PIN_OSPEED_50M(8) | \
487
PIN_OSPEED_50M(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_LOW(3) | \
514
PIN_ODR_LOW(4) | \
515
PIN_ODR_HIGH(5) | \
516
PIN_ODR_HIGH(6) | \
517
PIN_ODR_LOW(7) | \
518
PIN_ODR_HIGH(8) | \
519
PIN_ODR_HIGH(9) | \
520
PIN_ODR_LOW(10) | \
521
PIN_ODR_LOW(11) | \
522
PIN_ODR_LOW(12) | \
523
PIN_ODR_LOW(13) | \
524
PIN_ODR_LOW(14) | \
525
PIN_ODR_LOW(15))
526
#define VAL_GPIOD_AFRL (PIN_AFIO_AF(0, 9) | \
527
PIN_AFIO_AF(1, 9) | \
528
PIN_AFIO_AF(2, 0) | \
529
PIN_AFIO_AF(3, 0) | \
530
PIN_AFIO_AF(4, 0) | \
531
PIN_AFIO_AF(5, 7) | \
532
PIN_AFIO_AF(6, 7) | \
533
PIN_AFIO_AF(7, 0))
534
#define VAL_GPIOD_AFRH (PIN_AFIO_AF(8, 7) | \
535
PIN_AFIO_AF(9, 7) | \
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 - Digital input (IMU_MAG_DRDY)
546
* PE1 - Digital input (IMU_ACC_DRDY)
547
* PE2 - Digital input (IMU_GYRO_DRDY)
548
* PE3 - Push Pull output 50MHz. (IMU_GYRO_SS)
549
* PE4 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
550
* PE5 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
551
* PE6 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
552
* PE7 - Digital input. (DIN1).
553
* PE8 - Digital input. (DIN2).
554
* PE9 - Digital input. (DIN3).
555
* PE10 - Digital input. (DIN4).
556
* PE11 - Digital input. (DIN5).
557
* PE12 - Digital input. (DIN6).
558
* PE13 - Digital input. (DIN7).
559
* PE14 - Digital input. (DIN8).
560
* PE15 - Digital input with PullUp or PullDown resistor depending on ODR. (unconnected).
561
*/
562
#define VAL_GPIOE_MODER (PIN_MODE_INPUT(0) | \
563
PIN_MODE_INPUT(1) | \
564
PIN_MODE_INPUT(2) | \
565
PIN_MODE_OUTPUT(3) | \
566
PIN_MODE_INPUT(4) | \
567
PIN_MODE_INPUT(5) | \
568
PIN_MODE_INPUT(6) | \
569
PIN_MODE_INPUT(7) | \
570
PIN_MODE_INPUT(8) | \
571
PIN_MODE_INPUT(9) | \
572
PIN_MODE_INPUT(10) | \
573
PIN_MODE_INPUT(11) | \
574
PIN_MODE_INPUT(12) | \
575
PIN_MODE_INPUT(13) | \
576
PIN_MODE_INPUT(14) | \
577
PIN_MODE_INPUT(15))
578
#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
579
PIN_OTYPE_PUSHPULL(1) | \
580
PIN_OTYPE_PUSHPULL(2) | \
581
PIN_OTYPE_PUSHPULL(3) | \
582
PIN_OTYPE_PUSHPULL(4) | \
583
PIN_OTYPE_PUSHPULL(5) | \
584
PIN_OTYPE_PUSHPULL(6) | \
585
PIN_OTYPE_PUSHPULL(7) | \
586
PIN_OTYPE_PUSHPULL(8) | \
587
PIN_OTYPE_PUSHPULL(9) | \
588
PIN_OTYPE_PUSHPULL(10) | \
589
PIN_OTYPE_PUSHPULL(11) | \
590
PIN_OTYPE_PUSHPULL(12) | \
591
PIN_OTYPE_PUSHPULL(13) | \
592
PIN_OTYPE_PUSHPULL(14) | \
593
PIN_OTYPE_PUSHPULL(15))
594
#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_100M(0) | \
595
PIN_OSPEED_100M(1) | \
596
PIN_OSPEED_100M(2) | \
597
PIN_OSPEED_50M(3) | \
598
PIN_OSPEED_100M(4) | \
599
PIN_OSPEED_100M(5) | \
600
PIN_OSPEED_100M(6) | \
601
PIN_OSPEED_100M(7) | \
602
PIN_OSPEED_100M(8) | \
603
PIN_OSPEED_100M(9) | \
604
PIN_OSPEED_100M(10) | \
605
PIN_OSPEED_100M(11) | \
606
PIN_OSPEED_100M(12) | \
607
PIN_OSPEED_100M(13) | \
608
PIN_OSPEED_100M(14) | \
609
PIN_OSPEED_100M(15))
610
#define VAL_GPIOE_PUPDR (PIN_PUPDR_FLOATING(0) | \
611
PIN_PUPDR_FLOATING(1) | \
612
PIN_PUPDR_FLOATING(2) | \
613
PIN_PUPDR_FLOATING(3) | \
614
PIN_PUPDR_FLOATING(4) | \
615
PIN_PUPDR_FLOATING(5) | \
616
PIN_PUPDR_FLOATING(6) | \
617
PIN_PUPDR_FLOATING(7) | \
618
PIN_PUPDR_FLOATING(8) | \
619
PIN_PUPDR_FLOATING(9) | \
620
PIN_PUPDR_FLOATING(10) | \
621
PIN_PUPDR_FLOATING(11) | \
622
PIN_PUPDR_FLOATING(12) | \
623
PIN_PUPDR_FLOATING(13) | \
624
PIN_PUPDR_FLOATING(14) | \
625
PIN_PUPDR_FLOATING(15))
626
#define VAL_GPIOE_ODR (PIN_ODR_HIGH(0) | \
627
PIN_ODR_HIGH(1) | \
628
PIN_ODR_HIGH(2) | \
629
PIN_ODR_HIGH(3) | \
630
PIN_ODR_HIGH(4) | \
631
PIN_ODR_HIGH(5) | \
632
PIN_ODR_HIGH(6) | \
633
PIN_ODR_HIGH(7) | \
634
PIN_ODR_HIGH(8) | \
635
PIN_ODR_HIGH(9) | \
636
PIN_ODR_HIGH(10) | \
637
PIN_ODR_HIGH(11) | \
638
PIN_ODR_HIGH(12) | \
639
PIN_ODR_HIGH(13) | \
640
PIN_ODR_HIGH(14) | \
641
PIN_ODR_HIGH(15))
642
#define VAL_GPIOE_AFRL (PIN_AFIO_AF(0, 0) | \
643
PIN_AFIO_AF(1, 0) | \
644
PIN_AFIO_AF(2, 0) | \
645
PIN_AFIO_AF(3, 0) | \
646
PIN_AFIO_AF(4, 0) | \
647
PIN_AFIO_AF(5, 0) | \
648
PIN_AFIO_AF(6, 0) | \
649
PIN_AFIO_AF(7, 0))
650
#define VAL_GPIOE_AFRH (PIN_AFIO_AF(8, 0) | \
651
PIN_AFIO_AF(9, 0) | \
652
PIN_AFIO_AF(10, 0) | \
653
PIN_AFIO_AF(11, 0) | \
654
PIN_AFIO_AF(12, 0) | \
655
PIN_AFIO_AF(13, 0) | \
656
PIN_AFIO_AF(14, 0) | \
657
PIN_AFIO_AF(15, 0))
658
659
/*
660
* GPIOF setup:
661
*
662
* PF0 - PF15 (input floating).
663
*/
664
#define VAL_GPIOF_MODER (PIN_MODE_INPUT(0) | \
665
PIN_MODE_INPUT(1) | \
666
PIN_MODE_INPUT(2) | \
667
PIN_MODE_INPUT(3) | \
668
PIN_MODE_INPUT(4) | \
669
PIN_MODE_INPUT(5) | \
670
PIN_MODE_INPUT(6) | \
671
PIN_MODE_INPUT(7) | \
672
PIN_MODE_INPUT(8) | \
673
PIN_MODE_INPUT(9) | \
674
PIN_MODE_INPUT(10) | \
675
PIN_MODE_INPUT(11) | \
676
PIN_MODE_INPUT(12) | \
677
PIN_MODE_INPUT(13) | \
678
PIN_MODE_INPUT(14) | \
679
PIN_MODE_INPUT(15))
680
#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
681
PIN_OTYPE_PUSHPULL(1) | \
682
PIN_OTYPE_PUSHPULL(2) | \
683
PIN_OTYPE_PUSHPULL(3) | \
684
PIN_OTYPE_PUSHPULL(4) | \
685
PIN_OTYPE_PUSHPULL(5) | \
686
PIN_OTYPE_PUSHPULL(6) | \
687
PIN_OTYPE_PUSHPULL(7) | \
688
PIN_OTYPE_PUSHPULL(8) | \
689
PIN_OTYPE_PUSHPULL(9) | \
690
PIN_OTYPE_PUSHPULL(10) | \
691
PIN_OTYPE_PUSHPULL(11) | \
692
PIN_OTYPE_PUSHPULL(12) | \
693
PIN_OTYPE_PUSHPULL(13) | \
694
PIN_OTYPE_PUSHPULL(14) | \
695
PIN_OTYPE_PUSHPULL(15))
696
#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_100M(0) | \
697
PIN_OSPEED_100M(1) | \
698
PIN_OSPEED_100M(2) | \
699
PIN_OSPEED_100M(3) | \
700
PIN_OSPEED_100M(4) | \
701
PIN_OSPEED_100M(5) | \
702
PIN_OSPEED_100M(6) | \
703
PIN_OSPEED_100M(7) | \
704
PIN_OSPEED_100M(8) | \
705
PIN_OSPEED_100M(9) | \
706
PIN_OSPEED_100M(10) | \
707
PIN_OSPEED_100M(11) | \
708
PIN_OSPEED_100M(12) | \
709
PIN_OSPEED_100M(13) | \
710
PIN_OSPEED_100M(14) | \
711
PIN_OSPEED_100M(15))
712
#define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(0) | \
713
PIN_PUPDR_FLOATING(1) | \
714
PIN_PUPDR_FLOATING(2) | \
715
PIN_PUPDR_FLOATING(3) | \
716
PIN_PUPDR_FLOATING(4) | \
717
PIN_PUPDR_FLOATING(5) | \
718
PIN_PUPDR_FLOATING(6) | \
719
PIN_PUPDR_FLOATING(7) | \
720
PIN_PUPDR_FLOATING(8) | \
721
PIN_PUPDR_FLOATING(9) | \
722
PIN_PUPDR_FLOATING(10) | \
723
PIN_PUPDR_FLOATING(11) | \
724
PIN_PUPDR_FLOATING(12) | \
725
PIN_PUPDR_FLOATING(13) | \
726
PIN_PUPDR_FLOATING(14) | \
727
PIN_PUPDR_FLOATING(15))
728
#define VAL_GPIOF_ODR (PIN_ODR_HIGH(0) | \
729
PIN_ODR_HIGH(1) | \
730
PIN_ODR_HIGH(2) | \
731
PIN_ODR_HIGH(3) | \
732
PIN_ODR_HIGH(4) | \
733
PIN_ODR_HIGH(5) | \
734
PIN_ODR_HIGH(6) | \
735
PIN_ODR_HIGH(7) | \
736
PIN_ODR_HIGH(8) | \
737
PIN_ODR_HIGH(9) | \
738
PIN_ODR_HIGH(10) | \
739
PIN_ODR_HIGH(11) | \
740
PIN_ODR_HIGH(12) | \
741
PIN_ODR_HIGH(13) | \
742
PIN_ODR_HIGH(14) | \
743
PIN_ODR_HIGH(15))
744
#define VAL_GPIOF_AFRL (PIN_AFIO_AF(0, 0) | \
745
PIN_AFIO_AF(1, 0) | \
746
PIN_AFIO_AF(2, 0) | \
747
PIN_AFIO_AF(3, 0) | \
748
PIN_AFIO_AF(4, 0) | \
749
PIN_AFIO_AF(5, 0) | \
750
PIN_AFIO_AF(6, 0) | \
751
PIN_AFIO_AF(7, 0))
752
#define VAL_GPIOF_AFRH (PIN_AFIO_AF(8, 0) | \
753
PIN_AFIO_AF(9, 0) | \
754
PIN_AFIO_AF(10, 0) | \
755
PIN_AFIO_AF(11, 0) | \
756
PIN_AFIO_AF(12, 0) | \
757
PIN_AFIO_AF(13, 0) | \
758
PIN_AFIO_AF(14, 0) | \
759
PIN_AFIO_AF(15, 0))
760
761
/*
762
* GPIOG setup:
763
*
764
* PG0 - PG15 (input floating).
765
*/
766
#define VAL_GPIOG_MODER (PIN_MODE_INPUT(0) | \
767
PIN_MODE_INPUT(1) | \
768
PIN_MODE_INPUT(2) | \
769
PIN_MODE_INPUT(3) | \
770
PIN_MODE_INPUT(4) | \
771
PIN_MODE_INPUT(5) | \
772
PIN_MODE_INPUT(6) | \
773
PIN_MODE_INPUT(7) | \
774
PIN_MODE_INPUT(8) | \
775
PIN_MODE_INPUT(9) | \
776
PIN_MODE_INPUT(10) | \
777
PIN_MODE_INPUT(11) | \
778
PIN_MODE_INPUT(12) | \
779
PIN_MODE_INPUT(13) | \
780
PIN_MODE_INPUT(14) | \
781
PIN_MODE_INPUT(15))
782
#define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
783
PIN_OTYPE_PUSHPULL(1) | \
784
PIN_OTYPE_PUSHPULL(2) | \
785
PIN_OTYPE_PUSHPULL(3) | \
786
PIN_OTYPE_PUSHPULL(4) | \
787
PIN_OTYPE_PUSHPULL(5) | \
788
PIN_OTYPE_PUSHPULL(6) | \
789
PIN_OTYPE_PUSHPULL(7) | \
790
PIN_OTYPE_PUSHPULL(8) | \
791
PIN_OTYPE_PUSHPULL(9) | \
792
PIN_OTYPE_PUSHPULL(10) | \
793
PIN_OTYPE_PUSHPULL(11) | \
794
PIN_OTYPE_PUSHPULL(12) | \
795
PIN_OTYPE_PUSHPULL(13) | \
796
PIN_OTYPE_PUSHPULL(14) | \
797
PIN_OTYPE_PUSHPULL(15))
798
#define VAL_GPIOG_OSPEEDR (PIN_OSPEED_100M(0) | \
799
PIN_OSPEED_100M(1) | \
800
PIN_OSPEED_100M(2) | \
801
PIN_OSPEED_100M(3) | \
802
PIN_OSPEED_100M(4) | \
803
PIN_OSPEED_100M(5) | \
804
PIN_OSPEED_100M(6) | \
805
PIN_OSPEED_100M(7) | \
806
PIN_OSPEED_100M(8) | \
807
PIN_OSPEED_100M(9) | \
808
PIN_OSPEED_100M(10) | \
809
PIN_OSPEED_100M(11) | \
810
PIN_OSPEED_100M(12) | \
811
PIN_OSPEED_100M(13) | \
812
PIN_OSPEED_100M(14) | \
813
PIN_OSPEED_100M(15))
814
#define VAL_GPIOG_PUPDR (PIN_PUPDR_FLOATING(0) | \
815
PIN_PUPDR_FLOATING(1) | \
816
PIN_PUPDR_FLOATING(2) | \
817
PIN_PUPDR_FLOATING(3) | \
818
PIN_PUPDR_FLOATING(4) | \
819
PIN_PUPDR_FLOATING(5) | \
820
PIN_PUPDR_FLOATING(6) | \
821
PIN_PUPDR_FLOATING(7) | \
822
PIN_PUPDR_FLOATING(8) | \
823
PIN_PUPDR_FLOATING(9) | \
824
PIN_PUPDR_FLOATING(10) | \
825
PIN_PUPDR_FLOATING(11) | \
826
PIN_PUPDR_FLOATING(12) | \
827
PIN_PUPDR_FLOATING(13) | \
828
PIN_PUPDR_FLOATING(14) | \
829
PIN_PUPDR_FLOATING(15))
830
#define VAL_GPIOG_ODR (PIN_ODR_HIGH(0) | \
831
PIN_ODR_HIGH(1) | \
832
PIN_ODR_HIGH(2) | \
833
PIN_ODR_HIGH(3) | \
834
PIN_ODR_HIGH(4) | \
835
PIN_ODR_HIGH(5) | \
836
PIN_ODR_HIGH(6) | \
837
PIN_ODR_HIGH(7) | \
838
PIN_ODR_HIGH(8) | \
839
PIN_ODR_HIGH(9) | \
840
PIN_ODR_HIGH(10) | \
841
PIN_ODR_HIGH(11) | \
842
PIN_ODR_HIGH(12) | \
843
PIN_ODR_HIGH(13) | \
844
PIN_ODR_HIGH(14) | \
845
PIN_ODR_HIGH(15))
846
#define VAL_GPIOG_AFRL (PIN_AFIO_AF(0, 0) | \
847
PIN_AFIO_AF(1, 0) | \
848
PIN_AFIO_AF(2, 0) | \
849
PIN_AFIO_AF(3, 0) | \
850
PIN_AFIO_AF(4, 0) | \
851
PIN_AFIO_AF(5, 0) | \
852
PIN_AFIO_AF(6, 0) | \
853
PIN_AFIO_AF(7, 0))
854
#define VAL_GPIOG_AFRH (PIN_AFIO_AF(8, 0) | \
855
PIN_AFIO_AF(9, 0) | \
856
PIN_AFIO_AF(10, 0) | \
857
PIN_AFIO_AF(11, 0) | \
858
PIN_AFIO_AF(12, 0) | \
859
PIN_AFIO_AF(13, 0) | \
860
PIN_AFIO_AF(14, 0) | \
861
PIN_AFIO_AF(15, 0))
862
863
/*
864
* GPIOH setup:
865
*
866
* PH0 - PH15 (input floating).
867
*/
868
#define VAL_GPIOH_MODER (PIN_MODE_INPUT(0) | \
869
PIN_MODE_INPUT(1) | \
870
PIN_MODE_INPUT(2) | \
871
PIN_MODE_INPUT(3) | \
872
PIN_MODE_INPUT(4) | \
873
PIN_MODE_INPUT(5) | \
874
PIN_MODE_INPUT(6) | \
875
PIN_MODE_INPUT(7) | \
876
PIN_MODE_INPUT(8) | \
877
PIN_MODE_INPUT(9) | \
878
PIN_MODE_INPUT(10) | \
879
PIN_MODE_INPUT(11) | \
880
PIN_MODE_INPUT(12) | \
881
PIN_MODE_INPUT(13) | \
882
PIN_MODE_INPUT(14) | \
883
PIN_MODE_INPUT(15))
884
#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
885
PIN_OTYPE_PUSHPULL(1) | \
886
PIN_OTYPE_PUSHPULL(2) | \
887
PIN_OTYPE_PUSHPULL(3) | \
888
PIN_OTYPE_PUSHPULL(4) | \
889
PIN_OTYPE_PUSHPULL(5) | \
890
PIN_OTYPE_PUSHPULL(6) | \
891
PIN_OTYPE_PUSHPULL(7) | \
892
PIN_OTYPE_PUSHPULL(8) | \
893
PIN_OTYPE_PUSHPULL(9) | \
894
PIN_OTYPE_PUSHPULL(10) | \
895
PIN_OTYPE_PUSHPULL(11) | \
896
PIN_OTYPE_PUSHPULL(12) | \
897
PIN_OTYPE_PUSHPULL(13) | \
898
PIN_OTYPE_PUSHPULL(14) | \
899
PIN_OTYPE_PUSHPULL(15))
900
#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_100M(0) | \
901
PIN_OSPEED_100M(1) | \
902
PIN_OSPEED_100M(2) | \
903
PIN_OSPEED_100M(3) | \
904
PIN_OSPEED_100M(4) | \
905
PIN_OSPEED_100M(5) | \
906
PIN_OSPEED_100M(6) | \
907
PIN_OSPEED_100M(7) | \
908
PIN_OSPEED_100M(8) | \
909
PIN_OSPEED_100M(9) | \
910
PIN_OSPEED_100M(10) | \
911
PIN_OSPEED_100M(11) | \
912
PIN_OSPEED_100M(12) | \
913
PIN_OSPEED_100M(13) | \
914
PIN_OSPEED_100M(14) | \
915
PIN_OSPEED_100M(15))
916
#define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(0) | \
917
PIN_PUPDR_FLOATING(1) | \
918
PIN_PUPDR_FLOATING(2) | \
919
PIN_PUPDR_FLOATING(3) | \
920
PIN_PUPDR_FLOATING(4) | \
921
PIN_PUPDR_FLOATING(5) | \
922
PIN_PUPDR_FLOATING(6) | \
923
PIN_PUPDR_FLOATING(7) | \
924
PIN_PUPDR_FLOATING(8) | \
925
PIN_PUPDR_FLOATING(9) | \
926
PIN_PUPDR_FLOATING(10) | \
927
PIN_PUPDR_FLOATING(11) | \
928
PIN_PUPDR_FLOATING(12) | \
929
PIN_PUPDR_FLOATING(13) | \
930
PIN_PUPDR_FLOATING(14) | \
931
PIN_PUPDR_FLOATING(15))
932
#define VAL_GPIOH_ODR (PIN_ODR_HIGH(0) | \
933
PIN_ODR_HIGH(1) | \
934
PIN_ODR_HIGH(2) | \
935
PIN_ODR_HIGH(3) | \
936
PIN_ODR_HIGH(4) | \
937
PIN_ODR_HIGH(5) | \
938
PIN_ODR_HIGH(6) | \
939
PIN_ODR_HIGH(7) | \
940
PIN_ODR_HIGH(8) | \
941
PIN_ODR_HIGH(9) | \
942
PIN_ODR_HIGH(10) | \
943
PIN_ODR_HIGH(11) | \
944
PIN_ODR_HIGH(12) | \
945
PIN_ODR_HIGH(13) | \
946
PIN_ODR_HIGH(14) | \
947
PIN_ODR_HIGH(15))
948
#define VAL_GPIOH_AFRL (PIN_AFIO_AF(0, 0) | \
949
PIN_AFIO_AF(1, 0) | \
950
PIN_AFIO_AF(2, 0) | \
951
PIN_AFIO_AF(3, 0) | \
952
PIN_AFIO_AF(4, 0) | \
953
PIN_AFIO_AF(5, 0) | \
954
PIN_AFIO_AF(6, 0) | \
955
PIN_AFIO_AF(7, 0))
956
#define VAL_GPIOH_AFRH (PIN_AFIO_AF(8, 0) | \
957
PIN_AFIO_AF(9, 0) | \
958
PIN_AFIO_AF(10, 0) | \
959
PIN_AFIO_AF(11, 0) | \
960
PIN_AFIO_AF(12, 0) | \
961
PIN_AFIO_AF(13, 0) | \
962
PIN_AFIO_AF(14, 0) | \
963
PIN_AFIO_AF(15, 0))
964
965
/*
966
* GPIOI setup:
967
*
968
* PI0 - PI15 (input floating).
969
*/
970
#define VAL_GPIOI_MODER (PIN_MODE_INPUT(0) | \
971
PIN_MODE_INPUT(1) | \
972
PIN_MODE_INPUT(2) | \
973
PIN_MODE_INPUT(3) | \
974
PIN_MODE_INPUT(4) | \
975
PIN_MODE_INPUT(5) | \
976
PIN_MODE_INPUT(6) | \
977
PIN_MODE_INPUT(7) | \
978
PIN_MODE_INPUT(8) | \
979
PIN_MODE_INPUT(9) | \
980
PIN_MODE_INPUT(10) | \
981
PIN_MODE_INPUT(11) | \
982
PIN_MODE_INPUT(12) | \
983
PIN_MODE_INPUT(13) | \
984
PIN_MODE_INPUT(14) | \
985
PIN_MODE_INPUT(15))
986
#define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(0) | \
987
PIN_OTYPE_PUSHPULL(1) | \
988
PIN_OTYPE_PUSHPULL(2) | \
989
PIN_OTYPE_PUSHPULL(3) | \
990
PIN_OTYPE_PUSHPULL(4) | \
991
PIN_OTYPE_PUSHPULL(5) | \
992
PIN_OTYPE_PUSHPULL(6) | \
993
PIN_OTYPE_PUSHPULL(7) | \
994
PIN_OTYPE_PUSHPULL(8) | \
995
PIN_OTYPE_PUSHPULL(9) | \
996
PIN_OTYPE_PUSHPULL(10) | \
997
PIN_OTYPE_PUSHPULL(11) | \
998
PIN_OTYPE_PUSHPULL(12) | \
999
PIN_OTYPE_PUSHPULL(13) | \
1000
PIN_OTYPE_PUSHPULL(14) | \
1001
PIN_OTYPE_PUSHPULL(15))
1002
#define VAL_GPIOI_OSPEEDR (PIN_OSPEED_100M(0) | \
1003
PIN_OSPEED_100M(1) | \
1004
PIN_OSPEED_100M(2) | \
1005
PIN_OSPEED_100M(3) | \
1006
PIN_OSPEED_100M(4) | \
1007
PIN_OSPEED_100M(5) | \
1008
PIN_OSPEED_100M(6) | \
1009
PIN_OSPEED_100M(7) | \
1010
PIN_OSPEED_100M(8) | \
1011
PIN_OSPEED_100M(9) | \
1012
PIN_OSPEED_100M(10) | \
1013
PIN_OSPEED_100M(11) | \
1014
PIN_OSPEED_100M(12) | \
1015
PIN_OSPEED_100M(13) | \
1016
PIN_OSPEED_100M(14) | \
1017
PIN_OSPEED_100M(15))
1018
#define VAL_GPIOI_PUPDR (PIN_PUPDR_FLOATING(0) | \
1019
PIN_PUPDR_FLOATING(1) | \
1020
PIN_PUPDR_FLOATING(2) | \
1021
PIN_PUPDR_FLOATING(3) | \
1022
PIN_PUPDR_FLOATING(4) | \
1023
PIN_PUPDR_FLOATING(5) | \
1024
PIN_PUPDR_FLOATING(6) | \
1025
PIN_PUPDR_FLOATING(7) | \
1026
PIN_PUPDR_FLOATING(8) | \
1027
PIN_PUPDR_FLOATING(9) | \
1028
PIN_PUPDR_FLOATING(10) | \
1029
PIN_PUPDR_FLOATING(11) | \
1030
PIN_PUPDR_FLOATING(12) | \
1031
PIN_PUPDR_FLOATING(13) | \
1032
PIN_PUPDR_FLOATING(14) | \
1033
PIN_PUPDR_FLOATING(15))
1034
#define VAL_GPIOI_ODR (PIN_ODR_HIGH(0) | \
1035
PIN_ODR_HIGH(1) | \
1036
PIN_ODR_HIGH(2) | \
1037
PIN_ODR_HIGH(3) | \
1038
PIN_ODR_HIGH(4) | \
1039
PIN_ODR_HIGH(5) | \
1040
PIN_ODR_HIGH(6) | \
1041
PIN_ODR_HIGH(7) | \
1042
PIN_ODR_HIGH(8) | \
1043
PIN_ODR_HIGH(9) | \
1044
PIN_ODR_HIGH(10) | \
1045
PIN_ODR_HIGH(11) | \
1046
PIN_ODR_HIGH(12) | \
1047
PIN_ODR_HIGH(13) | \
1048
PIN_ODR_HIGH(14) | \
1049
PIN_ODR_HIGH(15))
1050
#define VAL_GPIOI_AFRL (PIN_AFIO_AF(0, 0) | \
1051
PIN_AFIO_AF(1, 0) | \
1052
PIN_AFIO_AF(2, 0) | \
1053
PIN_AFIO_AF(3, 0) | \
1054
PIN_AFIO_AF(4, 0) | \
1055
PIN_AFIO_AF(5, 0) | \
1056
PIN_AFIO_AF(6, 0) | \
1057
PIN_AFIO_AF(7, 0))
1058
#define VAL_GPIOI_AFRH (PIN_AFIO_AF(8, 0) | \
1059
PIN_AFIO_AF(9, 0) | \
1060
PIN_AFIO_AF(10, 0) | \
1061
PIN_AFIO_AF(11, 0) | \
1062
PIN_AFIO_AF(12, 0) | \
1063
PIN_AFIO_AF(13, 0) | \
1064
PIN_AFIO_AF(14, 0) | \
1065
PIN_AFIO_AF(15, 0))
1066
1067
1068
/*
1069
* AHB_CLK
1070
*/
1071
#define AHB_CLK STM32_HCLK
1072
1073
1074
/*
1075
* LEDs
1076
*/
1077
// no LEDS here
1078
1079
/*
1080
* ADCs
1081
*/
1082
// AIN1 enabled by default
1083
#ifndef USE_ADC_1
1084
#define USE_ADC_1 1
1085
#endif
1086
#if USE_ADC_1
1087
#define AD1_1_CHANNEL ADC_CHANNEL_IN10
1088
#define ADC_1 AD1_1
1089
#define ADC_1_GPIO_PORT GPIOC
1090
#define ADC_1_GPIO_PIN GPIO0
1091
#endif
1092
1093
// AIN2 enabled by default
1094
#ifndef USE_ADC_2
1095
#define USE_ADC_2 1
1096
#endif
1097
#if USE_ADC_2
1098
#define AD1_2_CHANNEL ADC_CHANNEL_IN11
1099
#define ADC_2 AD1_2
1100
#define ADC_2_GPIO_PORT GPIOC
1101
#define ADC_2_GPIO_PIN GPIO1
1102
#endif
1103
1104
// AIN3 enabled by default
1105
#ifndef USE_ADC_3
1106
#define USE_ADC_3 1
1107
#endif
1108
#if USE_ADC_3
1109
#define AD1_3_CHANNEL ADC_CHANNEL_IN12
1110
#define ADC_3 AD1_3
1111
#define ADC_3_GPIO_PORT GPIOC
1112
#define ADC_3_GPIO_PIN GPIO2
1113
#endif
1114
1115
// AIN4 enabled by default
1116
#ifndef USE_ADC_4
1117
#define USE_ADC_4 1
1118
#endif
1119
#if USE_ADC_4
1120
#define AD1_4_CHANNEL ADC_CHANNEL_IN13
1121
#define ADC_4 AD1_4
1122
#define ADC_4_GPIO_PORT GPIOC
1123
#define ADC_4_GPIO_PIN GPIO3
1124
#endif
1125
1126
1127
// Internal Temperature sensor enabled by default
1128
/*
1129
#ifndef USE_ADC_5
1130
#define USE_ADC_5 1
1131
#define USE_ADC_SENSOR 1
1132
#endif
1133
#if USE_ADC_5
1134
#define AD1_5_CHANNEL ADC_CHANNEL_SENSOR
1135
#define ADC_5 AD1_5
1136
#define ADC_5_GPIO_PORT GPIOC // dummy pin
1137
#define ADC_5_GPIO_PIN GPIO3 // dummy pin
1138
#endif
1139
*/
1140
1141
// Add board defines
1142
#define AIN_1 AD1_1_CHANNEL
1143
#define AIN_2 AD1_2_CHANNEL
1144
#define AIN_3 AD1_3_CHANNEL
1145
#define AIN_4 AD1_4_CHANNEL
1146
1147
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
1148
//#ifndef ADC_CHANNEL_VSUPPLY
1149
//#define ADC_CHANNEL_VSUPPLY ADC_1
1150
//#endif
1151
1152
//#define ADC_CHANNEL_CURRENT ADC_2
1153
1154
#define DefaultVoltageOfAdc(adc) (0.000805664*adc)//(0.004489*adc)
1155
#define DefaultMilliAmpereOfAdc(adc) (0.004489*adc)
1156
1157
/*
1158
* PWM defines
1159
* no PWM outputs used
1160
*/
1161
#ifndef USE_PWM0
1162
#define USE_PWM0 1
1163
#endif
1164
#if USE_PWM0
1165
#define PWM_SERVO_0 0
1166
#define PWM_SERVO_0_GPIO GPIOB
1167
#define PWM_SERVO_0_PIN GPIO0
1168
#define PWM_SERVO_0_AF GPIO_AF2
1169
#define PWM_SERVO_0_DRIVER PWMD3
1170
#define PWM_SERVO_0_CHANNEL 2
1171
#define PWM_SERVO_0_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1172
#else
1173
#define PWM_SERVO_0_ACTIVE PWM_OUTPUT_DISABLED
1174
#endif
1175
1176
#ifndef USE_PWM1
1177
#define USE_PWM1 1
1178
#endif
1179
#if USE_PWM1
1180
#define PWM_SERVO_1 1
1181
#define PWM_SERVO_1_GPIO GPIOA
1182
#define PWM_SERVO_1_PIN GPIO2
1183
#define PWM_SERVO_1_AF GPIO_AF1
1184
#define PWM_SERVO_1_DRIVER PWMD3
1185
#define PWM_SERVO_1_CHANNEL 2
1186
#define PWM_SERVO_1_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1187
#else
1188
#define PWM_SERVO_1_ACTIVE PWM_OUTPUT_DISABLED
1189
#endif
1190
1191
#ifndef USE_PWM2
1192
#define USE_PWM2 1
1193
#endif
1194
#if USE_PWM2
1195
#define PWM_SERVO_2 2
1196
#define PWM_SERVO_2_GPIO GPIOB
1197
#define PWM_SERVO_2_PIN GPIO5
1198
#define PWM_SERVO_2_AF GPIO_AF3
1199
#define PWM_SERVO_2_DRIVER PWMD3
1200
#define PWM_SERVO_2_CHANNEL 1
1201
#define PWM_SERVO_2_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1202
#else
1203
#define PWM_SERVO_2_ACTIVE PWM_OUTPUT_DISABLED
1204
#endif
1205
1206
#ifndef USE_PWM3
1207
#define USE_PWM3 1
1208
#endif
1209
#if USE_PWM3
1210
#define PWM_SERVO_3 3
1211
#define PWM_SERVO_3_GPIO GPIOB
1212
#define PWM_SERVO_3_PIN GPIO4
1213
#define PWM_SERVO_3_AF GPIO_AF2
1214
#define PWM_SERVO_3_DRIVER PWMD3
1215
#define PWM_SERVO_3_CHANNEL 0
1216
#define PWM_SERVO_3_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1217
#else
1218
#define PWM_SERVO_3_ACTIVE PWM_OUTPUT_DISABLED
1219
#endif
1220
1221
1226
#define RC_PPM_TICKS_PER_USEC 6
1227
#define PPM_TIMER_FREQUENCY 6000000
1228
#define PPM_CHANNEL ICU_CHANNEL_3
1229
#define PPM_TIMER ICUD1
1230
1235
#define I2C1_CLOCK_SPEED 400000
1236
#define I2C1_CFG_DEF { \
1237
OPMODE_I2C, \
1238
I2C1_CLOCK_SPEED, \
1239
FAST_DUTY_CYCLE_2, \
1240
}
1241
1242
#define I2C2_CLOCK_SPEED 400000
1243
#define I2C2_CFG_DEF { \
1244
OPMODE_I2C, \
1245
I2C2_CLOCK_SPEED, \
1246
FAST_DUTY_CYCLE_2, \
1247
}
1248
1252
// SLAVE0 - unconnected
1253
#define SPI_SELECT_SLAVE0_PORT GPIOB
1254
#define SPI_SELECT_SLAVE0_PIN 9
1255
// SLAVE1 - unconnected
1256
#define SPI_SELECT_SLAVE1_PORT GPIOB
1257
#define SPI_SELECT_SLAVE1_PIN 1
1258
// SLAVE2 is ASPIRIN MPU600 CS
1259
#define SPI_SELECT_SLAVE2_PORT GPIOB
1260
#define SPI_SELECT_SLAVE2_PIN 12
1261
// SLAVE3 is BARO_CS
1262
#define SPI_SELECT_SLAVE3_PORT GPIOE
1263
#define SPI_SELECT_SLAVE3_PIN 3
1264
// SLAVE4 - unconnected
1265
#define SPI_SELECT_SLAVE4_PORT GPIOB
1266
#define SPI_SELECT_SLAVE4_PIN 2
1267
1279
#ifndef USE_BARO_BOARD
1280
#define USE_BARO_BOARD 0
1281
#endif
1282
1283
/*
1284
* Actuators for fixedwing
1285
*/
1286
/* Default actuators driver */
1287
#define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
1288
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
1289
#define ActuatorsDefaultInit() ActuatorsPwmInit()
1290
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
1291
1292
#if !defined(_FROM_ASM_)
1293
#ifdef __cplusplus
1294
extern
"C"
{
1295
#endif
1296
void
boardInit
(
void
);
1297
#ifdef __cplusplus
1298
}
1299
#endif
1300
#endif
/* _FROM_ASM_ */
1301
1302
#endif
/* _BOARD_H_ */
boardInit
void boardInit(void)
Board-specific initialization code.
Definition:
board.c:122
sw
airborne
boards
vms_ecu
chibios
v1.0
board.h
Generated on Sat Feb 9 2019 06:43:47 for Paparazzi UAS by
1.8.8