Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
matekF765-WING.h
Go to the documentation of this file.
1 #ifndef CONFIG_MATEK_F765_WING_H
2 #define CONFIG_MATEK_F765_WING_H
3 
4 #define BOARD_MATEK_F765_WING
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 /* blue, 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 /* greeg, 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 /*
48  * ADCs
49  */
50 // AIRSPEED
51 #if USE_ADC_1
52 #define AD1_1_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AIRSPEED_ADC_IN)
53 #define ADC_1 AD1_1
54 #define ADC_1_GPIO_PORT PAL_PORT(LINE_AIRSPEED)
55 #define ADC_1_GPIO_PIN PAL_PAD(LINE_AIRSPEED)
56 #endif
57 
58 // RSSI
59 #if USE_ADC_2
60 #define AD1_2_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, RSSI_ADC_IN)
61 #define ADC_2 AD1_2
62 #define ADC_2_GPIO_PORT PAL_PORT(LINE_RSSI)
63 #define ADC_2_GPIO_PIN PAL_PAD(LINE_RSSI)
64 #endif
65 
66 // VBAT enabled by default
67 #ifndef USE_ADC_3
68 #define USE_ADC_3 1
69 #endif
70 #if USE_ADC_3
71 #define AD1_3_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, VBAT_MEAS_ADC_IN)
72 #define ADC_3 AD1_3
73 #define ADC_3_GPIO_PORT PAL_PORT(LINE_VBAT_MEAS)
74 #define ADC_3_GPIO_PIN PAL_PAD(LINE_VBAT_MEAS)
75 #endif
76 
77 // CURRENT
78 #if USE_ADC_4
79 #define AD1_4_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, CURRENT_MEAS_ADC_IN)
80 #define ADC_4 AD1_4
81 #define ADC_4_GPIO_PORT PAL_PORT(LINE_CURRENT_MEAS)
82 #define ADC_4_GPIO_PIN PAL_PAD(LINE_CURRENT_MEAS)
83 #endif
84 
85 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
86 #ifndef ADC_CHANNEL_VSUPPLY
87 #define ADC_CHANNEL_VSUPPLY ADC_3
88 #endif
89 
90 /*
91  * R1 = 1k
92  * R2 = 10k
93  * adc * (3.3 / 2^12) * ((R1 + R2) / R1)
94  */
95 #define VBAT_R1 1000.0f
96 #define VBAT_R2 10000.0f
97 #define DefaultVoltageOfAdc(adc) ((3.3f/4096.0f)*((VBAT_R1+VBAT_R2)/VBAT_R1)*adc)
98 
99 /*
100  * current sensor: 132A, 3.3V 12bits ADC -> 40 A/V -> 40000 * 3.3/2^12 mA/ADC
101  */
102 #define DefaultMilliAmpereOfAdc(adc) ((40000.f*3.3f/4096.f)*adc)
103 
104 /*
105  * PWM TIM defines
106  * enable TIM 2, 4, 5, 8, 9 by default
107  */
108 #ifndef USE_PWM_TIM2
109 #define USE_PWM_TIM2 1
110 #endif
111 
112 #ifndef USE_PWM_TIM4
113 #define USE_PWM_TIM4 1
114 #endif
115 
116 #ifndef USE_PWM_TIM5
117 #define USE_PWM_TIM5 1
118 #endif
119 
120 #ifndef USE_PWM_TIM8
121 #define USE_PWM_TIM8 1
122 #endif
123 
124 #ifndef USE_PWM_TIM9
125 #define USE_PWM_TIM9 1
126 #endif
127 
128 /*
129  * PWM defines
130  */
131 
132 #ifndef USE_PWM1
133 #define USE_PWM1 1
134 #endif
135 #if USE_PWM1
136 #define PWM_SERVO_1 1
137 #define PWM_SERVO_1_GPIO PAL_PORT(LINE_S1)
138 #define PWM_SERVO_1_PIN PAL_PAD(LINE_S1)
139 #define PWM_SERVO_1_AF AF_S1
140 #define PWM_SERVO_1_DRIVER CONCAT_BOARD_PARAM(PWMD, S1_TIM)
141 #define PWM_SERVO_1_CHANNEL (S1_TIM_CH-1)
142 #define PWM_SERVO_1_CONF CONCAT_BOARD_PARAM(pwmcfg, S1_TIM)
143 #endif
144 
145 #ifndef USE_PWM2
146 #define USE_PWM2 1
147 #endif
148 #if USE_PWM2
149 #define PWM_SERVO_2 2
150 #define PWM_SERVO_2_GPIO PAL_PORT(LINE_S2)
151 #define PWM_SERVO_2_PIN PAL_PAD(LINE_S2)
152 #define PWM_SERVO_2_AF AF_S2
153 #define PWM_SERVO_2_DRIVER CONCAT_BOARD_PARAM(PWMD, S2_TIM)
154 #define PWM_SERVO_2_CHANNEL (S2_TIM_CH-1)
155 #define PWM_SERVO_2_CONF CONCAT_BOARD_PARAM(pwmcfg, S2_TIM)
156 #endif
157 
158 #ifndef USE_PWM3
159 #define USE_PWM3 1
160 #endif
161 #if USE_PWM3
162 #define PWM_SERVO_3 3
163 #define PWM_SERVO_3_GPIO PAL_PORT(LINE_S3)
164 #define PWM_SERVO_3_PIN PAL_PAD(LINE_S3)
165 #define PWM_SERVO_3_AF AF_S3
166 #define PWM_SERVO_3_DRIVER CONCAT_BOARD_PARAM(PWMD, S3_TIM)
167 #define PWM_SERVO_3_CHANNEL (S3_TIM_CH-1)
168 #define PWM_SERVO_3_CONF CONCAT_BOARD_PARAM(pwmcfg, S3_TIM)
169 #endif
170 
171 #ifndef USE_PWM4
172 #define USE_PWM4 1
173 #endif
174 #if USE_PWM4
175 #define PWM_SERVO_4 4
176 #define PWM_SERVO_4_GPIO PAL_PORT(LINE_S4)
177 #define PWM_SERVO_4_PIN PAL_PAD(LINE_S4)
178 #define PWM_SERVO_4_AF AF_S4
179 #define PWM_SERVO_4_DRIVER CONCAT_BOARD_PARAM(PWMD, S4_TIM)
180 #define PWM_SERVO_4_CHANNEL (S4_TIM_CH-1)
181 #define PWM_SERVO_4_CONF CONCAT_BOARD_PARAM(pwmcfg, S4_TIM)
182 #endif
183 
184 #ifndef USE_PWM5
185 #define USE_PWM5 1
186 #endif
187 #if USE_PWM5
188 #define PWM_SERVO_5 5
189 #define PWM_SERVO_5_GPIO PAL_PORT(LINE_S5)
190 #define PWM_SERVO_5_PIN PAL_PAD(LINE_S5)
191 #define PWM_SERVO_5_AF AF_S5
192 #define PWM_SERVO_5_DRIVER CONCAT_BOARD_PARAM(PWMD, S5_TIM)
193 #define PWM_SERVO_5_CHANNEL (S5_TIM_CH-1)
194 #define PWM_SERVO_5_CONF CONCAT_BOARD_PARAM(pwmcfg, S5_TIM)
195 #endif
196 
197 #ifndef USE_PWM6
198 #define USE_PWM6 1
199 #endif
200 #if USE_PWM6
201 #define PWM_SERVO_6 6
202 #define PWM_SERVO_6_GPIO PAL_PORT(LINE_S6)
203 #define PWM_SERVO_6_PIN PAL_PAD(LINE_S6)
204 #define PWM_SERVO_6_AF AF_S6
205 #define PWM_SERVO_6_DRIVER CONCAT_BOARD_PARAM(PWMD, S6_TIM)
206 #define PWM_SERVO_6_CHANNEL (S6_TIM_CH-1)
207 #define PWM_SERVO_6_CONF CONCAT_BOARD_PARAM(pwmcfg, S6_TIM)
208 #endif
209 
210 #ifndef USE_PWM7
211 #define USE_PWM7 1
212 #endif
213 #if USE_PWM7
214 #define PWM_SERVO_7 7
215 #define PWM_SERVO_7_GPIO PAL_PORT(LINE_S7)
216 #define PWM_SERVO_7_PIN PAL_PAD(LINE_S7)
217 #define PWM_SERVO_7_AF AF_S7
218 #define PWM_SERVO_7_DRIVER CONCAT_BOARD_PARAM(PWMD, S7_TIM)
219 #define PWM_SERVO_7_CHANNEL (S7_TIM_CH-1)
220 #define PWM_SERVO_7_CONF CONCAT_BOARD_PARAM(pwmcfg, S7_TIM)
221 #endif
222 
223 #ifndef USE_PWM8
224 #define USE_PWM8 1
225 #endif
226 #if USE_PWM8
227 #define PWM_SERVO_8 8
228 #define PWM_SERVO_8_GPIO PAL_PORT(LINE_S8)
229 #define PWM_SERVO_8_PIN PAL_PAD(LINE_S8)
230 #define PWM_SERVO_8_AF AF_S8
231 #define PWM_SERVO_8_DRIVER CONCAT_BOARD_PARAM(PWMD, S8_TIM)
232 #define PWM_SERVO_8_CHANNEL (S8_TIM_CH-1)
233 #define PWM_SERVO_8_CONF CONCAT_BOARD_PARAM(pwmcfg, S8_TIM)
234 #endif
235 
236 #ifndef USE_PWM9
237 #define USE_PWM9 1
238 #endif
239 #if USE_PWM9
240 #define PWM_SERVO_9 9
241 #define PWM_SERVO_9_GPIO PAL_PORT(LINE_S9)
242 #define PWM_SERVO_9_PIN PAL_PAD(LINE_S9)
243 #define PWM_SERVO_9_AF AF_S9
244 #define PWM_SERVO_9_DRIVER CONCAT_BOARD_PARAM(PWMD, S9_TIM)
245 #define PWM_SERVO_9_CHANNEL (S9_TIM_CH-1)
246 #define PWM_SERVO_9_CONF CONCAT_BOARD_PARAM(pwmcfg, S9_TIM)
247 #endif
248 
249 #ifndef USE_PWM10
250 #define USE_PWM10 1
251 #endif
252 #if USE_PWM10
253 #define PWM_SERVO_10 10
254 #define PWM_SERVO_10_GPIO PAL_PORT(LINE_S10)
255 #define PWM_SERVO_10_PIN PAL_PAD(LINE_S10)
256 #define PWM_SERVO_10_AF AF_S10
257 #define PWM_SERVO_10_DRIVER CONCAT_BOARD_PARAM(PWMD, S10_TIM)
258 #define PWM_SERVO_10_CHANNEL (S10_TIM_CH-1)
259 #define PWM_SERVO_10_CONF CONCAT_BOARD_PARAM(pwmcfg, S10_TIM)
260 #endif
261 
262 #ifndef USE_PWM11
263 #define USE_PWM11 0
264 #endif
265 #if USE_PWM11
266 #define PWM_SERVO_11 11
267 #define PWM_SERVO_11_GPIO PAL_PORT(LINE_S11)
268 #define PWM_SERVO_11_PIN PAL_PAD(LINE_S11)
269 #define PWM_SERVO_11_AF AF_S11
270 #define PWM_SERVO_11_DRIVER CONCAT_BOARD_PARAM(PWMD, S11_TIM)
271 #define PWM_SERVO_11_CHANNEL (S11_TIM_CH-1)
272 #define PWM_SERVO_11_CONF CONCAT_BOARD_PARAM(pwmcfg, S11_TIM)
273 #endif
274 
275 #ifndef USE_PWM12
276 #define USE_PWM12 0
277 #endif
278 #if USE_PWM12
279 #define PWM_SERVO_12 12
280 #define PWM_SERVO_12_GPIO PAL_PORT(LINE_S12)
281 #define PWM_SERVO_12_PIN PAL_PAD(LINE_S12)
282 #define PWM_SERVO_12_AF AF_12
283 #define PWM_SERVO_12_DRIVER CONCAT_BOARD_PARAM(PWMD, S12_TIM)
284 #define PWM_SERVO_12_CHANNEL (S12_TIM_CH-1)
285 #define PWM_SERVO_12_CONF CONCAT_BOARD_PARAM(pwmcfg, S12_TIM)
286 #endif
287 
288 // servo index starting at 1 + regular servos + aux servos
289 // so NB = 1+10+2
290 #define ACTUATORS_PWM_NB 13
291 
292 
296 #ifndef DSHOT_TELEMETRY_DEV
297 #define DSHOT_TELEMETRY_DEV NULL
298 #endif
299 
300 #ifndef USE_DSHOT_TIM4
301 #define USE_DSHOT_TIM4 1
302 #endif
303 
304 #if USE_DSHOT_TIM4 // Servo 7, 8, 9, 10 on TIM4
305 
306 // Servo B1, B2, B3, B4 on TM4 are primary DSHOT connector
307 #define DSHOT_SERVO_7 1
308 #define DSHOT_SERVO_7_GPIO PAL_PORT(LINE_S7)
309 #define DSHOT_SERVO_7_PIN PAL_PAD(LINE_S7)
310 #define DSHOT_SERVO_7_AF AF_S7
311 #define DSHOT_SERVO_7_DRIVER CONCAT_BOARD_PARAM(DSHOTD, S7_TIM)
312 #define DSHOT_SERVO_7_CHANNEL S7_TIM_CH
313 
314 #define DSHOT_SERVO_8 2
315 #define DSHOT_SERVO_8_GPIO PAL_PORT(LINE_S8)
316 #define DSHOT_SERVO_8_PIN PAL_PAD(LINE_S8)
317 #define DSHOT_SERVO_8_AF AF_S8
318 #define DSHOT_SERVO_8_DRIVER CONCAT_BOARD_PARAM(DSHOTD, S8_TIM)
319 #define DSHOT_SERVO_8_CHANNEL S8_TIM_CH
320 
321 #define DSHOT_SERVO_9 3
322 #define DSHOT_SERVO_9_GPIO PAL_PORT(LINE_S9)
323 #define DSHOT_SERVO_9_PIN PAL_PAD(LINE_S9)
324 #define DSHOT_SERVO_9_AF AF_S9
325 #define DSHOT_SERVO_9_DRIVER CONCAT_BOARD_PARAM(DSHOTD, S9_TIM)
326 #define DSHOT_SERVO_9_CHANNEL S9_TIM_CH
327 
328 #define DSHOT_SERVO_10 4
329 #define DSHOT_SERVO_10_GPIO PAL_PORT(LINE_S10)
330 #define DSHOT_SERVO_10_PIN PAL_PAD(LINE_S10)
331 #define DSHOT_SERVO_10_AF AF_S10
332 #define DSHOT_SERVO_10_DRIVER CONCAT_BOARD_PARAM(DSHOTD, S10_TIM)
333 #define DSHOT_SERVO_10_CHANNEL S10_TIM_CH
334 
335 #define DSHOT_CONF_TIM4 1
336 #define DSHOT_CONF4_DEF { \
337  .dma_stream = STM32_PWM4_UP_DMA_STREAM, \
338  .dma_channel = STM32_PWM4_UP_DMA_CHANNEL, \
339  .pwmp = &PWMD4, \
340  .tlm_sd = DSHOT_TELEMETRY_DEV, \
341  .dma_buf = &dshot4DmaBuffer, \
342  .dcache_memory_in_use = false \
343 }
344 
345 #endif
346 
350 #define UART7_GPIO_PORT_TX PAL_PORT(LINE_UART7_TX)
351 #define UART7_GPIO_TX PAL_PAD(LINE_UART7_TX)
352 #define UART7_GPIO_PORT_RX PAL_PORT(LINE_UART7_RX)
353 #define UART7_GPIO_RX PAL_PAD(LINE_UART7_RX)
354 #define UART7_GPIO_AF AF_UART7_TX
355 #ifndef UART7_HW_FLOW_CONTROL
356 #define UART7_HW_FLOW_CONTROL FALSE
357 #endif
358 
364 #define UART2_GPIO_PORT_TX PAL_PORT(LINE_UART2_TX)
365 #define UART2_GPIO_TX PAL_PAD(LINE_UART2_TX)
366 #define UART2_GPIO_PORT_RX PAL_PORT(LINE_UART2_RX)
367 #define UART2_GPIO_RX PAL_PAD(LINE_UART2_RX)
368 #define UART2_GPIO_AF AF_UART2_TX
369 
370 #define UART3_GPIO_PORT_TX PAL_PORT(LINE_UART3_TX)
371 #define UART3_GPIO_TX PAL_PAD(LINE_UART3_TX)
372 #define UART3_GPIO_PORT_RX PAL_PORT(LINE_UART3_RX)
373 #define UART3_GPIO_RX PAL_PAD(LINE_UART3_RX)
374 #define UART3_GPIO_AF AF_UART3_TX
375 
380 #define UART8_GPIO_PORT_TX PAL_PORT(LINE_UART8_TX)
381 #define UART8_GPIO_TX PAL_PAD(LINE_UART8_TX)
382 #define UART8_GPIO_PORT_RX PAL_PORT(LINE_UART8_RX)
383 #define UART8_GPIO_RX PAL_PAD(LINE_UART8_RX)
384 #define UART8_GPIO_AF AF_UART8_TX
385 
390 #define USE_UART6_RX TRUE
391 #define USE_UART6_TX FALSE
392 #define UART6_GPIO_PORT_RX PAL_PORT(LINE_RC1)
393 #define UART6_GPIO_RX PAL_PAD(LINE_RC1)
394 #define UART6_GPIO_AF RC1_USART_AF
395 
396 /* The line that is pulled low at power up to initiate the bind process
397  * PB1: AUXb4
398  */
399 #define SPEKTRUM_BIND_PIN PAL_PORT(LINE_XXX)
400 #define SPEKTRUM_BIND_PIN_PORT PAL_PAD(LINE_XXX)
401 
402 // no wait with chibios as the RTC oscillator takes longer to stabilize
403 #define SPEKTRUM_BIND_WAIT 30000
404 
410 #define RC_PPM_TICKS_PER_USEC 6
411 #define PPM_TIMER_FREQUENCY 6000000
412 #define PPM_CHANNEL CONCAT_BOARD_PARAM(ICU_CHANNEL_, RC2_TIM_CH)
413 #define PPM_TIMER CONCAT_BOARD_PARAM(ICUD, RC2_TIM)
414 
415 /*
416  * PWM input
417  */
418 // PWM_INPUT 1
419 #define PWM_INPUT1_ICU ICUD1
420 #define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
421 #define PWM_INPUT1_GPIO_PORT PAL_PORT(LINE_LED_WS2812)
422 #define PWM_INPUT1_GPIO_PIN PAL_PAD(LINE_LED_WS2812)
423 #define PWM_INPUT1_GPIO_AF AF_LED_WS2812
424 
428 // Digital noise filter: 0 disabled, [0x1 - 0xF] enable up to n t_I2CCLK
429 #define STM32_CR1_DNF(n) ((n & 0x0f) << 8)
430 // Timing register
431 #define I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(0U) | \
432  STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(0U) | \
433  STM32_TIMINGR_SCLH(34U) | STM32_TIMINGR_SCLL(86U))
434 #define I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(1U) | \
435  STM32_TIMINGR_SCLDEL(9U) | STM32_TIMINGR_SDADEL(0U) | \
436  STM32_TIMINGR_SCLH(105U) | STM32_TIMINGR_SCLL(153U))
437 
438 
439 #ifndef I2C1_CLOCK_SPEED
440 #define I2C1_CLOCK_SPEED 400000
441 #endif
442 
443 #if I2C1_CLOCK_SPEED == 400000
444 #define I2C1_CFG_DEF { \
445  .timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
446  .cr1 = STM32_CR1_DNF(0), \
447  .cr2 = 0 \
448 }
449 #elif I2C1_CLOCK_SPEED == 100000
450 #define I2C1_CFG_DEF { \
451  .timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
452  .cr1 = STM32_CR1_DNF(0), \
453  .cr2 = 0 \
454 }
455 #else
456 #error "Unknown I2C1 clock speed"
457 #endif
458 
459 #ifndef I2C2_CLOCK_SPEED
460 #define I2C2_CLOCK_SPEED 400000
461 #endif
462 
463 #if I2C2_CLOCK_SPEED == 400000
464 #define I2C2_CFG_DEF { \
465  .timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
466  .cr1 = STM32_CR1_DNF(0), \
467  .cr2 = 0 \
468 }
469 #elif I2C2_CLOCK_SPEED == 100000
470 #define I2C2_CFG_DEF { \
471  .timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
472  .cr1 = STM32_CR1_DNF(0), \
473  .cr2 = 0 \
474 }
475 #else
476 #error "Unknown I2C2 clock speed"
477 #endif
478 
483 // Internal SPI (IMU1)
484 #define SPI3_GPIO_AF AF_SPI3_CLK
485 #define SPI3_GPIO_PORT_MISO PAL_PORT(LINE_SPI3_MISO)
486 #define SPI3_GPIO_MISO PAL_PAD(LINE_SPI3_MISO)
487 #define SPI3_GPIO_PORT_MOSI PAL_PORT(LINE_SPI3_MOSI)
488 #define SPI3_GPIO_MOSI PAL_PAD(LINE_SPI3_MOSI)
489 #define SPI3_GPIO_PORT_SCK PAL_PORT(LINE_SPI3_CLK)
490 #define SPI3_GPIO_SCK PAL_PAD(LINE_SPI3_CLK)
491 
492 // Internal SPI (IMU2)
493 #define SPI1_GPIO_AF AF_SPI1_CLK
494 #define SPI1_GPIO_PORT_MISO PAL_PORT(LINE_SPI1_MISO)
495 #define SPI1_GPIO_MISO PAL_PAD(LINE_SPI1_MISO)
496 #define SPI1_GPIO_PORT_MOSI PAL_PORT(LINE_SPI1_MOSI)
497 #define SPI1_GPIO_MOSI PAL_PAD(LINE_SPI1_MOSI)
498 #define SPI1_GPIO_PORT_SCK PAL_PORT(LINE_SPI1_CLK)
499 #define SPI1_GPIO_SCK PAL_PAD(LINE_SPI1_CLK)
500 
501 // Internal SPI (OSD)
502 #define SPI2_GPIO_AF AF_SPI2_CLK
503 #define SPI2_GPIO_PORT_MISO PAL_PORT(LINE_SPI2_MISO)
504 #define SPI2_GPIO_MISO PAL_PAD(LINE_SPI2_MISO)
505 #define SPI2_GPIO_PORT_MOSI PAL_PORT(LINE_SPI2_MOSI)
506 #define SPI2_GPIO_MOSI PAL_PAD(LINE_SPI2_MOSI)
507 #define SPI2_GPIO_PORT_SCK PAL_PORT(LINE_SPI2_CLK)
508 #define SPI2_GPIO_SCK PAL_PAD(LINE_SPI2_CLK)
509 
510 // External SPI
511 #define SPI4_GPIO_AF AF_SPI4_INTERNAL_CLK
512 #define SPI4_GPIO_PORT_MISO PAL_PORT(LINE_SPI4_INTERNAL_MISO)
513 #define SPI4_GPIO_MISO PAL_PAD(LINE_SPI4_INTERNAL_MISO)
514 #define SPI4_GPIO_PORT_MOSI PAL_PORT(LINE_SPI4_INTERNAL_MOSI)
515 #define SPI4_GPIO_MOSI PAL_PAD(LINE_SPI4_INTERNAL_MOSI)
516 #define SPI4_GPIO_PORT_SCK PAL_PORT(LINE_SPI4_INTERNAL_CLK)
517 #define SPI4_GPIO_SCK PAL_PAD(LINE_SPI4_INTERNAL_CLK)
518 
519 // SLAVE0 on SPI4 connector
520 #define SPI_SELECT_SLAVE0_PORT PAL_PORT(LINE_SPI4_CS)
521 #define SPI_SELECT_SLAVE0_PIN PAL_PAD(LINE_SPI4_CS)
522 // SLAVE1 on S11
523 #define SPI_SELECT_SLAVE1_PORT PAL_PORT(LINE_S11)
524 #define SPI_SELECT_SLAVE1_PIN PAL_PAD(LINE_S11)
525 // SLAVE2 on S12
526 #define SPI_SELECT_SLAVE2_PORT PAL_PORT(LINE_S11)
527 #define SPI_SELECT_SLAVE2_PIN PAL_PAD(LINE_S12)
528 // SLAVE3 on IMU1 (MPU6000)
529 #define SPI_SELECT_SLAVE3_PORT PAL_PORT(LINE_IMU1_CS)
530 #define SPI_SELECT_SLAVE3_PIN PAL_PAD(LINE_IMU1_CS)
531 // SLAVE4 on IMU2 (ICM20602)
532 #define SPI_SELECT_SLAVE4_PORT PAL_PORT(LINE_IMU2_CS)
533 #define SPI_SELECT_SLAVE4_PIN PAL_PAD(LINE_IMU2_CS)
534 // SLAVE5 on OSD
535 #define SPI_SELECT_SLAVE5_PORT PAL_PORT(LINE_OSD_CS)
536 #define SPI_SELECT_SLAVE5_PIN PAL_PAD(LINE_OSD_CS)
537 
544 #ifndef USE_BARO_BOARD
545 #define USE_BARO_BOARD 0
546 #endif
547 
551 #define SDIO_D0_PORT PAL_PORT(LINE_SDMMC1_D0)
552 #define SDIO_D0_PIN PAL_PAD(LINE_SDMMC1_D0)
553 #define SDIO_D1_PORT PAL_PORT(LINE_SDMMC1_D1)
554 #define SDIO_D1_PIN PAL_PAD(LINE_SDMMC1_D1)
555 #define SDIO_D2_PORT PAL_PORT(LINE_SDMMC1_D2)
556 #define SDIO_D2_PIN PAL_PAD(LINE_SDMMC1_D2)
557 #define SDIO_D3_PORT PAL_PORT(LINE_SDMMC1_D3)
558 #define SDIO_D3_PIN PAL_PAD(LINE_SDMMC1_D3)
559 #define SDIO_CK_PORT PAL_PORT(LINE_SDMMC1_CK)
560 #define SDIO_CK_PIN PAL_PAD(LINE_SDMMC1_CK)
561 #define SDIO_CMD_PORT PAL_PORT(LINE_SDMMC1_CMD)
562 #define SDIO_CMD_PIN PAL_PAD(LINE_SDMMC1_CMD)
563 #define SDIO_AF AF_SDMMC1_CK
564 // bat monitoring for file closing
565 #define SDLOG_BAT_ADC CONCAT_BOARD_PARAM(ADCD, VBAT_MEAS_ADC)
566 #define SDLOG_BAT_CHAN CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, VBAT_MEAS_ADC_IN)
567 // usb led status
568 #define SDLOG_USB_LED 2
569 //#define SDLOG_USB_VBUS_PORT PAL_PORT(LINE_USB_VBUS) // FIXME
570 //#define SDLOG_USB_VBUS_PIN PAL_PAD(LINE_USB_VBUS)
571 
572 
573 /*
574  * Actuators for fixedwing
575  */
576  /* Default actuators driver */
577 #define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
578 #define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
579 #define ActuatorsDefaultInit() ActuatorsPwmInit()
580 #define ActuatorsDefaultCommit() ActuatorsPwmCommit()
581 
585 #define WS2812D1_GPIO PAL_PORT(LINE_LED_WS2812)
586 #define WS2812D1_PIN PAL_PAD(LINE_LED_WS2812)
587 #define WS2812D1_AF AF_LED_WS2812
588 #define WS2812D1_CFG_DEF { \
589  .dma_stream = STM32_PWM1_UP_DMA_STREAM, \
590  .dma_channel = STM32_PWM1_UP_DMA_CHANNEL, \
591  .dma_priority = STM32_PWM1_UP_DMA_PRIORITY, \
592  .pwm_channel = 0, \
593  .pwmp = &PWMD1 \
594 }
595 
596 #endif /* CONFIG_MATEK_F765_WING_H */
597