Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
px4fmu.h
Go to the documentation of this file.
1
#ifndef CONFIG_PX4FMU_4_00_H
2
#define CONFIG_PX4FMU_4_00_H
3
4
#define BOARD_PX4FMU
5
9
#include "
boards/px4fmu/chibios/v4.0/board.h
"
10
15
/*
16
* Concat macro
17
*/
18
#define _CONCAT_BOARD_PARAM(_s1, _s2) _s1 ## _s2
19
#define CONCAT_BOARD_PARAM(_s1, _s2) _CONCAT_BOARD_PARAM(_s1, _s2)
20
21
/*
22
* Onboard LEDs
23
*/
24
/* red, on PE12 */
25
#ifndef USE_LED_1
26
#define USE_LED_1 1
27
#endif
28
#define LED_1_GPIO GPIOB
29
#define LED_1_GPIO_PIN GPIO11
30
#define LED_1_GPIO_ON gpio_clear
31
#define LED_1_GPIO_OFF gpio_set
32
#define LED_1_AFIO_REMAP ((void)0)
33
34
/* green, on PB1 */
35
#ifndef USE_LED_2
36
#define USE_LED_2 1
37
#endif
38
#define LED_2_GPIO GPIOB
39
#define LED_2_GPIO_PIN GPIO1
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
44
/* blue, on PB3 */
45
#ifndef USE_LED_3
46
#define USE_LED_3 1
47
#endif
48
#define LED_3_GPIO GPIOB
49
#define LED_3_GPIO_PIN GPIO3
50
#define LED_3_GPIO_ON gpio_clear
51
#define LED_3_GPIO_OFF gpio_set
52
#define LED_3_AFIO_REMAP ((void)0)
53
54
/*
55
* ADCs
56
*/
57
// VOLT_SENS
58
#ifndef USE_ADC_1
59
#define USE_ADC_1 1
60
#endif
61
#if USE_ADC_1
62
#define AD1_1_CHANNEL ADC_CHANNEL_IN2
63
#define ADC_1 AD1_1
64
#define ADC_1_GPIO_PORT GPIOA
65
#define ADC_1_GPIO_PIN GPIO2
66
#endif
67
68
// CUR_SENS
69
#ifndef USE_ADC_2
70
#define USE_ADC_2 2
71
#endif
72
#if USE_ADC_2
73
#define AD1_2_CHANNEL ADC_CHANNEL_IN3
74
#define ADC_2 AD1_2
75
#define ADC_2_GPIO_PORT GPIOA
76
#define ADC_2_GPIO_PIN GPIO3
77
#endif
78
79
// VDD_V5_SENS
80
#if USE_ADC_3
81
#define AD1_3_CHANNEL ADC_CHANNEL_IN4
82
#define ADC_3 AD1_3
83
#define ADC_3_GPIO_PORT GPIOA
84
#define ADC_3_GPIO_PIN GPIO4
85
#endif
86
87
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
88
#ifndef ADC_CHANNEL_VSUPPLY
89
#define ADC_CHANNEL_VSUPPLY ADC_1
90
#endif
91
92
/* allow to define ADC_CHANNEL_CURRENT in the airframe file*/
93
#ifndef ADC_CHANNEL_CURRENT
94
#define ADC_CHANNEL_CURRENT ADC_2
95
#endif
96
97
/* Default powerbrick values */
98
#define DefaultVoltageOfAdc(adc) ((3.3f/4096.0f) * 10.27708149f * adc)
99
#define MilliAmpereOfAdc(adc) ((3.3f/4096.0f) * 36367.51556f * adc)
100
101
/*
102
* PWM TIM defines
103
* enable TIM1 and TIM4 by default
104
*/
105
#ifndef USE_PWM_TIM1
106
#define USE_PWM_TIM1 1
107
#endif
108
109
#ifndef USE_PWM_TIM4
110
#define USE_PWM_TIM4 1
111
#endif
112
113
/*
114
* PWM defines
115
*/
116
#if defined(LINE_SERVO1)
117
#ifndef USE_PWM1
118
#define USE_PWM1 1
119
#endif
120
#if USE_PWM1
121
#define PWM_SERVO_1 0
122
#define PWM_SERVO_1_GPIO PAL_PORT(LINE_SERVO1)
123
#define PWM_SERVO_1_PIN PAL_PAD(LINE_SERVO1)
124
#define PWM_SERVO_1_AF AF_LINE_SERVO1
125
#define PWM_SERVO_1_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO1_TIM)
126
#define PWM_SERVO_1_CHANNEL (SERVO1_TIM_CH-1)
127
#define PWM_SERVO_1_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO1_TIM)
128
#endif
129
#endif
130
131
#if defined(LINE_SERVO2)
132
#ifndef USE_PWM2
133
#define USE_PWM2 1
134
#endif
135
#if USE_PWM2
136
#define PWM_SERVO_2 1
137
#define PWM_SERVO_2_GPIO PAL_PORT(LINE_SERVO2)
138
#define PWM_SERVO_2_PIN PAL_PAD(LINE_SERVO2)
139
#define PWM_SERVO_2_AF AF_LINE_SERVO2
140
#define PWM_SERVO_2_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO2_TIM)
141
#define PWM_SERVO_2_CHANNEL (SERVO2_TIM_CH-1)
142
#define PWM_SERVO_2_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO2_TIM)
143
#endif
144
#endif
145
146
#if defined(LINE_SERVO3)
147
#ifndef USE_PWM3
148
#define USE_PWM3 1
149
#endif
150
#if USE_PWM3
151
#define PWM_SERVO_3 2
152
#define PWM_SERVO_3_GPIO PAL_PORT(LINE_SERVO3)
153
#define PWM_SERVO_3_PIN PAL_PAD(LINE_SERVO3)
154
#define PWM_SERVO_3_AF AF_LINE_SERVO3
155
#define PWM_SERVO_3_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO3_TIM)
156
#define PWM_SERVO_3_CHANNEL (SERVO3_TIM_CH-1)
157
#define PWM_SERVO_3_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO3_TIM)
158
#endif
159
#endif
160
161
#if defined(LINE_SERVO4)
162
#ifndef USE_PWM4
163
#define USE_PWM4 1
164
#endif
165
#if USE_PWM4
166
#define PWM_SERVO_4 3
167
#define PWM_SERVO_4_GPIO PAL_PORT(LINE_SERVO4)
168
#define PWM_SERVO_4_PIN PAL_PAD(LINE_SERVO4)
169
#define PWM_SERVO_4_AF AF_LINE_SERVO4
170
#define PWM_SERVO_4_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO4_TIM)
171
#define PWM_SERVO_4_CHANNEL (SERVO4_TIM_CH-1)
172
#define PWM_SERVO_4_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO4_TIM)
173
#endif
174
#endif
175
176
#if defined(LINE_SERVO5)
177
#ifndef USE_PWM5
178
#define USE_PWM5 1
179
#endif
180
#if USE_PWM5
181
#define PWM_SERVO_5 4
182
#define PWM_SERVO_5_GPIO PAL_PORT(LINE_SERVO5)
183
#define PWM_SERVO_5_PIN PAL_PAD(LINE_SERVO5)
184
#define PWM_SERVO_5_AF AF_LINE_SERVO5
185
#define PWM_SERVO_5_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO5_TIM)
186
#define PWM_SERVO_5_CHANNEL (SERVO5_TIM_CH-1)
187
#define PWM_SERVO_5_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO5_TIM)
188
#endif
189
#endif
190
191
#if defined(LINE_SERVO6)
192
#ifndef USE_PWM6
193
#define USE_PWM6 1
194
#endif
195
#if USE_PWM6
196
#define PWM_SERVO_6 5
197
#define PWM_SERVO_6_GPIO PAL_PORT(LINE_SERVO6)
198
#define PWM_SERVO_6_PIN PAL_PAD(LINE_SERVO6)
199
#define PWM_SERVO_6_AF AF_LINE_SERVO6
200
#define PWM_SERVO_6_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO6_TIM)
201
#define PWM_SERVO_6_CHANNEL (SERVO6_TIM_CH-1)
202
#define PWM_SERVO_6_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO6_TIM)
203
#endif
204
#endif
205
206
#if defined(LINE_SERVO7)
207
#ifndef USE_PWM7
208
#define USE_PWM7 1
209
#endif
210
#if USE_PWM7
211
#define PWM_SERVO_7 6
212
#define PWM_SERVO_7_GPIO PAL_PORT(LINE_SERVO7)
213
#define PWM_SERVO_7_PIN PAL_PAD(LINE_SERVO7)
214
#define PWM_SERVO_7_AF AF_LINE_SERVO7
215
#define PWM_SERVO_7_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO7_TIM)
216
#define PWM_SERVO_7_CHANNEL (SERVO7_TIM_CH-1)
217
#define PWM_SERVO_7_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO7_TIM)
218
#endif
219
#endif
220
221
#if defined(LINE_SERVO8)
222
#ifndef USE_PWM8
223
#define USE_PWM8 1
224
#endif
225
#if USE_PWM8
226
#define PWM_SERVO_8 7
227
#define PWM_SERVO_8_GPIO PAL_PORT(LINE_SERVO8)
228
#define PWM_SERVO_8_PIN PAL_PAD(LINE_SERVO8)
229
#define PWM_SERVO_8_AF AF_LINE_SERVO8
230
#define PWM_SERVO_8_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO8_TIM)
231
#define PWM_SERVO_8_CHANNEL (SERVO8_TIM_CH-1)
232
#define PWM_SERVO_8_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO8_TIM)
233
#endif
234
#endif
235
239
#define UART1_GPIO_PORT_TX GPIOB
240
#define UART1_GPIO_TX GPIO6
241
#define UART1_GPIO_PORT_RX GPIOB
242
#define UART1_GPIO_RX GPIO7
243
#define UART1_GPIO_AF 7
244
245
#define UART2_GPIO_PORT_TX GPIOD
246
#define UART2_GPIO_TX GPIO5
247
#define UART2_GPIO_PORT_RX GPIOD
248
#define UART2_GPIO_RX GPIO6
249
#define UART2_GPIO_AF 7
250
251
#define UART3_GPIO_PORT_TX GPIOD
252
#define UART3_GPIO_TX GPIO8
253
#define UART3_GPIO_PORT_RX GPIOD
254
#define UART3_GPIO_RX GPIO9
255
#define UART3_GPIO_AF 7
256
257
#define UART4_GPIO_PORT_TX GPIOA
258
#define UART4_GPIO_TX GPIO0
259
#define UART4_GPIO_PORT_RX GPIOA
260
#define UART4_GPIO_RX GPIO1
261
#define UART4_GPIO_AF 8
262
263
#define UART6_GPIO_PORT_RX GPIOC
264
#define UART6_GPIO_RX GPIO7
265
#define UART6_GPIO_AF 8
266
267
#define UART7_GPIO_PORT_TX GPIOE
268
#define UART7_GPIO_TX GPIO8
269
#define UART7_GPIO_PORT_RX GPIOE
270
#define UART7_GPIO_RX GPIO7
271
#define UART7_GPIO_AF 8
272
273
#define UART8_GPIO_PORT_TX GPIOE
274
#define UART8_GPIO_TX GPIO1
275
#define UART8_GPIO_PORT_RX GPIOE
276
#define UART8_GPIO_RX GPIO0
277
#define UART8_GPIO_AF 8
278
279
/* Soft binding Spektrum */
280
#define RADIO_CONTROL_POWER_PORT GPIOE
281
#define RADIO_CONTROL_POWER_PIN GPIO4
//SPEKTRUM POWER
282
#define RADIO_CONTROL_POWER_ON gpio_clear
// yes, inverted
283
#define RADIO_CONTROL_POWER_OFF gpio_set
284
285
//A receiver on powered on 3.3v
286
#define PERIPHERAL3V3_ENABLE_PORT GPIOC
//VDD_3V3_PERIPHERAL_EN
287
#define PERIPHERAL3V3_ENABLE_PIN GPIO5
288
#define PERIPHERAL3V3_ENABLE_ON gpio_set
289
#define PERIPHERAL3V3_ENABLE_OFF gpio_clear
290
291
// /**
292
// * PPM radio defines TODO
293
// */
294
// #define RC_PPM_TICKS_PER_USEC 2
295
// #define PPM_TIMER_FREQUENCY 2000000
296
// #define PPM_CHANNEL ICU_CHANNEL_1
297
// #define PPM_TIMER ICUD1
298
299
// /*
300
// * PWM input TODO
301
// */
302
// // PWM_INPUT 1 on PA8 (also PPM IN)
303
// #define PWM_INPUT1_ICU ICUD1
304
// #define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
305
// // PPM in (aka PA8) is used: not compatible with PPM RC receiver
306
// #define PWM_INPUT1_GPIO_PORT GPIOA
307
// #define PWM_INPUT1_GPIO_PIN GPIO8
308
// #define PWM_INPUT1_GPIO_AF GPIO_AF1
309
310
314
#ifndef I2C1_CLOCK_SPEED
315
#define I2C1_CLOCK_SPEED 400000
316
#endif
317
#if I2C1_CLOCK_SPEED == 400000
318
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
319
#elif I2C1_CLOCK_SPEED == 100000
320
#define I2C1_DUTY_CYCLE STD_DUTY_CYCLE
321
#else
322
#error Invalid I2C1 clock speed
323
#endif
324
#define I2C1_CFG_DEF { \
325
OPMODE_I2C, \
326
I2C1_CLOCK_SPEED, \
327
I2C1_DUTY_CYCLE, \
328
}
329
330
#ifndef I2C2_CLOCK_SPEED
331
#define I2C2_CLOCK_SPEED 400000
332
#endif
333
#if I2C2_CLOCK_SPEED == 400000
334
#define I2C2_DUTY_CYCLE FAST_DUTY_CYCLE_2
335
#elif I2C2_CLOCK_SPEED == 100000
336
#define I2C2_DUTY_CYCLE STD_DUTY_CYCLE
337
#else
338
#error Invalid I2C2 clock speed
339
#endif
340
#define I2C2_CFG_DEF { \
341
OPMODE_I2C, \
342
I2C2_CLOCK_SPEED, \
343
I2C2_DUTY_CYCLE, \
344
}
345
346
352
#define SPI1_GPIO_AF GPIO_AF5
353
#define SPI1_GPIO_PORT_MISO GPIOA
354
#define SPI1_GPIO_MISO GPIO6
355
#define SPI1_GPIO_PORT_MOSI GPIOA
356
#define SPI1_GPIO_MOSI GPIO7
357
#define SPI1_GPIO_PORT_SCK GPIOA
358
#define SPI1_GPIO_SCK GPIO5
359
360
#define SPI2_GPIO_AF GPIO_AF5
361
#define SPI2_GPIO_PORT_MISO GPIOB
362
#define SPI2_GPIO_MISO GPIO14
363
#define SPI2_GPIO_PORT_MOSI GPIOB
364
#define SPI2_GPIO_MOSI GPIO15
365
#define SPI2_GPIO_PORT_SCK GPIOB
366
#define SPI2_GPIO_SCK GPIO10
367
368
/* SPI1_SLAVE1 -> slave select pin for the ICM 20609-G*/
369
#define SPI_SELECT_SLAVE0_PORT GPIOC
370
#define SPI_SELECT_SLAVE0_PIN GPIO15
371
/* SPI1_SLAVE1 -> slave select pin for the HMC5983 */
372
#define SPI_SELECT_SLAVE1_PORT GPIOE
373
#define SPI_SELECT_SLAVE1_PIN GPIO15
374
// SPI1_SLAVE2 -> slave select pin for the MPU9250
375
#define SPI_SELECT_SLAVE2_PORT GPIOC
376
#define SPI_SELECT_SLAVE2_PIN GPIO2
377
// SPI1_SLAVE3 -> slave select pin for the ms5611
378
#define SPI_SELECT_SLAVE3_PORT GPIOD
379
#define SPI_SELECT_SLAVE3_PIN GPIO7
380
// SPI1_SLAVE4 -> slave select pin for the FRAM
381
#define SPI_SELECT_SLAVE4_PORT GPIOD
382
#define SPI_SELECT_SLAVE4_PIN GPIO10
383
390
#ifndef USE_BARO_BOARD
391
#define USE_BARO_BOARD 1
392
#endif
393
397
#define SDIO_D0_PORT GPIOC
398
#define SDIO_D0_PIN GPIO8
399
#define SDIO_D1_PORT GPIOC
400
#define SDIO_D1_PIN GPIO9
401
#define SDIO_D2_PORT GPIOC
402
#define SDIO_D2_PIN GPIO10
403
#define SDIO_D3_PORT GPIOC
404
#define SDIO_D3_PIN GPIO11
405
#define SDIO_CK_PORT GPIOC
406
#define SDIO_CK_PIN GPIO12
407
#define SDIO_CMD_PORT GPIOD
408
#define SDIO_CMD_PIN GPIO2
409
#define SDIO_AF 12
410
// bat monitoring for file closing
411
#define SDLOG_BAT_ADC ADCD1
412
#define SDLOG_BAT_CHAN AD1_1_CHANNEL
413
// usb led status
414
#define SDLOG_USB_LED 3
415
#define SDLOG_USB_VBUS_PORT GPIOA
416
#define SDLOG_USB_VBUS_PIN GPIO9
417
418
/*
419
* Actuators for fixedwing
420
*/
421
/* Default actuators driver */
422
#define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
423
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
424
#define ActuatorsDefaultInit() ActuatorsPwmInit()
425
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
426
427
#endif
/* CONFIG_PX4FMU_4_00_H */
428
board.h
sw
airborne
boards
px4fmu
chibios
v4.0
px4fmu.h
Generated on Thu Dec 5 2024 13:05:29 for Paparazzi UAS by
1.9.1