Paparazzi UAS
v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
apogee_1.0.h
Go to the documentation of this file.
1
#ifndef CONFIG_APOGEE_1_00_H
2
#define CONFIG_APOGEE_1_00_H
3
4
#define BOARD_APOGEE
5
6
/* Apogee has a 16MHz external clock and 168MHz internal. */
7
#define EXT_CLK 16000000
8
#define AHB_CLK 168000000
9
10
/*
11
* Onboard LEDs
12
*/
13
14
/* red, on PC0 */
15
#ifndef USE_LED_1
16
#define USE_LED_1 1
17
#endif
18
#define LED_1_GPIO GPIOC
19
#define LED_1_GPIO_PIN GPIO0
20
#define LED_1_GPIO_ON gpio_clear
21
#define LED_1_GPIO_OFF gpio_set
22
#define LED_1_AFIO_REMAP ((void)0)
23
24
/* orange, on PC13 */
25
#ifndef USE_LED_2
26
#define USE_LED_2 1
27
#endif
28
#define LED_2_GPIO GPIOC
29
#define LED_2_GPIO_PIN GPIO13
30
#define LED_2_GPIO_ON gpio_clear
31
#define LED_2_GPIO_OFF gpio_set
32
#define LED_2_AFIO_REMAP ((void)0)
33
34
/* green, on PC1 */
35
#ifndef USE_LED_3
36
#define USE_LED_3 1
37
#endif
38
#define LED_3_GPIO GPIOC
39
#define LED_3_GPIO_PIN GPIO1
40
#define LED_3_GPIO_ON gpio_clear
41
#define LED_3_GPIO_OFF gpio_set
42
#define LED_3_AFIO_REMAP ((void)0)
43
44
/* yellow, on PC3 */
45
#ifndef USE_LED_4
46
#define USE_LED_4 1
47
#endif
48
#define LED_4_GPIO GPIOC
49
#define LED_4_GPIO_PIN GPIO3
50
#define LED_4_GPIO_ON gpio_clear
51
#define LED_4_GPIO_OFF gpio_set
52
#define LED_4_AFIO_REMAP ((void)0)
53
54
/* AUX1, on PB1, 1 on LED_ON, 0 on LED_OFF */
55
#ifndef USE_LED_5
56
#define USE_LED_5 0
57
#endif
58
#define LED_5_GPIO GPIOB
59
#define LED_5_GPIO_PIN GPIO1
60
#define LED_5_GPIO_ON gpio_set
61
#define LED_5_GPIO_OFF gpio_clear
62
#define LED_5_AFIO_REMAP ((void)0)
63
64
/* AUX2, on PC5, 1 on LED_ON, 0 on LED_OFF */
65
#ifndef USE_LED_6
66
#define USE_LED_6 0
67
#endif
68
#define LED_6_GPIO GPIOC
69
#define LED_6_GPIO_PIN GPIO5
70
#define LED_6_GPIO_ON gpio_set
71
#define LED_6_GPIO_OFF gpio_clear
72
#define LED_6_AFIO_REMAP ((void)0)
73
74
/* AUX3, on PC4, 1 on LED_ON, 0 on LED_OFF */
75
#ifndef USE_LED_7
76
#define USE_LED_7 0
77
#endif
78
#define LED_7_GPIO GPIOC
79
#define LED_7_GPIO_PIN GPIO4
80
#define LED_7_GPIO_ON gpio_set
81
#define LED_7_GPIO_OFF gpio_clear
82
#define LED_7_AFIO_REMAP ((void)0)
83
84
/* AUX4, on PB15, 1 on LED_ON, 0 on LED_OFF */
85
#ifndef USE_LED_8
86
#define USE_LED_8 0
87
#endif
88
#define LED_8_GPIO GPIOB
89
#define LED_8_GPIO_PIN GPIO15
90
#define LED_8_GPIO_ON gpio_set
91
#define LED_8_GPIO_OFF gpio_clear
92
#define LED_8_AFIO_REMAP ((void)0)
93
94
/* Power Switch, on PB12 */
95
#define POWER_SWITCH_GPIO GPIOB,GPIO12
96
97
98
/* Pint to set Uart2 RX polarity, on PB13, output high inverts, low doesn't */
99
#define RC_POLARITY_GPIO_PORT GPIOB
100
#define RC_POLARITY_GPIO_PIN GPIO13
101
102
103
/* Default actuators driver */
104
#define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
105
#define ActuatorDefaultSet ActuatorPwmSet
106
#define ActuatorsDefaultInit() ActuatorsPwmInit()
107
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
108
109
#define DefaultVoltageOfAdc(adc) (0.006185*adc)
110
111
/* UART */
112
#define UART1_GPIO_AF GPIO_AF7
113
#define UART1_GPIO_PORT_RX GPIOA
114
#define UART1_GPIO_RX GPIO10
115
#define UART1_GPIO_PORT_TX GPIOB
116
#define UART1_GPIO_TX GPIO6
117
118
#define UART2_GPIO_AF GPIO_AF7
119
#define UART2_GPIO_PORT_RX GPIOA
120
#define UART2_GPIO_RX GPIO3
121
#define USE_UART2_TX FALSE
122
123
#define UART4_GPIO_AF GPIO_AF8
124
#define UART4_GPIO_PORT_RX GPIOA
125
#define UART4_GPIO_RX GPIO1
126
#define UART4_GPIO_PORT_TX GPIOA
127
#define UART4_GPIO_TX GPIO0
128
129
#define UART6_GPIO_AF GPIO_AF8
130
#define UART6_GPIO_PORT_RX GPIOC
131
#define UART6_GPIO_RX GPIO7
132
#define UART6_GPIO_PORT_TX GPIOC
133
#define UART6_GPIO_TX GPIO6
134
135
/* SPI */
136
#define SPI1_GPIO_AF GPIO_AF5
137
#define SPI1_GPIO_PORT_MISO GPIOA
138
#define SPI1_GPIO_MISO GPIO6
139
#define SPI1_GPIO_PORT_MOSI GPIOA
140
#define SPI1_GPIO_MOSI GPIO7
141
#define SPI1_GPIO_PORT_SCK GPIOA
142
#define SPI1_GPIO_SCK GPIO5
143
144
// SLAVE0 on SPI connector
145
#define SPI_SELECT_SLAVE0_PORT GPIOB
146
#define SPI_SELECT_SLAVE0_PIN GPIO9
147
// SLAVE1 on AUX1
148
#define SPI_SELECT_SLAVE1_PORT GPIOB
149
#define SPI_SELECT_SLAVE1_PIN GPIO1
150
// SLAVE2 on AUX2
151
#define SPI_SELECT_SLAVE2_PORT GPIOC
152
#define SPI_SELECT_SLAVE2_PIN GPIO5
153
// SLAVE3 on AUX3
154
#define SPI_SELECT_SLAVE3_PORT GPIOC
155
#define SPI_SELECT_SLAVE3_PIN GPIO4
156
// SLAVE4 on AUX4
157
#define SPI_SELECT_SLAVE4_PORT GPIOB
158
#define SPI_SELECT_SLAVE4_PIN GPIO15
159
160
161
/* Onboard ADCs */
162
#define USE_AD_TIM4 1
163
164
/* provide defines that can be used to access the ADC_x in the code or airframe file
165
* these directly map to the index number of the 4 adc channels defined above
166
* 4th (index 3) is used for bat monitoring by default
167
*/
168
// AUX 1
169
#if USE_ADC_1
170
#define AD1_1_CHANNEL 9
171
#define ADC_1 AD1_1
172
#define ADC_1_GPIO_PORT GPIOB
173
#define ADC_1_GPIO_PIN GPIO1
174
#endif
175
176
// AUX 2
177
#if USE_ADC_2
178
#define AD1_2_CHANNEL 15
179
#define ADC_2 AD1_2
180
#define ADC_2_GPIO_PORT GPIOC
181
#define ADC_2_GPIO_PIN GPIO5
182
#endif
183
184
// AUX 3
185
#if USE_ADC_3
186
#define AD1_3_CHANNEL 14
187
#define ADC_3 AD1_3
188
#define ADC_3_GPIO_PORT GPIOC
189
#define ADC_3_GPIO_PIN GPIO4
190
#endif
191
192
// Internal ADC for battery enabled by default
193
#ifndef USE_ADC_4
194
#define USE_ADC_4 1
195
#endif
196
#if USE_ADC_4
197
#define AD1_4_CHANNEL 4
198
#define ADC_4 AD1_4
199
#define ADC_4_GPIO_PORT GPIOA
200
#define ADC_4_GPIO_PIN GPIO4
201
#endif
202
203
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
204
#ifndef ADC_CHANNEL_VSUPPLY
205
#define ADC_CHANNEL_VSUPPLY ADC_4
206
#endif
207
208
209
/* I2C mapping */
210
#define I2C1_GPIO_PORT GPIOB
211
#define I2C1_GPIO_SCL GPIO8
212
#define I2C1_GPIO_SDA GPIO7
213
214
#define I2C2_GPIO_PORT GPIOB
215
#define I2C2_GPIO_SCL GPIO10
216
#define I2C2_GPIO_SDA GPIO11
217
218
219
220
/* PWM */
221
#define PWM_USE_TIM2 1
222
#define PWM_USE_TIM3 1
223
224
// PWM_SERVO_x is the index of the servo in the actuators_pwm_values array
225
// enable PWM connectors by default
226
227
#ifndef USE_PWM0
228
#define USE_PWM0 1
229
#endif
230
#if USE_PWM0
231
#define PWM_SERVO_0 0
232
#define PWM_SERVO_0_TIMER TIM3
233
#define PWM_SERVO_0_GPIO GPIOB
234
#define PWM_SERVO_0_PIN GPIO0
235
#define PWM_SERVO_0_AF GPIO_AF2
236
#define PWM_SERVO_0_OC TIM_OC3
237
#define PWM_SERVO_0_OC_BIT (1<<2)
238
#else
239
#define PWM_SERVO_0_OC_BIT 0
240
#endif
241
242
#ifndef USE_PWM1
243
#define USE_PWM1 1
244
#endif
245
#if USE_PWM1
246
#define PWM_SERVO_1 1
247
#define PWM_SERVO_1_TIMER TIM2
248
#define PWM_SERVO_1_GPIO GPIOA
249
#define PWM_SERVO_1_PIN GPIO2
250
#define PWM_SERVO_1_AF GPIO_AF1
251
#define PWM_SERVO_1_OC TIM_OC3
252
#define PWM_SERVO_1_OC_BIT (1<<2)
253
#else
254
#define PWM_SERVO_1_OC_BIT 0
255
#endif
256
257
#ifndef USE_PWM2
258
#define USE_PWM2 1
259
#endif
260
#if USE_PWM2
261
#define PWM_SERVO_2 2
262
#define PWM_SERVO_2_TIMER TIM3
263
#define PWM_SERVO_2_GPIO GPIOB
264
#define PWM_SERVO_2_PIN GPIO5
265
#define PWM_SERVO_2_AF GPIO_AF2
266
#define PWM_SERVO_2_OC TIM_OC2
267
#define PWM_SERVO_2_OC_BIT (1<<1)
268
#else
269
#define PWM_SERVO_2_OC_BIT 0
270
#endif
271
272
#ifndef USE_PWM3
273
#define USE_PWM3 1
274
#endif
275
#if USE_PWM3
276
#define PWM_SERVO_3 3
277
#define PWM_SERVO_3_TIMER TIM3
278
#define PWM_SERVO_3_GPIO GPIOB
279
#define PWM_SERVO_3_PIN GPIO4
280
#define PWM_SERVO_3_AF GPIO_AF2
281
#define PWM_SERVO_3_OC TIM_OC1
282
#define PWM_SERVO_3_OC_BIT (1<<0)
283
#else
284
#define PWM_SERVO_3_OC_BIT 0
285
#endif
286
287
#ifndef USE_PWM4
288
#define USE_PWM4 1
289
#endif
290
#if USE_PWM4
291
#define PWM_SERVO_4 4
292
#define PWM_SERVO_4_TIMER TIM2
293
#define PWM_SERVO_4_GPIO GPIOB
294
#define PWM_SERVO_4_PIN GPIO3
295
#define PWM_SERVO_4_AF GPIO_AF1
296
#define PWM_SERVO_4_OC TIM_OC2
297
#define PWM_SERVO_4_OC_BIT (1<<1)
298
#else
299
#define PWM_SERVO_4_OC_BIT 0
300
#endif
301
302
#ifndef USE_PWM5
303
#define USE_PWM5 1
304
#endif
305
#if USE_PWM5
306
#define PWM_SERVO_5 5
307
#define PWM_SERVO_5_TIMER TIM2
308
#define PWM_SERVO_5_GPIO GPIOA
309
#define PWM_SERVO_5_PIN GPIO15
310
#define PWM_SERVO_5_AF GPIO_AF1
311
#define PWM_SERVO_5_OC TIM_OC1
312
#define PWM_SERVO_5_OC_BIT (1<<0)
313
#else
314
#define PWM_SERVO_5_OC_BIT 0
315
#endif
316
317
// PWM AUX1 (conflict with ADC0)
318
#if USE_PWM6
319
#define PWM_SERVO_6 6
320
#define PWM_SERVO_6_TIMER TIM3
321
#define PWM_SERVO_6_GPIO GPIOB
322
#define PWM_SERVO_6_PIN GPIO1
323
#define PWM_SERVO_6_AF GPIO_AF2
324
#define PWM_SERVO_6_OC TIM_OC4
325
#define PWM_SERVO_6_OC_BIT (1<<3)
326
#else
327
#define PWM_SERVO_6_OC_BIT 0
328
#endif
329
330
331
#define PWM_TIM2_CHAN_MASK (PWM_SERVO_1_OC_BIT|PWM_SERVO_4_OC_BIT|PWM_SERVO_5_OC_BIT)
332
#define PWM_TIM3_CHAN_MASK (PWM_SERVO_0_OC_BIT|PWM_SERVO_2_OC_BIT|PWM_SERVO_3_OC_BIT|PWM_SERVO_6_OC_BIT)
333
334
/*
335
* PPM
336
*/
337
#define USE_PPM_TIM1 1
338
339
#define PPM_CHANNEL TIM_IC1
340
#define PPM_TIMER_INPUT TIM_IC_IN_TI1
341
#define PPM_IRQ NVIC_TIM1_CC_IRQ
342
#define PPM_IRQ2 NVIC_TIM1_UP_TIM10_IRQ
343
// Capture/Compare InteruptEnable and InterruptFlag
344
#define PPM_CC_IE TIM_DIER_CC1IE
345
#define PPM_CC_IF TIM_SR_CC1IF
346
#define PPM_GPIO_PORT GPIOA
347
#define PPM_GPIO_PIN GPIO8
348
#define PPM_GPIO_AF GPIO_AF1
349
350
/*
351
* PWM input
352
*/
353
// PWM_INPUT1 on TIM1
354
#define PWM_INPUT1_TIMER TIM1
355
#ifdef PWM_INPUT1_TICKS_PER_USEC
356
#define TIM1_TICKS_PER_USEC PWM_INPUT1_TICKS_PER_USEC
357
#endif
358
#define PWM_INPUT1_CHANNEL_PERIOD TIM_IC1
359
#define PWM_INPUT1_CHANNEL_DUTY TIM_IC2
360
#define PWM_INPUT1_TIMER_INPUT TIM_IC_IN_TI1
361
#define PWM_INPUT1_SLAVE_TRIG TIM_SMCR_TS_TI1FP1
362
#define PWM_INPUT1_IRQ NVIC_TIM1_CC_IRQ
363
#define PWM_INPUT1_IRQ2 NVIC_TIM1_UP_TIM10_IRQ
364
#define PWM_INPUT1_CC_IE (TIM_DIER_CC1IE | TIM_DIER_CC2IE)
365
#define USE_PWM_INPUT_TIM1 TRUE
366
#define TIM1_PWM_INPUT_IDX 0
367
#define TIM1_CC_IF_PERIOD TIM_SR_CC1IF
368
#define TIM1_CC_IF_DUTY TIM_SR_CC2IF
369
#define TIM1_CCR_PERIOD TIM1_CCR1
370
#define TIM1_CCR_DUTY TIM1_CCR2
371
// PPM in (aka PA8) is used: not compatible with PPM RC receiver
372
#define PWM_INPUT1_GPIO_PORT GPIOA
373
#define PWM_INPUT1_GPIO_PIN GPIO8
374
#define PWM_INPUT1_GPIO_AF GPIO_AF1
375
376
// PWM_INPUT2 on TIM9
377
#define PWM_INPUT2_TIMER TIM9
378
#ifdef PWM_INPUT2_TICKS_PER_USEC
379
#define TIM9_TICKS_PER_USEC PWM_INPUT2_TICKS_PER_USEC
380
#endif
381
#define PWM_INPUT2_CHANNEL_PERIOD TIM_IC1
382
#define PWM_INPUT2_CHANNEL_DUTY TIM_IC2
383
#define PWM_INPUT2_TIMER_INPUT TIM_IC_IN_TI1
384
#define PWM_INPUT2_SLAVE_TRIG TIM_SMCR_TS_TI1FP1
385
#define PWM_INPUT2_IRQ NVIC_TIM1_BRK_TIM9_IRQ
386
#define PWM_INPUT2_CC_IE (TIM_DIER_CC3IE | TIM_DIER_CC4IE)
387
#ifdef USE_PWM_INPUT2
388
#define USE_PWM_INPUT_TIM9 TRUE
389
#else
390
#define USE_PWM_INPUT_TIM9 FALSE
391
#endif
392
#define TIM9_PWM_INPUT_IDX 1
393
#define TIM9_CC_IF_PERIOD TIM_SR_CC1IF
394
#define TIM9_CC_IF_DUTY TIM_SR_CC2IF
395
#define TIM9_CCR_PERIOD TIM9_CCR1
396
#define TIM9_CCR_DUTY TIM9_CCR2
397
// Servo 1 (aka PA2) is used: not compatible with PWM1 (and should be disabled)
398
#if (USE_PWM1 && USE_PWM_INPUT2)
399
#error "PW1 and PWM_INPUT2 are not compatible"
400
#endif
401
#define PWM_INPUT2_GPIO_PORT GPIOA
402
#define PWM_INPUT2_GPIO_PIN GPIO2
403
#define PWM_INPUT2_GPIO_AF GPIO_AF3
404
405
/*
406
* Spektrum
407
*/
408
409
/* The line that is pulled low at power up to initiate the bind process
410
* PB15: AUX4
411
*/
412
#define SPEKTRUM_BIND_PIN GPIO15
413
#define SPEKTRUM_BIND_PIN_PORT GPIOB
414
415
/* The line used to send the pulse train for the bind process
416
* When using UART2 on Apogee, this as to be a different pin than the uart2 rx
417
* Default pin for this is PA8: PPM_IN
418
*/
419
#ifndef SPEKTRUM_PRIMARY_BIND_CONF_PORT
420
#define SPEKTRUM_PRIMARY_BIND_CONF_PORT GPIOA
421
#define SPEKTRUM_PRIMARY_BIND_CONF_PIN GPIO8
422
#endif
423
424
/*
425
* IRQ Priorities
426
*/
427
#define RTOS_PRIO 2
428
#define NVIC_TIM_IRQ_PRIO (RTOS_PRIO+1)
429
#define NVIC_I2C_IRQ_PRIO (RTOS_PRIO+2)
430
#define NVIC_SPI_IRQ_PRIO (RTOS_PRIO+3)
431
#define NVIC_UART_IRQ_PRIO (RTOS_PRIO+4)
432
#define NVIC_USART_IRQ_PRIO (RTOS_PRIO+4)
433
#define NVIC_ADC_IRQ_PRIO (RTOS_PRIO+5)
434
#define NVIC_TIM6_DAC_IRQ_PRIO (RTOS_PRIO+6)
435
436
437
#endif
/* CONFIG_APOGEE_1_00_H */
sw
airborne
boards
apogee_1.0.h
Generated on
for Paparazzi UAS by
1.15.0