Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
krooz_sd.h
Go to the documentation of this file.
1
#ifndef CONFIG_KROOZ_SD_H
2
#define CONFIG_KROOZ_SD_H
3
4
#define BOARD_KROOZ
5
6
/* KroozSD has a 12MHz external clock and 168MHz internal. */
7
#define EXT_CLK 12000000
8
#define AHB_CLK 168000000
9
10
/*
11
* Onboard LEDs
12
*/
13
14
/* red, on PA8 */
15
#ifndef USE_LED_1
16
#define USE_LED_1 1
17
#endif
18
#define LED_1_GPIO GPIOA
19
#define LED_1_GPIO_PIN GPIO13
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
/* green, shared with JTAG_TRST */
25
#ifndef USE_LED_2
26
#define USE_LED_2 1
27
#endif
28
#define LED_2_GPIO GPIOA
29
#define LED_2_GPIO_PIN GPIO14
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, shared with ADC12 (ADC_6 on connector ANALOG2) */
35
#ifndef USE_LED_3
36
#define USE_LED_3 1
37
#endif
38
#define LED_3_GPIO GPIOA
39
#define LED_3_GPIO_PIN GPIO15
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
/*
45
* not actual LEDS, used as GPIOs
46
*/
47
48
/* PB4, Camera power On/Off */
49
#define CAM_SW_GPIO GPIOB
50
#define CAM_SW_GPIO_CLK RCC_GPIOB
51
#define CAM_SW_GPIO_PIN GPIO4
52
#define CAM_SW_AFIO_REMAP ((void)0)
53
54
/* PC2, Camera shot */
55
#define CAM_SH_GPIO GPIOC
56
#define CAM_SH_GPIO_CLK RCC_GPIOC
57
#define CAM_SH_GPIO_PIN GPIO2
58
#define CAM_SH_AFIO_REMAP ((void)0)
59
60
/* PC15, Camera video */
61
#define CAM_V_GPIO GPIOC
62
#define CAM_V_GPIO_CLK RCC_GPIOC
63
#define CAM_V_GPIO_PIN GPIO15
64
#define CAM_V_AFIO_REMAP ((void)0)
65
66
#define BEEPER_GPIO GPIOC
67
#define BEEPER_GPIO_CLK RCC_GPIOC
68
#define BEEPER_GPIO_PIN GPIO14
69
#define BEEPER_AFIO_REMAP ((void)0)
70
71
72
/* Default actuators driver */
73
#define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
74
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
75
#define ActuatorsDefaultInit() ActuatorsPwmInit()
76
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
77
78
#define DefaultVoltageOfAdc(adc) (0.008874*adc)
79
80
/* UART */
81
#define UART1_GPIO_AF GPIO_AF7
82
#define UART1_GPIO_PORT_RX GPIOA
83
#define UART1_GPIO_RX GPIO10
84
#define UART1_GPIO_PORT_TX GPIOA
85
#define UART1_GPIO_TX GPIO9
86
87
#define UART3_GPIO_AF GPIO_AF7
88
#define UART3_GPIO_PORT_RX GPIOC
89
#define UART3_GPIO_RX GPIO11
90
#define UART3_GPIO_PORT_TX GPIOC
91
#define UART3_GPIO_TX GPIO10
92
93
#define UART5_GPIO_AF GPIO_AF8
94
#define UART5_GPIO_PORT_RX GPIOD
95
#define UART5_GPIO_RX GPIO2
96
#define UART5_GPIO_PORT_TX GPIOC
97
#define UART5_GPIO_TX GPIO12
98
99
/* SPI */
100
#define SPI1_GPIO_AF GPIO_AF5
101
#define SPI1_GPIO_PORT_MISO GPIOA
102
#define SPI1_GPIO_MISO GPIO6
103
#define SPI1_GPIO_PORT_MOSI GPIOA
104
#define SPI1_GPIO_MOSI GPIO7
105
#define SPI1_GPIO_PORT_SCK GPIOA
106
#define SPI1_GPIO_SCK GPIO5
107
108
#define SPI2_GPIO_AF GPIO_AF5
109
#define SPI2_GPIO_PORT_MISO GPIOB
110
#define SPI2_GPIO_MISO GPIO14
111
#define SPI2_GPIO_PORT_MOSI GPIOB
112
#define SPI2_GPIO_MOSI GPIO15
113
#define SPI2_GPIO_PORT_SCK GPIOB
114
#define SPI2_GPIO_SCK GPIO13
115
116
#define SPI_SELECT_SLAVE0_PORT GPIOA
117
#define SPI_SELECT_SLAVE0_PIN GPIO4
118
#define SPI_SELECT_SLAVE1_PORT GPIOB
119
#define SPI_SELECT_SLAVE1_PIN GPIO12
120
#define SPI_SELECT_SLAVE2_PORT GPIOB
121
#define SPI_SELECT_SLAVE2_PIN GPIO2
122
123
/* I2C mapping */
124
#define I2C1_GPIO_PORT GPIOB
125
#define I2C1_GPIO_SCL GPIO8
126
#define I2C1_GPIO_SDA GPIO9
127
128
#define I2C2_GPIO_PORT GPIOB
129
#define I2C2_GPIO_SCL GPIO10
130
#define I2C2_GPIO_SDA GPIO11
131
132
#define I2C3_GPIO_PORT_SCL GPIOA
133
#define I2C3_GPIO_PORT_SDA GPIOC
134
#define I2C3_GPIO_SCL GPIO8
135
#define I2C3_GPIO_SDA GPIO9
136
137
/* Onboard ADCs */
138
#define USE_AD_TIM1 1
139
140
/* provide defines that can be used to access the ADC_x in the code or airframe file
141
* these directly map to the index number of the 4 adc channels defined above
142
* 4th (index 3) is used for bat monitoring by default
143
*/
144
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
145
#ifndef ADC_CHANNEL_VSUPPLY
146
#define ADC_CHANNEL_VSUPPLY ADC_4
147
#endif
148
149
#define ADC_CHANNEL_CAM1 ADC_1
150
151
/* provide defines that can be used to access the ADC_x in the code or airframe file
152
* these directly map to the index number of the 4 adc channels defined above
153
* 4th (index 3) is used for bat monitoring by default
154
*/
155
#if USE_ADC_1
156
#define AD1_1_CHANNEL 12
157
#define ADC_1 AD1_1
158
#define ADC_1_GPIO_PORT GPIOC
159
#define ADC_1_GPIO_PIN GPIO2
160
#endif
161
162
#if USE_ADC_2
163
#define AD1_2_CHANNEL 10
164
#define ADC_2 AD1_2
165
#define ADC_2_GPIO_PORT GPIOC
166
#define ADC_2_GPIO_PIN GPIO0
167
#endif
168
169
#if USE_ADC_3
170
#define AD1_3_CHANNEL 11
171
#define ADC_3 AD1_3
172
#define ADC_3_GPIO_PORT GPIOC
173
#define ADC_3_GPIO_PIN GPIO1
174
#endif
175
176
// Internal ADC for battery enabled by default
177
#ifndef USE_ADC_4
178
#define USE_ADC_4 1
179
#endif
180
#if USE_ADC_4
181
#define AD1_4_CHANNEL 13
182
#define ADC_4 AD1_4
183
#define ADC_4_GPIO_PORT GPIOC
184
#define ADC_4_GPIO_PIN GPIO3
185
#endif
186
187
188
/* by default activate onboard baro */
189
#ifndef USE_BARO_BOARD
190
#define USE_BARO_BOARD 1
191
#endif
192
193
194
/* PWM */
195
#define PWM_USE_TIM3 1
196
#define PWM_USE_TIM4 1
197
#define PWM_USE_TIM5 1
198
199
#define USE_PWM0 1
200
#define USE_PWM1 1
201
#define USE_PWM2 1
202
#define USE_PWM3 1
203
#define USE_PWM4 1
204
#define USE_PWM5 1
205
#define USE_PWM6 1
206
#define USE_PWM7 1
207
#define USE_PWM8 1
208
#define USE_PWM9 1
209
//#define USE_PWM10 1
210
211
#if USE_PWM10
212
#define ACTUATORS_PWM_NB 11
213
#define PWM_USE_TIM2 1
214
#else
215
#define ACTUATORS_PWM_NB 10
216
#endif
217
218
// PWM_SERVO_x is the index of the servo in the actuators_pwm_values array
219
#if USE_PWM0
220
#define PWM_SERVO_0 0
221
#define PWM_SERVO_0_TIMER TIM3
222
#define PWM_SERVO_0_GPIO GPIOB
223
#define PWM_SERVO_0_PIN GPIO1
224
#define PWM_SERVO_0_AF GPIO_AF2
225
#define PWM_SERVO_0_OC TIM_OC4
226
#define PWM_SERVO_0_OC_BIT (1<<3)
227
#else
228
#define PWM_SERVO_0_OC_BIT 0
229
#endif
230
231
#if USE_PWM1
232
#define PWM_SERVO_1 1
233
#define PWM_SERVO_1_TIMER TIM3
234
#define PWM_SERVO_1_GPIO GPIOC
235
#define PWM_SERVO_1_PIN GPIO8
236
#define PWM_SERVO_1_AF GPIO_AF2
237
#define PWM_SERVO_1_OC TIM_OC3
238
#define PWM_SERVO_1_OC_BIT (1<<2)
239
#else
240
#define PWM_SERVO_1_OC_BIT 0
241
#endif
242
243
#if USE_PWM2
244
#define PWM_SERVO_2 2
245
#define PWM_SERVO_2_TIMER TIM3
246
#define PWM_SERVO_2_GPIO GPIOC
247
#define PWM_SERVO_2_PIN GPIO7
248
#define PWM_SERVO_2_AF GPIO_AF2
249
#define PWM_SERVO_2_OC TIM_OC2
250
#define PWM_SERVO_2_OC_BIT (1<<1)
251
#else
252
#define PWM_SERVO_2_OC_BIT 0
253
#endif
254
255
#if USE_PWM3
256
#define PWM_SERVO_3 3
257
#define PWM_SERVO_3_TIMER TIM3
258
#define PWM_SERVO_3_GPIO GPIOB
259
#define PWM_SERVO_3_PIN GPIO4
260
#define PWM_SERVO_3_AF GPIO_AF2
261
#define PWM_SERVO_3_OC TIM_OC1
262
#define PWM_SERVO_3_OC_BIT (1<<0)
263
#else
264
#define PWM_SERVO_3_OC_BIT 0
265
#endif
266
267
#if USE_PWM4
268
#define PWM_SERVO_4 4
269
#define PWM_SERVO_4_TIMER TIM4
270
#define PWM_SERVO_4_GPIO GPIOB
271
#define PWM_SERVO_4_PIN GPIO7
272
#define PWM_SERVO_4_AF GPIO_AF2
273
#define PWM_SERVO_4_OC TIM_OC2
274
#define PWM_SERVO_4_OC_BIT (1<<1)
275
#else
276
#define PWM_SERVO_4_OC_BIT 0
277
#endif
278
279
#if USE_PWM5
280
#define PWM_SERVO_5 5
281
#define PWM_SERVO_5_TIMER TIM4
282
#define PWM_SERVO_5_GPIO GPIOB
283
#define PWM_SERVO_5_PIN GPIO6
284
#define PWM_SERVO_5_AF GPIO_AF2
285
#define PWM_SERVO_5_OC TIM_OC1
286
#define PWM_SERVO_5_OC_BIT (1<<0)
287
#else
288
#define PWM_SERVO_5_OC_BIT 0
289
#endif
290
291
#if USE_PWM6
292
#define PWM_SERVO_6 6
293
#define PWM_SERVO_6_TIMER TIM5
294
#define PWM_SERVO_6_GPIO GPIOA
295
#define PWM_SERVO_6_PIN GPIO3
296
#define PWM_SERVO_6_AF GPIO_AF2
297
#define PWM_SERVO_6_OC TIM_OC4
298
#define PWM_SERVO_6_OC_BIT (1<<3)
299
#else
300
#define PWM_SERVO_6_OC_BIT 0
301
#endif
302
303
#if USE_PWM7
304
#define PWM_SERVO_7 7
305
#define PWM_SERVO_7_TIMER TIM5
306
#define PWM_SERVO_7_GPIO GPIOA
307
#define PWM_SERVO_7_PIN GPIO2
308
#define PWM_SERVO_7_AF GPIO_AF2
309
#define PWM_SERVO_7_OC TIM_OC3
310
#define PWM_SERVO_7_OC_BIT (1<<2)
311
#else
312
#define PWM_SERVO_7_OC_BIT 0
313
#endif
314
315
#if USE_PWM8
316
#define PWM_SERVO_8 8
317
#define PWM_SERVO_8_TIMER TIM5
318
#define PWM_SERVO_8_GPIO GPIOA
319
#define PWM_SERVO_8_PIN GPIO1
320
#define PWM_SERVO_8_AF GPIO_AF2
321
#define PWM_SERVO_8_OC TIM_OC2
322
#define PWM_SERVO_8_OC_BIT (1<<1)
323
#else
324
#define PWM_SERVO_8_OC_BIT 0
325
#endif
326
327
#if USE_PWM9
328
#define PWM_SERVO_9 9
329
#define PWM_SERVO_9_TIMER TIM5
330
#define PWM_SERVO_9_GPIO GPIOA
331
#define PWM_SERVO_9_PIN GPIO0
332
#define PWM_SERVO_9_AF GPIO_AF2
333
#define PWM_SERVO_9_OC TIM_OC1
334
#define PWM_SERVO_9_OC_BIT (1<<0)
335
#else
336
#define PWM_SERVO_9_OC_BIT 0
337
#endif
338
339
#if USE_PWM10
340
#define PWM_SERVO_10 10
341
#define PWM_SERVO_10_TIMER TIM2
342
#define PWM_SERVO_10_GPIO GPIOB
343
#define PWM_SERVO_10_PIN GPIO3
344
#define PWM_SERVO_10_AF GPIO_AF1
345
#define PWM_SERVO_10_OC TIM_OC2
346
#define PWM_SERVO_10_OC_BIT (1<<1)
347
#else
348
#define PWM_SERVO_10_OC_BIT 0
349
#endif
350
351
#define PWM_TIM2_CHAN_MASK (PWM_SERVO_10_OC_BIT)
352
#define PWM_TIM3_CHAN_MASK (PWM_SERVO_0_OC_BIT|PWM_SERVO_1_OC_BIT|PWM_SERVO_2_OC_BIT|PWM_SERVO_3_OC_BIT)
353
#define PWM_TIM4_CHAN_MASK (PWM_SERVO_4_OC_BIT|PWM_SERVO_5_OC_BIT)
354
#define PWM_TIM5_CHAN_MASK (PWM_SERVO_6_OC_BIT|PWM_SERVO_7_OC_BIT|PWM_SERVO_8_OC_BIT|PWM_SERVO_9_OC_BIT)
355
356
/* PPM */
357
358
#define USE_PPM_TIM2 1
359
360
#define PPM_CHANNEL TIM_IC2
361
#define PPM_TIMER_INPUT TIM_IC_IN_TI2
362
#define PPM_IRQ NVIC_TIM2_IRQ
363
//#define PPM_IRQ2 NVIC_TIM2_UP_TIM10_IRQ
364
// Capture/Compare InteruptEnable and InterruptFlag
365
#define PPM_CC_IE TIM_DIER_CC2IE
366
#define PPM_CC_IF TIM_SR_CC2IF
367
#define PPM_GPIO_PORT GPIOB
368
#define PPM_GPIO_PIN GPIO3
369
#define PPM_GPIO_AF GPIO_AF1
370
371
/*
372
* Spektrum
373
*/
374
/* The line that is pulled low at power up to initiate the bind process */
375
/* CSW pin on CAM connector */
376
#define SPEKTRUM_BIND_PIN GPIO0
377
#define SPEKTRUM_BIND_PIN_PORT GPIOB
378
379
#define SPEKTRUM_UART1_RCC RCC_USART1
380
#define SPEKTRUM_UART1_BANK GPIOA
381
#define SPEKTRUM_UART1_PIN GPIO10
382
#define SPEKTRUM_UART1_AF GPIO_AF7
383
#define SPEKTRUM_UART1_IRQ NVIC_USART1_IRQ
384
#define SPEKTRUM_UART1_ISR usart1_isr
385
#define SPEKTRUM_UART1_DEV USART1
386
387
#endif
/* CONFIG_KROOZ_SD_H */
sw
airborne
boards
krooz_sd.h
Generated on Thu Dec 5 2024 13:05:29 for Paparazzi UAS by
1.9.1