Paparazzi UAS
v6.1.0_stable
Paparazzi is a free software Unmanned Aircraft System.
px4fmu.h
Go to the documentation of this file.
1
#ifndef CONFIG_PX4FMU_5_00_H
2
#define CONFIG_PX4FMU_5_00_H
3
4
#define BOARD_PX4FMU
5
9
#include "
boards/px4fmu/chibios/v5.0/board.h
"
10
15
/*
16
* AHB_CLK
17
*/
18
#define AHB_CLK STM32_HCLK
19
20
/*
21
* LEDs
22
*/
23
#if defined(LINE_LED1)
24
#ifndef USE_LED_1
25
#define USE_LED_1 1
26
#endif
27
#define LED_1_GPIO PAL_PORT(LINE_LED1)
28
#define LED_1_GPIO_PIN PAL_PAD(LINE_LED1)
29
#define LED_1_GPIO_ON gpio_clear
30
#define LED_1_GPIO_OFF gpio_set
31
#define LED_1_AFIO_REMAP ((void)0)
32
#endif
33
34
#if defined(LINE_LED2)
35
#ifndef USE_LED_2
36
#define USE_LED_2 1
37
#endif
38
#define LED_2_GPIO PAL_PORT(LINE_LED2)
39
#define LED_2_GPIO_PIN PAL_PAD(LINE_LED2)
40
#define LED_2_GPIO_ON gpio_clear
41
#define LED_2_GPIO_OFF gpio_set
42
#define LED_2_AFIO_REMAP ((void)0)
43
#endif
44
45
#if defined(LINE_LED3)
46
#ifndef USE_LED_3
47
#define USE_LED_3 1
48
#endif
49
#define LED_3_GPIO PAL_PORT(LINE_LED3)
50
#define LED_3_GPIO_PIN PAL_PAD(LINE_LED3)
51
#define LED_3_GPIO_ON gpio_clear
52
#define LED_3_GPIO_OFF gpio_set
53
#define LED_3_AFIO_REMAP ((void)0)
54
#endif
55
56
#if defined(LINE_LED4)
57
#ifndef USE_LED_4
58
#define USE_LED_4 1
59
#endif
60
#define LED_4_GPIO PAL_PORT(LINE_LED4)
61
#define LED_4_GPIO_PIN PAL_PAD(LINE_LED4)
62
#define LED_4_GPIO_ON gpio_clear
63
#define LED_4_GPIO_OFF gpio_set
64
#define LED_4_AFIO_REMAP ((void)0)
65
#endif
66
67
/*
68
* ADCs
69
*/
70
#if defined(LINE_ADC1)
71
#ifndef USE_ADC_1
72
#define USE_ADC_1 1
73
#endif
74
#if USE_ADC_1
75
#define AD1_1_CHANNEL ADC_CHANNEL_IN0
76
#define ADC_1 AD1_1
77
#define ADC_1_GPIO_PORT PAL_PORT(LINE_ADC1)
78
#define ADC_1_GPIO_PIN PAL_PAD(LINE_ADC1)
79
#endif
80
#endif
81
82
#if defined(LINE_ADC2)
83
#ifndef USE_ADC_2
84
#define USE_ADC_2 1
85
#endif
86
#if USE_ADC_2
87
#define AD1_2_CHANNEL ADC_CHANNEL_IN1
88
#define ADC_2 AD1_2
89
#define ADC_2_GPIO_PORT PAL_PORT(LINE_ADC2)
90
#define ADC_2_GPIO_PIN PAL_PAD(LINE_ADC2)
91
#endif
92
#endif
93
94
#if defined(LINE_ADC3)
95
#ifndef USE_ADC_3
96
#define USE_ADC_3 1
97
#endif
98
#if USE_ADC_3
99
#define AD1_3_CHANNEL ADC_CHANNEL_IN2
100
#define ADC_3 AD1_3
101
#define ADC_3_GPIO_PORT PAL_PORT(LINE_ADC3)
102
#define ADC_3_GPIO_PIN PAL_PAD(LINE_ADC3)
103
#endif
104
#endif
105
106
#if defined(LINE_ADC4)
107
#ifndef USE_ADC_4
108
#define USE_ADC_4 1
109
#endif
110
#if USE_ADC_4
111
#define AD1_4_CHANNEL ADC_CHANNEL_IN3
112
#define ADC_4 AD1_4
113
#define ADC_4_GPIO_PORT PAL_PORT(LINE_ADC4)
114
#define ADC_4_GPIO_PIN PAL_PAD(LINE_ADC4)
115
#endif
116
#endif
117
118
#if defined(LINE_ADC5)
119
#if USE_ADC_5
120
#define AD1_5_CHANNEL ADC_CHANNEL_IN4
121
#define ADC_5 AD1_5
122
#define ADC_5_GPIO_PORT PAL_PORT(LINE_ADC5)
123
#define ADC_5_GPIO_PIN PAL_PAD(LINE_ADC5)
124
#endif
125
#endif
126
127
#if defined(LINE_ADC6)
128
#if USE_ADC_6
129
#define AD1_6_CHANNEL ADC_CHANNEL_IN14
130
#define ADC_6 AD1_6
131
#define ADC_6_GPIO_PORT PAL_PORT(LINE_ADC6)
132
#define ADC_6_GPIO_PIN PAL_PAD(LINE_ADC6)
133
#endif
134
#endif
135
136
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
137
#ifndef ADC_CHANNEL_VSUPPLY
138
#define ADC_CHANNEL_VSUPPLY ADC_1
139
#endif
140
141
/* allow to define ADC_CHANNEL_CURRENT in the airframe file*/
142
#if !defined(ADC_CHANNEL_CURRENT) && !ADC_CURRENT_DISABLE
143
#define ADC_CHANNEL_CURRENT ADC_2
144
#endif
145
146
/* Default powerbrick values */
147
#define DefaultVoltageOfAdc(adc) ((3.3f/4096.0f) * 10.3208191126f * adc)
148
#define MilliAmpereOfAdc(adc) ((3.3f/4096.0f) * 24000.0f * adc)
149
150
/*
151
* PWM defines (TODO DRIVER and CHANNEL)
152
*/
153
#if defined(LINE_SERVO1)
154
#ifndef USE_PWM1
155
#define USE_PWM1 1
156
#endif
157
#if USE_PWM1
158
#define PWM_SERVO_1 0
159
#define PWM_SERVO_1_GPIO PAL_PORT(LINE_SERVO1)
160
#define PWM_SERVO_1_PIN PAL_PAD(LINE_SERVO1)
161
#define PWM_SERVO_1_AF AF_LINE_SERVO1
162
#define PWM_SERVO_1_DRIVER PWMD1
163
#define PWM_SERVO_1_CHANNEL 4-1
164
#define PWM_SERVO_1_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
165
#else
166
#define PWM_SERVO_1_ACTIVE PWM_OUTPUT_DISABLED
167
#endif
168
#endif
169
170
#if defined(LINE_SERVO2)
171
#ifndef USE_PWM2
172
#define USE_PWM2 1
173
#endif
174
#if USE_PWM2
175
#define PWM_SERVO_2 1
176
#define PWM_SERVO_2_GPIO PAL_PORT(LINE_SERVO2)
177
#define PWM_SERVO_2_PIN PAL_PAD(LINE_SERVO2)
178
#define PWM_SERVO_2_AF AF_LINE_SERVO2
179
#define PWM_SERVO_2_DRIVER PWMD1
180
#define PWM_SERVO_2_CHANNEL 3-1
181
#define PWM_SERVO_2_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
182
#else
183
#define PWM_SERVO_2_ACTIVE PWM_OUTPUT_DISABLED
184
#endif
185
#endif
186
187
#if defined(LINE_SERVO3)
188
#ifndef USE_PWM3
189
#define USE_PWM3 1
190
#endif
191
#if USE_PWM3
192
#define PWM_SERVO_3 2
193
#define PWM_SERVO_3_GPIO PAL_PORT(LINE_SERVO3)
194
#define PWM_SERVO_3_PIN PAL_PAD(LINE_SERVO3)
195
#define PWM_SERVO_3_AF AF_LINE_SERVO3
196
#define PWM_SERVO_3_DRIVER PWMD1
197
#define PWM_SERVO_3_CHANNEL 2-1
198
#define PWM_SERVO_3_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
199
#else
200
#define PWM_SERVO_3_ACTIVE PWM_OUTPUT_DISABLED
201
#endif
202
#endif
203
204
#if defined(LINE_SERVO4)
205
#ifndef USE_PWM4
206
#define USE_PWM4 1
207
#endif
208
#if USE_PWM4
209
#define PWM_SERVO_4 3
210
#define PWM_SERVO_4_GPIO PAL_PORT(LINE_SERVO4)
211
#define PWM_SERVO_4_PIN PAL_PAD(LINE_SERVO4)
212
#define PWM_SERVO_4_AF AF_LINE_SERVO4
213
#define PWM_SERVO_4_DRIVER PWMD1
214
#define PWM_SERVO_4_CHANNEL 1-1
215
#define PWM_SERVO_4_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
216
#else
217
#define PWM_SERVO_4_ACTIVE PWM_OUTPUT_DISABLED
218
#endif
219
#endif
220
221
#if defined(LINE_SERVO5)
222
#ifndef USE_PWM5
223
#define USE_PWM5 1
224
#endif
225
#if USE_PWM5
226
#define PWM_SERVO_5 4
227
#define PWM_SERVO_5_GPIO PAL_PORT(LINE_SERVO5)
228
#define PWM_SERVO_5_PIN PAL_PAD(LINE_SERVO5)
229
#define PWM_SERVO_5_AF AF_LINE_SERVO5
230
#define PWM_SERVO_5_DRIVER PWMD4
231
#define PWM_SERVO_5_CHANNEL 2-1
232
#define PWM_SERVO_5_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
233
#else
234
#define PWM_SERVO_5_ACTIVE PWM_OUTPUT_DISABLED
235
#endif
236
#endif
237
238
#if defined(LINE_SERVO6)
239
#ifndef USE_PWM6
240
#define USE_PWM6 1
241
#endif
242
#if USE_PWM6
243
#define PWM_SERVO_6 5
244
#define PWM_SERVO_6_GPIO PAL_PORT(LINE_SERVO6)
245
#define PWM_SERVO_6_PIN PAL_PAD(LINE_SERVO6)
246
#define PWM_SERVO_6_AF AF_LINE_SERVO6
247
#define PWM_SERVO_6_DRIVER PWMD4
248
#define PWM_SERVO_6_CHANNEL 3-1
249
#define PWM_SERVO_6_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
250
#else
251
#define PWM_SERVO_6_ACTIVE PWM_OUTPUT_DISABLED
252
#endif
253
#endif
254
255
#if defined(LINE_SERVO7)
256
#ifndef USE_PWM7
257
#define USE_PWM7 1
258
#endif
259
#if USE_PWM7
260
#define PWM_SERVO_7 6
261
#define PWM_SERVO_7_GPIO PAL_PORT(LINE_SERVO7)
262
#define PWM_SERVO_7_PIN PAL_PAD(LINE_SERVO7)
263
#define PWM_SERVO_7_AF AF_LINE_SERVO7
264
#define PWM_SERVO_7_DRIVER PWMD12
265
#define PWM_SERVO_7_CHANNEL 1-1
266
#define PWM_SERVO_7_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
267
#else
268
#define PWM_SERVO_7_ACTIVE PWM_OUTPUT_DISABLED
269
#endif
270
#endif
271
272
#if defined(LINE_SERVO8)
273
#ifndef USE_PWM8
274
#define USE_PWM8 1
275
#endif
276
#if USE_PWM8
277
#define PWM_SERVO_8 7
278
#define PWM_SERVO_8_GPIO PAL_PORT(LINE_SERVO8)
279
#define PWM_SERVO_8_PIN PAL_PAD(LINE_SERVO8)
280
#define PWM_SERVO_8_AF AF_LINE_SERVO8
281
#define PWM_SERVO_8_DRIVER PWMD12
282
#define PWM_SERVO_8_CHANNEL 2-1
283
#define PWM_SERVO_8_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
284
#else
285
#define PWM_SERVO_8_ACTIVE PWM_OUTPUT_DISABLED
286
#endif
287
#endif
288
289
290
#ifdef STM32_PWM_USE_TIM1
291
#define PWM_CONF_TIM1 STM32_PWM_USE_TIM1
292
#else
293
#define PWM_CONF_TIM1 1
294
#endif
295
#define PWM_CONF1_DEF { \
296
PWM_FREQUENCY, \
297
PWM_FREQUENCY/TIM1_SERVO_HZ, \
298
NULL, \
299
{ \
300
{ PWM_SERVO_4_ACTIVE, NULL }, \
301
{ PWM_SERVO_3_ACTIVE, NULL }, \
302
{ PWM_SERVO_2_ACTIVE, NULL }, \
303
{ PWM_SERVO_1_ACTIVE, NULL }, \
304
}, \
305
0, \
306
0 \
307
}
308
309
#ifdef STM32_PWM_USE_TIM4
310
#define PWM_CONF_TIM4 STM32_PWM_USE_TIM4
311
#else
312
#define PWM_CONF_TIM4 1
313
#endif
314
#define PWM_CONF4_DEF { \
315
PWM_FREQUENCY, \
316
PWM_FREQUENCY/TIM4_SERVO_HZ, \
317
NULL, \
318
{ \
319
{ PWM_OUTPUT_DISABLED, NULL }, \
320
{ PWM_SERVO_5_ACTIVE, NULL }, \
321
{ PWM_SERVO_6_ACTIVE, NULL }, \
322
{ PWM_OUTPUT_DISABLED, NULL }, \
323
}, \
324
0, \
325
0 \
326
}
327
328
#ifdef STM32_PWM_USE_TIM12
329
#define PWM_CONF_TIM12 STM32_PWM_USE_TIM12
330
#else
331
#define PWM_CONF_TIM12 1
332
#endif
333
#define PWM_CONF12_DEF { \
334
PWM_FREQUENCY, \
335
PWM_FREQUENCY/TIM12_SERVO_HZ, \
336
NULL, \
337
{ \
338
{ PWM_SERVO_7_ACTIVE, NULL }, \
339
{ PWM_SERVO_8_ACTIVE, NULL }, \
340
{ PWM_OUTPUT_DISABLED, NULL }, \
341
{ PWM_OUTPUT_DISABLED, NULL }, \
342
}, \
343
0, \
344
0 \
345
}
346
350
#define RC_PPM_TICKS_PER_USEC 2
351
#define PPM_TIMER_FREQUENCY 2000000
352
#define PPM_CHANNEL ICU_CHANNEL_1
353
#define PPM_TIMER ICUD8
354
358
#if defined(LINE_UART1_TX)
359
#define UART1_GPIO_PORT_TX PAL_PORT(LINE_UART1_TX)
360
#define UART1_GPIO_TX PAL_PAD(LINE_UART1_TX)
361
#endif
362
#if defined(LINE_UART1_RX)
363
#define UART1_GPIO_PORT_RX PAL_PORT(LINE_UART1_RX)
364
#define UART1_GPIO_RX PAL_PAD(LINE_UART1_RX)
365
#endif
366
#if defined(AF_LINE_UART1_TX)
367
#define UART1_GPIO_AF AF_LINE_UART1_TX
368
#elif defined(AF_LINE_UART1_RX)
369
#define UART1_GPIO_AF AF_LINE_UART1_RX
370
#else
371
#define UART1_GPIO_AF ((void)0)
372
#endif
373
374
#if defined(LINE_UART2_TX)
375
#define UART2_GPIO_PORT_TX PAL_PORT(LINE_UART2_TX)
376
#define UART2_GPIO_TX PAL_PAD(LINE_UART2_TX)
377
#endif
378
#if defined(LINE_UART2_RX)
379
#define UART2_GPIO_PORT_RX PAL_PORT(LINE_UART2_RX)
380
#define UART2_GPIO_RX PAL_PAD(LINE_UART2_RX)
381
#endif
382
#if defined(AF_LINE_UART2_TX)
383
#define UART2_GPIO_AF AF_LINE_UART2_TX
384
#elif defined(AF_LINE_UART2_RX)
385
#define UART2_GPIO_AF AF_LINE_UART2_RX
386
#else
387
#define UART2_GPIO_AF ((void)0)
388
#endif
389
390
#if defined(LINE_UART3_TX)
391
#define UART3_GPIO_PORT_TX PAL_PORT(LINE_UART3_TX)
392
#define UART3_GPIO_TX PAL_PAD(LINE_UART3_TX)
393
#endif
394
#if defined(LINE_UART3_RX)
395
#define UART3_GPIO_PORT_RX PAL_PORT(LINE_UART3_RX)
396
#define UART3_GPIO_RX PAL_PAD(LINE_UART3_RX)
397
#endif
398
#if defined(AF_LINE_UART3_TX)
399
#define UART3_GPIO_AF AF_LINE_UART3_TX
400
#elif defined(AF_LINE_UART3_RX)
401
#define UART3_GPIO_AF AF_LINE_UART3_RX
402
#else
403
#define UART3_GPIO_AF ((void)0)
404
#endif
405
406
#if defined(LINE_UART4_TX)
407
#define UART4_GPIO_PORT_TX PAL_PORT(LINE_UART4_TX)
408
#define UART4_GPIO_TX PAL_PAD(LINE_UART4_TX)
409
#endif
410
#if defined(LINE_UART4_RX)
411
#define UART4_GPIO_PORT_RX PAL_PORT(LINE_UART4_RX)
412
#define UART4_GPIO_RX PAL_PAD(LINE_UART4_RX)
413
#endif
414
#if defined(AF_LINE_UART4_TX)
415
#define UART4_GPIO_AF AF_LINE_UART4_TX
416
#elif defined(AF_LINE_UART4_RX)
417
#define UART4_GPIO_AF AF_LINE_UART4_RX
418
#else
419
#define UART4_GPIO_AF ((void)0)
420
#endif
421
422
#if defined(LINE_UART5_TX)
423
#define UART5_GPIO_PORT_TX PAL_PORT(LINE_UART5_TX)
424
#define UART5_GPIO_TX PAL_PAD(LINE_UART5_TX)
425
#endif
426
#if defined(LINE_UART5_RX)
427
#define UART5_GPIO_PORT_RX PAL_PORT(LINE_UART5_RX)
428
#define UART5_GPIO_RX PAL_PAD(LINE_UART5_RX)
429
#endif
430
#if defined(AF_LINE_UART5_TX)
431
#define UART5_GPIO_AF AF_LINE_UART5_TX
432
#elif defined(AF_LINE_UART5_RX)
433
#define UART5_GPIO_AF AF_LINE_UART5_RX
434
#else
435
#define UART5_GPIO_AF ((void)0)
436
#endif
437
438
#if defined(LINE_UART6_TX)
439
#define UART6_GPIO_PORT_TX PAL_PORT(LINE_UART6_TX)
440
#define UART6_GPIO_TX PAL_PAD(LINE_UART6_TX)
441
#endif
442
#if defined(LINE_UART6_RX)
443
#define UART6_GPIO_PORT_RX PAL_PORT(LINE_UART6_RX)
444
#define UART6_GPIO_RX PAL_PAD(LINE_UART6_RX)
445
#endif
446
#if defined(AF_LINE_UART6_TX)
447
#define UART6_GPIO_AF AF_LINE_UART6_TX
448
#elif defined(AF_LINE_UART6_RX)
449
#define UART6_GPIO_AF AF_LINE_UART6_RX
450
#else
451
#define UART6_GPIO_AF ((void)0)
452
#endif
453
454
#if defined(LINE_UART7_TX)
455
#define UART7_GPIO_PORT_TX PAL_PORT(LINE_UART7_TX)
456
#define UART7_GPIO_TX PAL_PAD(LINE_UART7_TX)
457
#endif
458
#if defined(LINE_UART7_RX)
459
#define UART7_GPIO_PORT_RX PAL_PORT(LINE_UART7_RX)
460
#define UART7_GPIO_RX PAL_PAD(LINE_UART7_RX)
461
#endif
462
#if defined(AF_LINE_UART7_TX)
463
#define UART7_GPIO_AF AF_LINE_UART7_TX
464
#elif defined(AF_LINE_UART7_RX)
465
#define UART7_GPIO_AF AF_LINE_UART7_RX
466
#else
467
#define UART7_GPIO_AF ((void)0)
468
#endif
469
470
#if defined(LINE_UART8_TX)
471
#define UART8_GPIO_PORT_TX PAL_PORT(LINE_UART8_TX)
472
#define UART8_GPIO_TX PAL_PAD(LINE_UART8_TX)
473
#endif
474
#if defined(LINE_UART8_RX)
475
#define UART8_GPIO_PORT_RX PAL_PORT(LINE_UART8_RX)
476
#define UART8_GPIO_RX PAL_PAD(LINE_UART8_RX)
477
#endif
478
#if defined(AF_LINE_UART8_TX)
479
#define UART8_GPIO_AF AF_LINE_UART8_TX
480
#elif defined(AF_LINE_UART8_RX)
481
#define UART8_GPIO_AF AF_LINE_UART8_RX
482
#else
483
#define UART8_GPIO_AF ((void)0)
484
#endif
485
492
// Digital noise filter: 0 disabled, [0x1 - 0xF] enable up to n t_I2CCLK
493
#define STM32_CR1_DNF(n) ((n & 0x0f) << 8)
494
// Timing register
495
#define I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(0U) | \
496
STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(0U) | \
497
STM32_TIMINGR_SCLH(34U) | STM32_TIMINGR_SCLL(86U))
498
#define I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(1U) | \
499
STM32_TIMINGR_SCLDEL(9U) | STM32_TIMINGR_SDADEL(0U) | \
500
STM32_TIMINGR_SCLH(105U) | STM32_TIMINGR_SCLL(153U))
501
502
503
#ifndef I2C1_CLOCK_SPEED
504
#define I2C1_CLOCK_SPEED 400000
505
#endif
506
507
#if I2C1_CLOCK_SPEED == 400000
508
#define I2C1_CFG_DEF { \
509
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
510
.cr1 = STM32_CR1_DNF(0), \
511
.cr2 = 0 \
512
}
513
#elif I2C1_CLOCK_SPEED == 100000
514
#define I2C1_CFG_DEF { \
515
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
516
.cr1 = STM32_CR1_DNF(0), \
517
.cr2 = 0 \
518
}
519
#else
520
#error "Unknown I2C1 clock speed"
521
#endif
522
523
524
#ifndef I2C2_CLOCK_SPEED
525
#define I2C2_CLOCK_SPEED 400000
526
#endif
527
528
#if I2C2_CLOCK_SPEED == 400000
529
#define I2C2_CFG_DEF { \
530
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
531
.cr1 = STM32_CR1_DNF(0), \
532
.cr2 = 0 \
533
}
534
#elif I2C2_CLOCK_SPEED == 100000
535
#define I2C2_CFG_DEF { \
536
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
537
.cr1 = STM32_CR1_DNF(0), \
538
.cr2 = 0 \
539
}
540
#else
541
#error "Unknown I2C2 clock speed"
542
#endif
543
544
#ifndef I2C3_CLOCK_SPEED
545
#define I2C3_CLOCK_SPEED 400000
546
#endif
547
548
#if I2C3_CLOCK_SPEED == 400000
549
#define I2C3_CFG_DEF { \
550
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
551
.cr1 = STM32_CR1_DNF(0), \
552
.cr2 = 0 \
553
}
554
#elif I2C3_CLOCK_SPEED == 100000
555
#define I2C3_CFG_DEF { \
556
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
557
.cr1 = STM32_CR1_DNF(0), \
558
.cr2 = 0 \
559
}
560
#else
561
#error "Unknown I2C3 clock speed"
562
#endif
563
564
#ifndef I2C4_CLOCK_SPEED
565
#define I2C4_CLOCK_SPEED 400000
566
#endif
567
568
#if I2C4_CLOCK_SPEED == 400000
569
#define I2C4_CFG_DEF { \
570
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
571
.cr1 = STM32_CR1_DNF(0), \
572
.cr2 = 0 \
573
}
574
#elif I2C4_CLOCK_SPEED == 100000
575
#define I2C4_CFG_DEF { \
576
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
577
.cr1 = STM32_CR1_DNF(0), \
578
.cr2 = 0 \
579
}
580
#else
581
#error "Unknown I2C4 clock speed"
582
#endif
583
587
#if defined(LINE_SPI1_MISO) && defined(LINE_SPI1_MOSI) && defined(LINE_SPI1_SCK)
588
#define SPI1_GPIO_PORT_MISO PAL_PORT(LINE_SPI1_MISO)
589
#define SPI1_GPIO_MISO PAL_PAD(LINE_SPI1_MISO)
590
#define SPI1_GPIO_PORT_MOSI PAL_PORT(LINE_SPI1_MOSI)
591
#define SPI1_GPIO_MOSI PAL_PAD(LINE_SPI1_MOSI)
592
#define SPI1_GPIO_PORT_SCK PAL_PORT(LINE_SPI1_SCK)
593
#define SPI1_GPIO_SCK PAL_PAD(LINE_SPI1_SCK)
594
595
#if defined(AF_LINE_SPI1_SCK)
596
#define SPI1_GPIO_AF AF_LINE_SPI1_SCK
597
#endif
598
#endif
599
600
#if defined(LINE_SPI2_MISO) && defined(LINE_SPI2_MOSI) && defined(LINE_SPI2_SCK)
601
#define SPI2_GPIO_PORT_MISO PAL_PORT(LINE_SPI2_MISO)
602
#define SPI2_GPIO_MISO PAL_PAD(LINE_SPI2_MISO)
603
#define SPI2_GPIO_PORT_MOSI PAL_PORT(LINE_SPI2_MOSI)
604
#define SPI2_GPIO_MOSI PAL_PAD(LINE_SPI2_MOSI)
605
#define SPI2_GPIO_PORT_SCK PAL_PORT(LINE_SPI2_SCK)
606
#define SPI2_GPIO_SCK PAL_PAD(LINE_SPI2_SCK)
607
608
#if defined(AF_LINE_SPI2_SCK)
609
#define SPI2_GPIO_AF AF_LINE_SPI2_SCK
610
#endif
611
#endif
612
613
#if defined(LINE_SPI3_MISO) && defined(LINE_SPI3_MOSI) && defined(LINE_SPI3_SCK)
614
#define SPI3_GPIO_PORT_MISO PAL_PORT(LINE_SPI3_MISO)
615
#define SPI3_GPIO_MISO PAL_PAD(LINE_SPI3_MISO)
616
#define SPI3_GPIO_PORT_MOSI PAL_PORT(LINE_SPI3_MOSI)
617
#define SPI3_GPIO_MOSI PAL_PAD(LINE_SPI3_MOSI)
618
#define SPI3_GPIO_PORT_SCK PAL_PORT(LINE_SPI3_SCK)
619
#define SPI3_GPIO_SCK PAL_PAD(LINE_SPI3_SCK)
620
621
#if defined(AF_LINE_SPI3_SCK)
622
#define SPI3_GPIO_AF AF_LINE_SPI3_SCK
623
#endif
624
#endif
625
626
#if defined(LINE_SPI4_MISO) && defined(LINE_SPI4_MOSI) && defined(LINE_SPI4_SCK)
627
#define SPI4_GPIO_PORT_MISO PAL_PORT(LINE_SPI4_MISO)
628
#define SPI4_GPIO_MISO PAL_PAD(LINE_SPI4_MISO)
629
#define SPI4_GPIO_PORT_MOSI PAL_PORT(LINE_SPI4_MOSI)
630
#define SPI4_GPIO_MOSI PAL_PAD(LINE_SPI4_MOSI)
631
#define SPI4_GPIO_PORT_SCK PAL_PORT(LINE_SPI4_SCK)
632
#define SPI4_GPIO_SCK PAL_PAD(LINE_SPI4_SCK)
633
634
#if defined(AF_LINE_SPI4_SCK)
635
#define SPI4_GPIO_AF AF_LINE_SPI4_SCK
636
#endif
637
#endif
638
639
#if defined(LINE_SPI5_MISO) && defined(LINE_SPI5_MOSI) && defined(LINE_SPI5_SCK)
640
#define SPI5_GPIO_PORT_MISO PAL_PORT(LINE_SPI5_MISO)
641
#define SPI5_GPIO_MISO PAL_PAD(LINE_SPI5_MISO)
642
#define SPI5_GPIO_PORT_MOSI PAL_PORT(LINE_SPI5_MOSI)
643
#define SPI5_GPIO_MOSI PAL_PAD(LINE_SPI5_MOSI)
644
#define SPI5_GPIO_PORT_SCK PAL_PORT(LINE_SPI5_SCK)
645
#define SPI5_GPIO_SCK PAL_PAD(LINE_SPI5_SCK)
646
647
#if defined(AF_LINE_SPI5_SCK)
648
#define SPI5_GPIO_AF AF_LINE_SPI5_SCK
649
#endif
650
#endif
651
652
#if defined(LINE_SPI6_MISO) && defined(LINE_SPI6_MOSI) && defined(LINE_SPI6_SCK)
653
#define SPI6_GPIO_PORT_MISO PAL_PORT(LINE_SPI6_MISO)
654
#define SPI6_GPIO_MISO PAL_PAD(LINE_SPI6_MISO)
655
#define SPI6_GPIO_PORT_MOSI PAL_PORT(LINE_SPI6_MOSI)
656
#define SPI6_GPIO_MOSI PAL_PAD(LINE_SPI6_MOSI)
657
#define SPI6_GPIO_PORT_SCK PAL_PORT(LINE_SPI6_SCK)
658
#define SPI6_GPIO_SCK PAL_PAD(LINE_SPI6_SCK)
659
660
#if defined(AF_LINE_SPI6_SCK)
661
#define SPI6_GPIO_AF AF_LINE_SPI6_SCK
662
#endif
663
#endif
664
668
#if defined(LINE_SPI_SLAVE0)
669
#define SPI_SELECT_SLAVE0_PORT PAL_PORT(LINE_SPI_SLAVE0)
670
#define SPI_SELECT_SLAVE0_PIN PAL_PAD(LINE_SPI_SLAVE0)
671
#endif
672
673
#if defined(LINE_SPI_SLAVE1)
674
#define SPI_SELECT_SLAVE1_PORT PAL_PORT(LINE_SPI_SLAVE1)
675
#define SPI_SELECT_SLAVE1_PIN PAL_PAD(LINE_SPI_SLAVE1)
676
#endif
677
678
#if defined(LINE_SPI_SLAVE2)
679
#define SPI_SELECT_SLAVE2_PORT PAL_PORT(LINE_SPI_SLAVE2)
680
#define SPI_SELECT_SLAVE2_PIN PAL_PAD(LINE_SPI_SLAVE2)
681
#endif
682
683
#if defined(LINE_SPI_SLAVE3)
684
#define SPI_SELECT_SLAVE3_PORT PAL_PORT(LINE_SPI_SLAVE3)
685
#define SPI_SELECT_SLAVE3_PIN PAL_PAD(LINE_SPI_SLAVE3)
686
#endif
687
688
#if defined(LINE_SPI_SLAVE4)
689
#define SPI_SELECT_SLAVE4_PORT PAL_PORT(LINE_SPI_SLAVE4)
690
#define SPI_SELECT_SLAVE4_PIN PAL_PAD(LINE_SPI_SLAVE4)
691
#endif
692
693
#if defined(LINE_SPI_SLAVE5)
694
#define SPI_SELECT_SLAVE5_PORT PAL_PORT(LINE_SPI_SLAVE5)
695
#define SPI_SELECT_SLAVE5_PIN PAL_PAD(LINE_SPI_SLAVE5)
696
#endif
697
698
#if defined(LINE_SPI_SLAVE6)
699
#define SPI_SELECT_SLAVE6_PORT PAL_PORT(LINE_SPI_SLAVE6)
700
#define SPI_SELECT_SLAVE6_PIN PAL_PAD(LINE_SPI_SLAVE6)
701
#endif
702
709
#ifndef USE_BARO_BOARD
710
#define USE_BARO_BOARD 1
711
#endif
712
716
#if defined(LINE_SDIO_D0) && defined(LINE_SDIO_D1) && defined(LINE_SDIO_D2) && defined(LINE_SDIO_D3) && defined(LINE_SDIO_CK) && defined(LINE_SDIO_CMD)
717
#define SDIO_D0_PORT PAL_PORT(LINE_SDIO_D0)
718
#define SDIO_D0_PIN PAL_PAD(LINE_SDIO_D0)
719
#define SDIO_D1_PORT PAL_PORT(LINE_SDIO_D1)
720
#define SDIO_D1_PIN PAL_PAD(LINE_SDIO_D1)
721
#define SDIO_D2_PORT PAL_PORT(LINE_SDIO_D2)
722
#define SDIO_D2_PIN PAL_PAD(LINE_SDIO_D2)
723
#define SDIO_D3_PORT PAL_PORT(LINE_SDIO_D3)
724
#define SDIO_D3_PIN PAL_PAD(LINE_SDIO_D3)
725
#define SDIO_CK_PORT PAL_PORT(LINE_SDIO_CK)
726
#define SDIO_CK_PIN PAL_PAD(LINE_SDIO_CK)
727
#define SDIO_CMD_PORT PAL_PORT(LINE_SDIO_CMD)
728
#define SDIO_CMD_PIN PAL_PAD(LINE_SDIO_CMD)
729
730
#if defined(AF_LINE_SDIO_CMD)
731
#define SDIO_AF AF_LINE_SDIO_CMD
732
#else
733
#define SDIO_AF ((void)0)
734
#endif
735
#endif
736
737
#if defined(LINE_USB_VBUS)
738
#define SDLOG_USB_VBUS_PORT PAL_PORT(LINE_USB_VBUS)
739
#define SDLOG_USB_VBUS_PIN PAL_PAD(LINE_USB_VBUS)
740
#endif
741
742
// bat monitoring for file closing
743
#define SDLOG_BAT_ADC ADCD1
744
#define SDLOG_BAT_CHAN AD1_1_CHANNEL
745
// usb led status
746
#define SDLOG_USB_LED 3
747
748
749
/*
750
* Actuators for fixedwing
751
*/
752
/* Default actuators driver */
753
#define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
754
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
755
#define ActuatorsDefaultInit() ActuatorsPwmInit()
756
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
757
758
#endif
/* CONFIG_PX4FMU_4_00_H */
759
board.h
sw
airborne
boards
px4fmu
chibios
v5.0
px4fmu.h
Generated on Tue Feb 1 2022 13:08:43 for Paparazzi UAS by
1.8.17