Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
tawaki.h
Go to the documentation of this file.
1
#ifndef CONFIG_TAWAKI_1_00_H
2
#define CONFIG_TAWAKI_1_00_H
3
4
#define BOARD_TAWAKI
5
9
#include "board.h"
10
15
/*
16
* AHB_CLK
17
*/
18
#define AHB_CLK STM32_HCLK
19
20
/*
21
* Concat macro
22
*/
23
#define _CONCAT_BOARD_PARAM(_s1, _s2) _s1 ## _s2
24
#define CONCAT_BOARD_PARAM(_s1, _s2) _CONCAT_BOARD_PARAM(_s1, _s2)
25
26
/*
27
* LEDs
28
*/
29
/* red, on PD15, 1 on LED_ON, 0 on LED_OFF */
30
#ifndef USE_LED_1
31
#define USE_LED_1 1
32
#endif
33
#define LED_1_GPIO PAL_PORT(LINE_LED1)
34
#define LED_1_GPIO_PIN PAL_PAD(LINE_LED1)
35
#define LED_1_GPIO_ON gpio_set
36
#define LED_1_GPIO_OFF gpio_clear
37
38
/* orange, on PA10, 1 on LED_ON, 0 on LED_OFF */
39
#ifndef USE_LED_2
40
#define USE_LED_2 1
41
#endif
42
#define LED_2_GPIO PAL_PORT(LINE_LED2)
43
#define LED_2_GPIO_PIN PAL_PAD(LINE_LED2)
44
#define LED_2_GPIO_ON gpio_set
45
#define LED_2_GPIO_OFF gpio_clear
46
47
/* green, on PC7, 1 on LED_ON, 0 on LED_OFF */
48
#ifndef USE_LED_3
49
#define USE_LED_3 1
50
#endif
51
#define LED_3_GPIO PAL_PORT(LINE_LED3)
52
#define LED_3_GPIO_PIN PAL_PAD(LINE_LED3)
53
#define LED_3_GPIO_ON gpio_set
54
#define LED_3_GPIO_OFF gpio_clear
55
56
/* yellow, on PD10, 1 on LED_ON, 0 on LED_OFF */
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_set
63
#define LED_4_GPIO_OFF gpio_clear
64
65
/*
66
* ADCs
67
*/
68
// AUXa1
69
#if USE_ADC_1
70
#define AD1_1_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_A1_ADC_IN)
71
#define ADC_1 AD1_1
72
#define ADC_1_GPIO_PORT PAL_PORT(LINE_AUX_A1)
73
#define ADC_1_GPIO_PIN PAL_PAD(LINE_AUX_A1)
74
#endif
75
76
// AUXa2
77
#if USE_ADC_2
78
#define AD1_2_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_A2_ADC_IN)
79
#define ADC_2 AD1_2
80
#define ADC_2_GPIO_PORT PAL_PORT(LINE_AUX_A2)
81
#define ADC_2_GPIO_PIN PAL_PAD(LINE_AUX_A2)
82
#endif
83
84
// AUXa3
85
#if USE_ADC_3
86
#define AD1_3_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_A3_ADC_IN)
87
#define ADC_3 AD1_3
88
#define ADC_3_GPIO_PORT PAL_PORT(LINE_AUX_A3)
89
#define ADC_3_GPIO_PIN PAL_PAD(LINE_AUX_A3)
90
#endif
91
92
// AUXa4
93
#if USE_ADC_4
94
#define AD1_4_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_A4_ADC_IN)
95
#define ADC_4 AD1_4
96
#define ADC_4_GPIO_PORT PAL_PORT(LINE_AUX_A4)
97
#define ADC_4_GPIO_PIN PAL_PAD(LINE_AUX_A4)
98
#endif
99
100
// AUXb1
101
#if USE_ADC_5
102
#define AD1_5_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_B1_ADC_IN)
103
#define ADC_5 AD1_5
104
#define ADC_5_GPIO_PORT PAL_PORT(LINE_AUX_B1)
105
#define ADC_5_GPIO_PIN PAL_PAD(LINE_AUX_B1)
106
#endif
107
108
// AUXb2
109
#if USE_ADC_6
110
#define AD1_6_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_B2_ADC_IN)
111
#define ADC_6 AD1_6
112
#define ADC_6_GPIO_PORT PAL_PORT(LINE_AUX_B2)
113
#define ADC_6_GPIO_PIN PAL_PAD(LINE_AUX_B2)
114
#endif
115
116
// AUXb3
117
#if USE_ADC_7
118
#define AD1_7_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_B3_ADC_IN)
119
#define ADC_7 AD1_7
120
#define ADC_7_GPIO_PORT PAL_PORT(LINE_AUX_B3)
121
#define ADC_7_GPIO_PIN PAL_PAD(LINE_AUX_B3)
122
#endif
123
124
// AUXb4
125
#if USE_ADC_8
126
#define AD1_8_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_B4_ADC_IN)
127
#define ADC_8 AD1_8
128
#define ADC_8_GPIO_PORT PAL_PORT(LINE_AUX_B4)
129
#define ADC_8_GPIO_PIN PAL_PAD(LINE_AUX_B4)
130
#endif
131
132
// Internal ADC for battery enabled by default
133
#ifndef USE_ADC_9
134
#define USE_ADC_9 1
135
#endif
136
#if USE_ADC_9
137
#define AD1_9_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, VBAT_MEAS_ADC_IN)
138
#define ADC_9 AD1_9
139
#define ADC_9_GPIO_PORT PAL_PORT(LINE_VBAT_MEAS)
140
#define ADC_9_GPIO_PIN PAL_PAD(LINE_VBAT_MEAS)
141
#endif
142
143
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
144
#ifndef ADC_CHANNEL_VSUPPLY
145
#define ADC_CHANNEL_VSUPPLY ADC_9
146
#endif
147
148
/*
149
* R1 = 2.2k
150
* R2 = 12k
151
* adc * (3.3 / 2^12) * ((R1 + R2) / R1)
152
*/
153
#define VBAT_R1 2200.0f
154
#define VBAT_R2 12000.0f
155
#define DefaultVoltageOfAdc(adc) ((3.3f/4096.0f)*((VBAT_R1+VBAT_R2)/VBAT_R1)*adc)
156
157
/*
158
* PWM defines
159
*/
160
161
/*
162
* enable TIM1 by default
163
*/
164
#ifndef USE_PWM_TIM1
165
#define USE_PWM_TIM1 1
166
#endif
167
168
// SRVa connectors, activated in PWM mode by default
169
170
#ifndef USE_PWM1
171
#define USE_PWM1 1
172
#endif
173
#if USE_PWM1
174
#define PWM_SERVO_1 1
175
#define PWM_SERVO_1_GPIO PAL_PORT(LINE_SRVA1)
176
#define PWM_SERVO_1_PIN PAL_PAD(LINE_SRVA1)
177
#define PWM_SERVO_1_AF AF_SRVA1
178
#define PWM_SERVO_1_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA1_TIM)
179
#define PWM_SERVO_1_CHANNEL (SRVA1_TIM_CH-1)
180
#define PWM_SERVO_1_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVA1_TIM)
181
#endif
182
183
#ifndef USE_PWM2
184
#define USE_PWM2 1
185
#endif
186
#if USE_PWM2
187
#define PWM_SERVO_2 2
188
#define PWM_SERVO_2_GPIO PAL_PORT(LINE_SRVA2)
189
#define PWM_SERVO_2_PIN PAL_PAD(LINE_SRVA2)
190
#define PWM_SERVO_2_AF AF_SRVA2
191
#define PWM_SERVO_2_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA2_TIM)
192
#define PWM_SERVO_2_CHANNEL (SRVA2_TIM_CH-1)
193
#define PWM_SERVO_2_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVA2_TIM)
194
#endif
195
196
#ifndef USE_PWM3
197
#define USE_PWM3 1
198
#endif
199
#if USE_PWM3
200
#define PWM_SERVO_3 3
201
#define PWM_SERVO_3_GPIO PAL_PORT(LINE_SRVA3)
202
#define PWM_SERVO_3_PIN PAL_PAD(LINE_SRVA3)
203
#define PWM_SERVO_3_AF AF_SRVA3
204
#define PWM_SERVO_3_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA3_TIM)
205
#define PWM_SERVO_3_CHANNEL (SRVA3_TIM_CH-1)
206
#define PWM_SERVO_3_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVA3_TIM)
207
#endif
208
209
#ifndef USE_PWM4
210
#define USE_PWM4 1
211
#endif
212
#if USE_PWM4
213
#define PWM_SERVO_4 4
214
#define PWM_SERVO_4_GPIO PAL_PORT(LINE_SRVA4)
215
#define PWM_SERVO_4_PIN PAL_PAD(LINE_SRVA4)
216
#define PWM_SERVO_4_AF AF_SRVA4
217
#define PWM_SERVO_4_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA4_TIM)
218
#define PWM_SERVO_4_CHANNEL (SRVA4_TIM_CH-1)
219
#define PWM_SERVO_4_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVA4_TIM)
220
#endif
221
222
// SRVb connector, PWM mode disabled by default (DShot is enabled by default)
223
224
#ifndef USE_PWM5
225
#define USE_PWM5 0
226
#endif
227
#if USE_PWM5
228
#define PWM_SERVO_5 5
229
#define PWM_SERVO_5_GPIO PAL_PORT(LINE_SRVB1)
230
#define PWM_SERVO_5_PIN PAL_PAD(LINE_SRVB1)
231
#define PWM_SERVO_5_AF AF_SRVB1
232
#define PWM_SERVO_5_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB1_TIM)
233
#define PWM_SERVO_5_CHANNEL (SRVB1_TIM_CH-1)
234
#define PWM_SERVO_5_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVB1_TIM)
235
#endif
236
237
#ifndef USE_PWM6
238
#define USE_PWM6 0
239
#endif
240
#if USE_PWM6
241
#define PWM_SERVO_6 6
242
#define PWM_SERVO_6_GPIO PAL_PORT(LINE_SRVB2)
243
#define PWM_SERVO_6_PIN PAL_PAD(LINE_SRVB2)
244
#define PWM_SERVO_6_AF AF_SRVB2
245
#define PWM_SERVO_6_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB2_TIM)
246
#define PWM_SERVO_6_CHANNEL (SRVB2_TIM_CH-1)
247
#define PWM_SERVO_6_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVB2_TIM)
248
#endif
249
250
#ifndef USE_PWM7
251
#define USE_PWM7 0
252
#endif
253
#if USE_PWM7
254
#define PWM_SERVO_7 7
255
#define PWM_SERVO_7_GPIO PAL_PORT(LINE_SRVB3)
256
#define PWM_SERVO_7_PIN PAL_PAD(LINE_SRVB3)
257
#define PWM_SERVO_7_AF AF_SRVB3
258
#define PWM_SERVO_7_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB3_TIM)
259
#define PWM_SERVO_7_CHANNEL (SRVB3_TIM_CH-1)
260
#define PWM_SERVO_7_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVB3_TIM)
261
#endif
262
263
#ifndef USE_PWM8
264
#define USE_PWM8 0
265
#endif
266
#if USE_PWM8
267
#define PWM_SERVO_8 8
268
#define PWM_SERVO_8_GPIO PAL_PORT(LINE_SRVB4)
269
#define PWM_SERVO_8_PIN PAL_PAD(LINE_SRVB4)
270
#define PWM_SERVO_8_AF AF_SRVB4
271
#define PWM_SERVO_8_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB4_TIM)
272
#define PWM_SERVO_8_CHANNEL (SRVB4_TIM_CH-1)
273
#define PWM_SERVO_8_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVB4_TIM)
274
#endif
275
276
#ifndef USE_PWM9
277
#define USE_PWM9 0
278
#endif
279
#if USE_PWM9
280
#define PWM_SERVO_9 9
281
#define PWM_SERVO_9_GPIO PAL_PORT(LINE_AUX_A1)
282
#define PWM_SERVO_9_PIN PAL_PAD(LINE_AUX_A1)
283
#define PWM_SERVO_9_AF GPIO_AF2
284
#define PWM_SERVO_9_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A1_TIM)
285
#define PWM_SERVO_9_CHANNEL (AUX_A1_TIM_CH-1)
286
#define PWM_SERVO_9_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_A1_TIM)
287
#endif
288
289
#ifndef USE_PWM10
290
#define USE_PWM10 0
291
#endif
292
#if USE_PWM10
293
#define PWM_SERVO_10 10
294
#define PWM_SERVO_10_GPIO PAL_PORT(LINE_AUX_A2)
295
#define PWM_SERVO_10_PIN PAL_PAD(LINE_AUX_A2)
296
#define PWM_SERVO_10_AF GPIO_AF2
297
#define PWM_SERVO_10_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A2_TIM)
298
#define PWM_SERVO_10_CHANNEL (AUX_A2_TIM_CH-1)
299
#define PWM_SERVO_10_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_A2_TIM)
300
#endif
301
302
#ifndef USE_PWM11
303
#define USE_PWM11 0
304
#endif
305
#if USE_PWM11
306
#define PWM_SERVO_11 11
307
#define PWM_SERVO_11_GPIO PAL_PORT(LINE_AUX_A3)
308
#define PWM_SERVO_11_PIN PAL_PAD(LINE_AUX_A3)
309
#define PWM_SERVO_11_AF GPIO_AF2
310
#define PWM_SERVO_11_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A3_TIM)
311
#define PWM_SERVO_11_CHANNEL (AUX_A3_TIM_CH-1)
312
#define PWM_SERVO_11_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_A3_TIM)
313
#endif
314
315
#ifndef USE_PWM12
316
#define USE_PWM12 0
317
#endif
318
#if USE_PWM12
319
#define PWM_SERVO_12 12
320
#define PWM_SERVO_12_GPIO PAL_PORT(LINE_AUX_A4)
321
#define PWM_SERVO_12_PIN PAL_PAD(LINE_AUX_A4)
322
#define PWM_SERVO_12_AF GPIO_AF2
323
#define PWM_SERVO_12_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A4_TIM)
324
#define PWM_SERVO_12_CHANNEL (AUX_A4_TIM_CH-1)
325
#define PWM_SERVO_12_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_A4_TIM)
326
#endif
327
328
#ifndef USE_PWM13
329
#define USE_PWM13 0
330
#endif
331
#if USE_PWM13
332
#define PWM_SERVO_13 13
333
#define PWM_SERVO_13_GPIO PAL_PORT(LINE_AUX_B1)
334
#define PWM_SERVO_13_PIN PAL_PAD(LINE_AUX_B1)
335
#define PWM_SERVO_13_AF GPIO_AF2
336
#define PWM_SERVO_13_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B1_TIM)
337
#define PWM_SERVO_13_CHANNEL (AUX_B1_TIM_CH-1)
338
#define PWM_SERVO_13_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_B1_TIM)
339
#endif
340
341
#ifndef USE_PWM14
342
#define USE_PWM14 0
343
#endif
344
#if USE_PWM14
345
#define PWM_SERVO_14 14
346
#define PWM_SERVO_14_GPIO PAL_PORT(LINE_AUX_B2)
347
#define PWM_SERVO_14_PIN PAL_PAD(LINE_AUX_B2)
348
#define PWM_SERVO_14_AF GPIO_AF2
349
#define PWM_SERVO_14_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B2_TIM)
350
#define PWM_SERVO_14_CHANNEL (AUX_B2_TIM_CH-1)
351
#define PWM_SERVO_14_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_B2_TIM)
352
#endif
353
354
#ifndef USE_PWM15
355
#define USE_PWM15 0
356
#endif
357
#if USE_PWM15
358
#define PWM_SERVO_15 15
359
#define PWM_SERVO_15_GPIO PAL_PORT(LINE_AUX_B3)
360
#define PWM_SERVO_15_PIN PAL_PAD(LINE_AUX_B3)
361
#define PWM_SERVO_15_AF GPIO_AF2
362
#define PWM_SERVO_15_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B3_TIM)
363
#define PWM_SERVO_15_CHANNEL (AUX_B3_TIM_CH-1)
364
#define PWM_SERVO_15_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_B3_TIM)
365
#endif
366
367
#ifndef USE_PWM16
368
#define USE_PWM16 0
369
#endif
370
#if USE_PWM16
371
#define PWM_SERVO_16 16
372
#define PWM_SERVO_16_GPIO PAL_PORT(LINE_AUX_B4)
373
#define PWM_SERVO_16_PIN PAL_PAD(LINE_AUX_B4)
374
#define PWM_SERVO_16_AF GPIO_AF2
375
#define PWM_SERVO_16_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B4_TIM)
376
#define PWM_SERVO_16_CHANNEL (AUX_B4_TIM_CH-1)
377
#define PWM_SERVO_16_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_B4_TIM)
378
#endif
379
380
// servo index starting at 1 + regular servos + aux servos
381
// so NB = 1+8+8
382
#define ACTUATORS_PWM_NB 17
383
384
388
#ifdef DSHOT_TIM4_TELEMETRY_NUM
389
#define DSHOT_TIM4_TELEMETRY_DEV CONCAT_BOARD_PARAM(&SD, DSHOT_TIM4_TELEMETRY_NUM)
390
#else
391
#define DSHOT_TIM4_TELEMETRY_DEV NULL
392
#endif
393
394
#ifdef DSHOT_TIM1_TELEMETRY_NUM
395
#define DSHOT_TIM1_TELEMETRY_DEV CONCAT_BOARD_PARAM(&SD, DSHOT_TIM1_TELEMETRY_NUM)
396
#else
397
#define DSHOT_TIM1_TELEMETRY_DEV NULL
398
#endif
399
400
// macros for possible dshot telemetry
401
#define DSHOT_TLM_RX 5
402
#define DSHOT_TLM_AUX_RX 4
403
404
#ifndef USE_DSHOT_TIM4
405
#define USE_DSHOT_TIM4 1
// use SRVb for DShot by default
406
#endif
407
408
#if USE_DSHOT_TIM4
// Servo B1, B2, B3, B4 on TIM4
409
410
// Servo B1, B2, B3, B4 on TM4 are primary DSHOT connector
411
#define DSHOT_SERVO_1 1
412
#define DSHOT_SERVO_1_GPIO PAL_PORT(LINE_SRVB1)
413
#define DSHOT_SERVO_1_PIN PAL_PAD(LINE_SRVB1)
414
#define DSHOT_SERVO_1_AF AF_SRVB1
415
#define DSHOT_SERVO_1_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB1_TIM)
416
#define DSHOT_SERVO_1_CHANNEL SRVB1_TIM_CH
417
418
#define DSHOT_SERVO_2 2
419
#define DSHOT_SERVO_2_GPIO PAL_PORT(LINE_SRVB2)
420
#define DSHOT_SERVO_2_PIN PAL_PAD(LINE_SRVB2)
421
#define DSHOT_SERVO_2_AF AF_SRVB2
422
#define DSHOT_SERVO_2_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB2_TIM)
423
#define DSHOT_SERVO_2_CHANNEL SRVB2_TIM_CH
424
425
#define DSHOT_SERVO_3 3
426
#define DSHOT_SERVO_3_GPIO PAL_PORT(LINE_SRVB3)
427
#define DSHOT_SERVO_3_PIN PAL_PAD(LINE_SRVB3)
428
#define DSHOT_SERVO_3_AF AF_SRVB3
429
#define DSHOT_SERVO_3_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB3_TIM)
430
#define DSHOT_SERVO_3_CHANNEL SRVB3_TIM_CH
431
432
#define DSHOT_SERVO_4 4
433
#define DSHOT_SERVO_4_GPIO PAL_PORT(LINE_SRVB4)
434
#define DSHOT_SERVO_4_PIN PAL_PAD(LINE_SRVB4)
435
#define DSHOT_SERVO_4_AF AF_SRVB4
436
#define DSHOT_SERVO_4_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB4_TIM)
437
#define DSHOT_SERVO_4_CHANNEL SRVB4_TIM_CH
438
439
#define DSHOT_CONF_TIM4 1
440
#define DSHOT_CONF4_DEF { \
441
.dma_stream = STM32_PWM4_UP_DMA_STREAM, \
442
.dma_channel = STM32_PWM4_UP_DMA_CHANNEL, \
443
.pwmp = &PWMD4, \
444
.tlm_sd = DSHOT_TIM4_TELEMETRY_DEV, \
445
.dma_buf = &dshot4DmaBuffer, \
446
.dcache_memory_in_use = false \
447
}
448
449
#endif
450
451
#if USE_DSHOT_TIM1
// Servo A1, A2, A3, A4 on TIM1 only activated if needed
452
453
#define DSHOT_SERVO_5 5
454
#define DSHOT_SERVO_5_GPIO PAL_PORT(LINE_SRVA1)
455
#define DSHOT_SERVO_5_PIN PAL_PAD(LINE_SRVA1)
456
#define DSHOT_SERVO_5_AF AF_SRVA1
457
#define DSHOT_SERVO_5_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA1_TIM)
458
#define DSHOT_SERVO_5_CHANNEL SRVA1_TIM_CH
459
460
#define DSHOT_SERVO_6 6
461
#define DSHOT_SERVO_6_GPIO PAL_PORT(LINE_SRVA2)
462
#define DSHOT_SERVO_6_PIN PAL_PAD(LINE_SRVA2)
463
#define DSHOT_SERVO_6_AF AF_SRVA2
464
#define DSHOT_SERVO_6_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA2_TIM)
465
#define DSHOT_SERVO_6_CHANNEL SRVA2_TIM_CH
466
467
#define DSHOT_SERVO_7 7
468
#define DSHOT_SERVO_7_GPIO PAL_PORT(LINE_SRVA3)
469
#define DSHOT_SERVO_7_PIN PAL_PAD(LINE_SRVA3)
470
#define DSHOT_SERVO_7_AF AF_SRVA3
471
#define DSHOT_SERVO_7_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA3_TIM)
472
#define DSHOT_SERVO_7_CHANNEL SRVA3_TIM_CH
473
474
#define DSHOT_SERVO_8 8
475
#define DSHOT_SERVO_8_GPIO PAL_PORT(LINE_SRVA4)
476
#define DSHOT_SERVO_8_PIN PAL_PAD(LINE_SRVA4)
477
#define DSHOT_SERVO_8_AF AF_SRVA4
478
#define DSHOT_SERVO_8_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA4_TIM)
479
#define DSHOT_SERVO_8_CHANNEL SRVA4_TIM_CH
480
481
#define DSHOT_CONF_TIM1 1
482
#define DSHOT_CONF1_DEF { \
483
.dma_stream = STM32_PWM1_UP_DMA_STREAM, \
484
.dma_channel = STM32_PWM1_UP_DMA_CHANNEL, \
485
.pwmp = &PWMD1, \
486
.tlm_sd = DSHOT_TIM1_TELEMETRY_DEV, \
487
.dma_buf = &dshot1DmaBuffer, \
488
.dcache_memory_in_use = false \
489
}
490
491
#endif
492
496
#define UART2_GPIO_PORT_TX PAL_PORT(LINE_UART2_TX)
497
#define UART2_GPIO_TX PAL_PAD(LINE_UART2_TX)
498
#define UART2_GPIO_PORT_RX PAL_PORT(LINE_UART2_RX)
499
#define UART2_GPIO_RX PAL_PAD(LINE_UART2_RX)
500
#define UART2_GPIO_AF AF_UART2_TX
501
#ifndef UART2_HW_FLOW_CONTROL
502
#define UART2_HW_FLOW_CONTROL FALSE
503
#endif
504
510
#define UART3_GPIO_PORT_TX PAL_PORT(LINE_UART3_TX)
511
#define UART3_GPIO_TX PAL_PAD(LINE_UART3_TX)
512
#define UART3_GPIO_PORT_RX PAL_PORT(LINE_UART3_RX)
513
#define UART3_GPIO_RX PAL_PAD(LINE_UART3_RX)
514
#define UART3_GPIO_AF AF_UART3_TX
515
516
#define UART7_GPIO_PORT_TX PAL_PORT(LINE_UART7_TX)
517
#define UART7_GPIO_TX PAL_PAD(LINE_UART7_TX)
518
#define UART7_GPIO_PORT_RX PAL_PORT(LINE_UART7_RX)
519
#define UART7_GPIO_RX PAL_PAD(LINE_UART7_RX)
520
#define UART7_GPIO_AF AF_UART7_TX
521
526
#define UART4_GPIO_PORT_TX PAL_PORT(LINE_AUX_A1)
527
#define UART4_GPIO_TX PAL_PAD(LINE_AUX_A1)
528
#define UART4_GPIO_PORT_RX PAL_PORT(LINE_AUX_A2)
529
#define UART4_GPIO_RX PAL_PAD(LINE_AUX_A2)
530
#define UART4_GPIO_AF AUX_A1_UART_AF
531
536
#define UART5_GPIO_PORT_RX PAL_PORT(LINE_DSHOT_RX)
537
#define UART5_GPIO_RX PAL_PAD(LINE_DSHOT_RX)
538
#define UART5_GPIO_AF AF_DSHOT_RX
539
552
// In case, do dynamic config of UARTs
553
#ifndef USE_UART8_RX
554
#define USE_UART8_RX TRUE
555
#endif
556
#ifndef USE_UART8_TX
// may be used in half duplex mode
557
#define USE_UART8_TX FALSE
558
#endif
559
// Tx and Rx are configured on the same pin, only one of them should be used
560
#define UART8_GPIO_PORT_TX PAL_PORT(LINE_RC1)
561
#define UART8_GPIO_TX PAL_PAD(LINE_RC1)
562
#define UART8_GPIO_PORT_RX PAL_PORT(LINE_RC1)
563
#define UART8_GPIO_RX PAL_PAD(LINE_RC1)
564
#define UART8_GPIO_AF RC1_UART_AF
565
566
#ifndef USE_UART6_RX
567
#define USE_UART6_RX FALSE
568
#endif
569
#ifndef USE_UART6_TX
570
#define USE_UART6_TX TRUE
571
#endif
572
// Tx and Rx are configured on the same pin, only one of them should be used
573
#define UART6_GPIO_PORT_TX PAL_PORT(LINE_RC2)
574
#define UART6_GPIO_TX PAL_PAD(LINE_RC2)
575
#define UART6_GPIO_PORT_RX PAL_PORT(LINE_RC2)
576
#define UART6_GPIO_RX PAL_PAD(LINE_RC2)
577
#define UART6_GPIO_AF RC2_USART_AF
578
579
/* The line that is pulled low at power up to initiate the bind process
580
* PB1: AUXb4
581
*/
582
#define SPEKTRUM_BIND_PIN PAL_PORT(LINE_AUX_B4)
583
#define SPEKTRUM_BIND_PIN_PORT PAL_PAD(LINE_AUX_B4)
584
585
// no wait with chibios as the RTC oscillator takes longer to stabilize
586
#define SPEKTRUM_BIND_WAIT 30000
587
593
#define RC_PPM_TICKS_PER_USEC 6
594
#define PPM_TIMER_FREQUENCY 6000000
595
#define PPM_CHANNEL CONCAT_BOARD_PARAM(ICU_CHANNEL_, RC2_TIM_CH)
596
#define PPM_TIMER CONCAT_BOARD_PARAM(ICUD, RC2_TIM)
597
598
/*
599
* PWM input
600
*/
601
// PWM_INPUT 1 on PA0 (AUXa1)
602
#define PWM_INPUT1_ICU ICUD2
603
#define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
604
#define PWM_INPUT1_GPIO_PORT PAL_PORT(LINE_AUX_A1)
605
#define PWM_INPUT1_GPIO_PIN PAL_PAD(LINE_AUX_A1)
606
#define PWM_INPUT1_GPIO_AF GPIO_AF1
607
608
// PWM_INPUT 2 on PA1 (AUXa2)
609
#define PWM_INPUT2_ICU ICUD5
610
#define PWM_INPUT2_CHANNEL ICU_CHANNEL_2
611
#define PWM_INPUT2_GPIO_PORT PAL_PORT(LINE_AUX_A2)
612
#define PWM_INPUT2_GPIO_PIN PAL_PAD(LINE_AUX_A2)
613
#define PWM_INPUT2_GPIO_AF GPIO_AF2
614
618
// Digital noise filter: 0 disabled, [0x1 - 0xF] enable up to n t_I2CCLK
619
#define STM32_CR1_DNF(n) ((n & 0x0f) << 8)
620
// Timing register
621
#define I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(0U) | \
622
STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(0U) | \
623
STM32_TIMINGR_SCLH(34U) | STM32_TIMINGR_SCLL(86U))
624
#define I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(1U) | \
625
STM32_TIMINGR_SCLDEL(9U) | STM32_TIMINGR_SDADEL(0U) | \
626
STM32_TIMINGR_SCLH(105U) | STM32_TIMINGR_SCLL(153U))
627
628
629
// Internal I2C (baro, magneto)
630
631
#ifndef I2C4_CLOCK_SPEED
632
#define I2C4_CLOCK_SPEED 400000
633
#endif
634
635
#if I2C4_CLOCK_SPEED == 400000
636
#define I2C4_CFG_DEF { \
637
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
638
.cr1 = STM32_CR1_DNF(0), \
639
.cr2 = 0 \
640
}
641
#elif I2C4_CLOCK_SPEED == 100000
642
#define I2C4_CFG_DEF { \
643
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
644
.cr1 = STM32_CR1_DNF(0), \
645
.cr2 = 0 \
646
}
647
#else
648
#error "Unknown I2C4 clock speed"
649
#endif
650
651
// External I2C
652
653
#ifndef I2C2_CLOCK_SPEED
654
#define I2C2_CLOCK_SPEED 400000
655
#endif
656
657
#if I2C2_CLOCK_SPEED == 400000
658
#define I2C2_CFG_DEF { \
659
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
660
.cr1 = STM32_CR1_DNF(0), \
661
.cr2 = 0 \
662
}
663
#elif I2C2_CLOCK_SPEED == 100000
664
#define I2C2_CFG_DEF { \
665
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
666
.cr1 = STM32_CR1_DNF(0), \
667
.cr2 = 0 \
668
}
669
#else
670
#error "Unknown I2C2 clock speed"
671
#endif
672
677
// Internal SPI (IMU)
678
#define SPI4_GPIO_AF AF_SPI4_INTERNAL_CLK
679
#define SPI4_GPIO_PORT_MISO PAL_PORT(LINE_SPI4_INTERNAL_MISO)
680
#define SPI4_GPIO_MISO PAL_PAD(LINE_SPI4_INTERNAL_MISO)
681
#define SPI4_GPIO_PORT_MOSI PAL_PORT(LINE_SPI4_INTERNAL_MOSI)
682
#define SPI4_GPIO_MOSI PAL_PAD(LINE_SPI4_INTERNAL_MOSI)
683
#define SPI4_GPIO_PORT_SCK PAL_PORT(LINE_SPI4_INTERNAL_CLK)
684
#define SPI4_GPIO_SCK PAL_PAD(LINE_SPI4_INTERNAL_CLK)
685
686
// External SPI
687
#define SPI2_GPIO_AF AF_SPI2_EXTERNAL_CLK
688
#define SPI2_GPIO_PORT_MISO PAL_PORT(LINE_SPI2_EXTERNAL_MISO)
689
#define SPI2_GPIO_MISO PAL_PAD(LINE_SPI2_EXTERNAL_MISO)
690
#define SPI2_GPIO_PORT_MOSI PAL_PORT(LINE_SPI2_EXTERNAL_MOSI)
691
#define SPI2_GPIO_MOSI PAL_PAD(LINE_SPI2_EXTERNAL_MOSI)
692
#define SPI2_GPIO_PORT_SCK PAL_PORT(LINE_SPI2_EXTERNAL_CLK)
693
#define SPI2_GPIO_SCK PAL_PAD(LINE_SPI2_EXTERNAL_CLK)
694
695
// SLAVE0 on SPI connector (NSS possible)
696
#define SPI_SELECT_SLAVE0_PORT PAL_PORT(LINE_SPI2_EXTERNAL_CS)
697
#define SPI_SELECT_SLAVE0_PIN PAL_PAD(LINE_SPI2_EXTERNAL_CS)
698
// SLAVE1 on AUXb1
699
#define SPI_SELECT_SLAVE1_PORT PAL_PORT(LINE_AUX_B1)
700
#define SPI_SELECT_SLAVE1_PIN PAL_PAD(LINE_AUX_B1)
701
// SLAVE2 on AUXb2
702
#define SPI_SELECT_SLAVE2_PORT PAL_PORT(LINE_AUX_B2)
703
#define SPI_SELECT_SLAVE2_PIN PAL_PAD(LINE_AUX_B2)
704
// SLAVE3 on AUXb3
705
#define SPI_SELECT_SLAVE3_PORT PAL_PORT(LINE_AUX_B3)
706
#define SPI_SELECT_SLAVE3_PIN PAL_PAD(LINE_AUX_B3)
707
// SLAVE4 on AUXb4
708
#define SPI_SELECT_SLAVE4_PORT PAL_PORT(LINE_AUX_B4)
709
#define SPI_SELECT_SLAVE4_PIN PAL_PAD(LINE_AUX_B4)
710
// SLAVE5 on PE4 (internal IMU)
711
#define SPI_SELECT_SLAVE5_PORT PAL_PORT(LINE_SPI4_INTERNAL_CS)
712
#define SPI_SELECT_SLAVE5_PIN PAL_PAD(LINE_SPI4_INTERNAL_CS)
713
720
#ifndef USE_BARO_BOARD
721
#define USE_BARO_BOARD 0
722
#endif
723
727
#define SDIO_D0_PORT PAL_PORT(LINE_SDMMC1_D0)
728
#define SDIO_D0_PIN PAL_PAD(LINE_SDMMC1_D0)
729
#define SDIO_D1_PORT PAL_PORT(LINE_SDMMC1_D1)
730
#define SDIO_D1_PIN PAL_PAD(LINE_SDMMC1_D1)
731
#define SDIO_D2_PORT PAL_PORT(LINE_SDMMC1_D2)
732
#define SDIO_D2_PIN PAL_PAD(LINE_SDMMC1_D2)
733
#define SDIO_D3_PORT PAL_PORT(LINE_SDMMC1_D3)
734
#define SDIO_D3_PIN PAL_PAD(LINE_SDMMC1_D3)
735
#define SDIO_CK_PORT PAL_PORT(LINE_SDMMC1_CK)
736
#define SDIO_CK_PIN PAL_PAD(LINE_SDMMC1_CK)
737
#define SDIO_CMD_PORT PAL_PORT(LINE_SDMMC1_CMD)
738
#define SDIO_CMD_PIN PAL_PAD(LINE_SDMMC1_CMD)
739
#define SDIO_AF AF_SDMMC1_CK
740
// bat monitoring for file closing
741
#define SDLOG_BAT_ADC CONCAT_BOARD_PARAM(ADCD, VBAT_MEAS_ADC)
742
#define SDLOG_BAT_CHAN CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, VBAT_MEAS_ADC_IN)
743
// usb led status
744
#define SDLOG_USB_LED 4
745
#define SDLOG_USB_VBUS_PORT PAL_PORT(LINE_USB_VBUS)
746
#define SDLOG_USB_VBUS_PIN PAL_PAD(LINE_USB_VBUS)
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
761
#define WS2812D1_GPIO PAL_PORT(LINE_AUX_A1)
762
#define WS2812D1_PIN PAL_PAD(LINE_AUX_A1)
763
#define WS2812D1_AF 2
764
#define WS2812D1_CFG_DEF { \
765
.dma_stream = STM32_PWM5_UP_DMA_STREAM, \
766
.dma_channel = STM32_PWM5_UP_DMA_CHANNEL, \
767
.dma_priority = STM32_PWM5_UP_DMA_PRIORITY, \
768
.pwm_channel = 0, \
769
.pwmp = &PWMD5 \
770
}
771
772
#endif
/* CONFIG_TAWAKI_1_00_H */
773
sw
airborne
boards
tawaki
chibios
common
tawaki.h
Generated on Fri Nov 8 2024 14:10:45 for Paparazzi UAS by
1.9.1