Paparazzi UAS
v5.14.0_stable-0-g3f680d1
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_LISA
28
#define BOARD_NAME "STMicroelectronics STM32F4-Lisa"
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 12000000
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 - Alternate Push Pull output 50MHz (SERVO5-Timer5Ch1)
82
* PA1 - Alternate Push Pull output 50MHz (SERVO6-Timer5Ch2)
83
* PA2 - Alternate Push Pull output 50MHz (UART2_TX)
84
* PA3 - Digital input (UART2_RX)
85
* PA4 - Alternate Push Pull output 50MHz (EXTSPI1_SS)
86
* PA5 - Alternate Push Pull output 50MHz (EXTSPI1_SCK)
87
* PA6 - Digital input. (EXTSPI1_MISO)
88
* PA7 - Alternate Push Pull output 50MHz (EXTSPI1_MOSI)
89
* PA8 - Open Drain output 50MHz (LED1)
90
* PA9 - Digital input. (USB_VBUS)
91
* PA10 - Digital input. (UART1_Rx / PPM_IN Timer1Ch3)
92
* PA11 - Alternate input (USB_DM)
93
* PA12 - Alternate input (USB_DP)
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_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_INPUT(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, 2) | \
179
PIN_AFIO_AF(1, 2) | \
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, 0) | \
188
PIN_AFIO_AF(10, 1) | \
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
204
* PB7 - Alternate Push Pull output 50MHz (SERVO8-Timer4Ch2)/USART1_RX
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_PUSHPULL(6) | \
237
PIN_OTYPE_PUSHPULL(7) | \
238
PIN_OTYPE_PUSHPULL(8) | \
239
PIN_OTYPE_OPENDRAIN(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_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_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_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_FLOATING(6) | \
269
PIN_PUPDR_FLOATING(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, 7) | \
301
PIN_AFIO_AF(7, 7))
302
#define VAL_GPIOB_AFRH (PIN_AFIO_AF(8, 9) | \
303
PIN_AFIO_AF(9, 9) | \
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 (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, 7) | \
421
PIN_AFIO_AF(11, 7) | \
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 defines
1168
*/
1169
#ifndef USE_PWM0
1170
#define USE_PWM0 1
1171
#endif
1172
#if USE_PWM0
1173
#define PWM_SERVO_0 0
1174
#define PWM_SERVO_0_GPIO GPIOC
1175
#define PWM_SERVO_0_PIN GPIO6
1176
#define PWM_SERVO_0_AF GPIO_AF2
1177
#define PWM_SERVO_0_DRIVER PWMD3
1178
#define PWM_SERVO_0_CHANNEL 0
1179
#define PWM_SERVO_0_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1180
#else
1181
#define PWM_SERVO_0_ACTIVE PWM_OUTPUT_DISABLED
1182
#endif
1183
1184
#ifndef USE_PWM1
1185
#define USE_PWM1 1
1186
#endif
1187
#if USE_PWM1
1188
#define PWM_SERVO_1 1
1189
#define PWM_SERVO_1_GPIO GPIOC
1190
#define PWM_SERVO_1_PIN GPIO7
1191
#define PWM_SERVO_1_AF GPIO_AF2
1192
#define PWM_SERVO_1_DRIVER PWMD3
1193
#define PWM_SERVO_1_CHANNEL 1
1194
#define PWM_SERVO_1_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1195
#else
1196
#define PWM_SERVO_1_ACTIVE PWM_OUTPUT_DISABLED
1197
#endif
1198
1199
#ifndef USE_PWM2
1200
#define USE_PWM2 1
1201
#endif
1202
#if USE_PWM2
1203
#define PWM_SERVO_2 2
1204
#define PWM_SERVO_2_GPIO GPIOC
1205
#define PWM_SERVO_2_PIN GPIO8
1206
#define PWM_SERVO_2_AF GPIO_AF2
1207
#define PWM_SERVO_2_DRIVER PWMD3
1208
#define PWM_SERVO_2_CHANNEL 2
1209
#define PWM_SERVO_2_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1210
#else
1211
#define PWM_SERVO_2_ACTIVE PWM_OUTPUT_DISABLED
1212
#endif
1213
1214
#ifndef USE_PWM3
1215
#define USE_PWM3 1
1216
#endif
1217
#if USE_PWM3
1218
#define PWM_SERVO_3 3
1219
#define PWM_SERVO_3_GPIO GPIOC
1220
#define PWM_SERVO_3_PIN GPIO9
1221
#define PWM_SERVO_3_AF GPIO_AF2
1222
#define PWM_SERVO_3_DRIVER PWMD3
1223
#define PWM_SERVO_3_CHANNEL 3
1224
#define PWM_SERVO_3_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1225
#else
1226
#define PWM_SERVO_3_ACTIVE PWM_OUTPUT_DISABLED
1227
#endif
1228
1229
#ifndef USE_PWM4
1230
#define USE_PWM4 1
1231
#endif
1232
#if USE_PWM4
1233
#define PWM_SERVO_4 4
1234
#define PWM_SERVO_4_GPIO GPIOA
1235
#define PWM_SERVO_4_PIN GPIO0
1236
#define PWM_SERVO_4_AF GPIO_AF2
1237
#define PWM_SERVO_4_DRIVER PWMD5
1238
#define PWM_SERVO_4_CHANNEL 0
1239
#define PWM_SERVO_4_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1240
#else
1241
#define PWM_SERVO_4_ACTIVE PWM_OUTPUT_DISABLED
1242
#endif
1243
1244
#ifndef USE_PWM5
1245
#define USE_PWM5 1
1246
#endif
1247
#if USE_PWM5
1248
#define PWM_SERVO_5 5
1249
#define PWM_SERVO_5_GPIO GPIOA
1250
#define PWM_SERVO_5_PIN GPIO1
1251
#define PWM_SERVO_5_AF GPIO_AF2
1252
#define PWM_SERVO_5_DRIVER PWMD5
1253
#define PWM_SERVO_5_CHANNEL 1
1254
#define PWM_SERVO_5_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1255
#else
1256
#define PWM_SERVO_5_ACTIVE PWM_OUTPUT_DISABLED
1257
#endif
1258
1259
1260
#if USE_SERVOS_7AND8
1261
#if USE_I2C1
1262
#error "You cannot USE_SERVOS_7AND8 and USE_I2C1 at the same time"
1263
#else
/* !USE_I2C1 */
1264
#if USE_PWM6
1265
#define PWM_SERVO_6 6
1266
#define PWM_SERVO_6_GPIO GPIOB
1267
#define PWM_SERVO_6_PIN GPIO6
1268
#define PWM_SERVO_6_AF GPIO_AF2
1269
#define PWM_SERVO_6_DRIVER PWMD4
1270
#define PWM_SERVO_6_CHANNEL 0
1271
#define PWM_SERVO_6_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1272
#else
1273
#define PWM_SERVO_6_ACTIVE PWM_OUTPUT_DISABLED
1274
#endif
1275
1276
#if USE_PWM7
1277
#define PWM_SERVO_7 7
1278
#define PWM_SERVO_7_GPIO GPIOB
1279
#define PWM_SERVO_7_PIN GPIO7
1280
#define PWM_SERVO_7_AF GPIO_AF2
1281
#define PWM_SERVO_7_DRIVER PWMD4
1282
#define PWM_SERVO_7_CHANNEL 1
1283
#define PWM_SERVO_7_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
1284
#else
1285
#define PWM_SERVO_7_ACTIVE PWM_OUTPUT_DISABLED
1286
#endif
1287
1288
#define PWM_CONF_TIM3 1
1289
#define PWM_CONF_TIM4 1
1290
#define PWM_CONF_TIM5 1
1291
#define PWM_CONF3_DEF { \
1292
PWM_FREQUENCY, \
1293
PWM_FREQUENCY/TIM3_SERVO_HZ, \
1294
NULL, \
1295
{ \
1296
{PWM_SERVO_0_ACTIVE, NULL}, \
1297
{PWM_SERVO_1_ACTIVE, NULL}, \
1298
{PWM_SERVO_2_ACTIVE, NULL}, \
1299
{PWM_SERVO_3_ACTIVE, NULL} \
1300
}, \
1301
0, \
1302
0 \
1303
}
1304
#define PWM_CONF4_DEF { \
1305
PWM_FREQUENCY, \
1306
PWM_FREQUENCY/TIM4_SERVO_HZ, \
1307
NULL, \
1308
{ \
1309
{PWM_SERVO_6_ACTIVE, NULL}, \
1310
{PWM_SERVO_7_ACTIVE, NULL}, \
1311
{PWM_OUTPUT_DISABLED, NULL}, \
1312
{PWM_OUTPUT_DISABLED, NULL} \
1313
}, \
1314
0, \
1315
0 \
1316
}
1317
#define PWM_CONF5_DEF { \
1318
PWM_FREQUENCY, \
1319
PWM_FREQUENCY/TIM5_SERVO_HZ, \
1320
NULL, \
1321
{ \
1322
{PWM_SERVO_4_ACTIVE, NULL}, \
1323
{PWM_SERVO_5_ACTIVE, NULL}, \
1324
{PWM_OUTPUT_DISABLED, NULL}, \
1325
{PWM_OUTPUT_DISABLED, NULL} \
1326
}, \
1327
0, \
1328
0 \
1329
}
1330
#endif
/* USE_I2C1 */
1331
#else
/* !USE_SERVOS_7AND8 */
1332
#define PWM_CONF_TIM3 1
1333
#define PWM_CONF_TIM5 1
1334
#define PWM_CONF3_DEF { \
1335
PWM_FREQUENCY, \
1336
PWM_FREQUENCY/TIM3_SERVO_HZ, \
1337
NULL, \
1338
{ \
1339
{PWM_SERVO_0_ACTIVE, NULL}, \
1340
{PWM_SERVO_1_ACTIVE, NULL}, \
1341
{PWM_SERVO_2_ACTIVE, NULL}, \
1342
{PWM_SERVO_3_ACTIVE, NULL} \
1343
}, \
1344
0, \
1345
0 \
1346
}
1347
#define PWM_CONF5_DEF { \
1348
PWM_FREQUENCY, \
1349
PWM_FREQUENCY/TIM5_SERVO_HZ, \
1350
NULL, \
1351
{ \
1352
{PWM_SERVO_4_ACTIVE, NULL}, \
1353
{PWM_SERVO_5_ACTIVE, NULL}, \
1354
{PWM_OUTPUT_DISABLED, NULL}, \
1355
{PWM_OUTPUT_DISABLED, NULL} \
1356
}, \
1357
0, \
1358
0 \
1359
}
1360
#endif
/* USE_SERVOS_7AND8 */
1361
1362
1366
#define RC_PPM_TICKS_PER_USEC 6
1367
#define PPM_TIMER_FREQUENCY 6000000
1368
#define PPM_CHANNEL ICU_CHANNEL_1
1369
#define PPM_TIMER ICUD1
1370
1374
#define I2C1_CLOCK_SPEED 400000
1375
#define I2C1_CFG_DEF { \
1376
OPMODE_I2C, \
1377
I2C1_CLOCK_SPEED, \
1378
FAST_DUTY_CYCLE_2, \
1379
}
1380
1381
#define I2C2_CLOCK_SPEED 400000
1382
#define I2C2_CFG_DEF { \
1383
OPMODE_I2C, \
1384
I2C2_CLOCK_SPEED, \
1385
FAST_DUTY_CYCLE_2, \
1386
}
1387
1391
#define SPI_SELECT_SLAVE0_PORT GPIOA
1392
#define SPI_SELECT_SLAVE0_PIN GPIO15
1393
1394
#define SPI_SELECT_SLAVE1_PORT GPIOA
1395
#define SPI_SELECT_SLAVE1_PIN GPIO4
1396
1397
#define SPI_SELECT_SLAVE2_PORT GPIOB
1398
#define SPI_SELECT_SLAVE2_PIN GPIO12
1399
1400
#define SPI_SELECT_SLAVE3_PORT GPIOC
1401
#define SPI_SELECT_SLAVE3_PIN GPIO13
1402
1403
#define SPI_SELECT_SLAVE4_PORT GPIOC
1404
#define SPI_SELECT_SLAVE4_PIN GPIO12
1405
1406
#define SPI_SELECT_SLAVE5_PORT GPIOC
1407
#define SPI_SELECT_SLAVE5_PIN GPIO4
1408
1409
#define SPI1_GPIO_PORT_NSS GPIOA
1410
#define SPI1_GPIO_NSS GPIO4
1411
1412
#define SPI2_GPIO_PORT_NSS GPIOB
1413
#define SPI2_GPIO_NSS GPIO12
1414
1415
#define SPI3_GPIO_PORT_NSS GPIO
1416
1423
#ifndef USE_BARO_BOARD
1424
#define USE_BARO_BOARD 1
1425
#endif
1426
1427
/*
1428
* Actuators for fixedwing
1429
*/
1430
/* Default actuators driver */
1431
#define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
1432
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
1433
#define ActuatorsDefaultInit() ActuatorsPwmInit()
1434
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
1435
1436
#if !defined(_FROM_ASM_)
1437
#ifdef __cplusplus
1438
extern
"C"
{
1439
#endif
1440
void
boardInit
(
void
);
1441
#ifdef __cplusplus
1442
}
1443
#endif
1444
#endif
/* _FROM_ASM_ */
1445
1446
#endif
/* _BOARD_H_ */
boardInit
void boardInit(void)
Board-specific initialization code.
Definition:
board.c:261
sw
airborne
boards
lisa_mx
chibios
v2.1
board.h
Generated on Sat Feb 9 2019 07:05:36 for Paparazzi UAS by
1.8.8