Paparazzi UAS  v6.2_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 defines
106  */
107 
108 #ifndef USE_PWM1
109 #define USE_PWM1 1
110 #endif
111 #if USE_PWM1
112 #define PWM_SERVO_1 1
113 #define PWM_SERVO_1_GPIO PAL_PORT(LINE_S1)
114 #define PWM_SERVO_1_PIN PAL_PAD(LINE_S1)
115 #define PWM_SERVO_1_AF AF_S1
116 #define PWM_SERVO_1_DRIVER CONCAT_BOARD_PARAM(PWMD, S1_TIM)
117 #define PWM_SERVO_1_CHANNEL (S1_TIM_CH-1)
118 #define PWM_SERVO_1_CONF CONCAT_BOARD_PARAM(pwmcfg, S1_TIM)
119 #endif
120 
121 #ifndef USE_PWM2
122 #define USE_PWM2 1
123 #endif
124 #if USE_PWM2
125 #define PWM_SERVO_2 2
126 #define PWM_SERVO_2_GPIO PAL_PORT(LINE_S2)
127 #define PWM_SERVO_2_PIN PAL_PAD(LINE_S2)
128 #define PWM_SERVO_2_AF AF_S2
129 #define PWM_SERVO_2_DRIVER CONCAT_BOARD_PARAM(PWMD, S2_TIM)
130 #define PWM_SERVO_2_CHANNEL (S2_TIM_CH-1)
131 #define PWM_SERVO_2_CONF CONCAT_BOARD_PARAM(pwmcfg, S2_TIM)
132 #endif
133 
134 #ifndef USE_PWM3
135 #define USE_PWM3 1
136 #endif
137 #if USE_PWM3
138 #define PWM_SERVO_3 3
139 #define PWM_SERVO_3_GPIO PAL_PORT(LINE_S3)
140 #define PWM_SERVO_3_PIN PAL_PAD(LINE_S3)
141 #define PWM_SERVO_3_AF AF_S3
142 #define PWM_SERVO_3_DRIVER CONCAT_BOARD_PARAM(PWMD, S3_TIM)
143 #define PWM_SERVO_3_CHANNEL (S3_TIM_CH-1)
144 #define PWM_SERVO_3_CONF CONCAT_BOARD_PARAM(pwmcfg, S3_TIM)
145 #endif
146 
147 #ifndef USE_PWM4
148 #define USE_PWM4 1
149 #endif
150 #if USE_PWM4
151 #define PWM_SERVO_4 4
152 #define PWM_SERVO_4_GPIO PAL_PORT(LINE_S4)
153 #define PWM_SERVO_4_PIN PAL_PAD(LINE_S4)
154 #define PWM_SERVO_4_AF AF_S4
155 #define PWM_SERVO_4_DRIVER CONCAT_BOARD_PARAM(PWMD, S4_TIM)
156 #define PWM_SERVO_4_CHANNEL (S4_TIM_CH-1)
157 #define PWM_SERVO_4_CONF CONCAT_BOARD_PARAM(pwmcfg, S4_TIM)
158 #endif
159 
160 #ifndef USE_PWM5
161 #define USE_PWM5 1
162 #endif
163 #if USE_PWM5
164 #define PWM_SERVO_5 5
165 #define PWM_SERVO_5_GPIO PAL_PORT(LINE_S5)
166 #define PWM_SERVO_5_PIN PAL_PAD(LINE_S5)
167 #define PWM_SERVO_5_AF AF_S5
168 #define PWM_SERVO_5_DRIVER CONCAT_BOARD_PARAM(PWMD, S5_TIM)
169 #define PWM_SERVO_5_CHANNEL (S5_TIM_CH-1)
170 #define PWM_SERVO_5_CONF CONCAT_BOARD_PARAM(pwmcfg, S5_TIM)
171 #endif
172 
173 #ifndef USE_PWM6
174 #define USE_PWM6 1
175 #endif
176 #if USE_PWM6
177 #define PWM_SERVO_6 6
178 #define PWM_SERVO_6_GPIO PAL_PORT(LINE_S6)
179 #define PWM_SERVO_6_PIN PAL_PAD(LINE_S6)
180 #define PWM_SERVO_6_AF AF_S6
181 #define PWM_SERVO_6_DRIVER CONCAT_BOARD_PARAM(PWMD, S6_TIM)
182 #define PWM_SERVO_6_CHANNEL (S6_TIM_CH-1)
183 #define PWM_SERVO_6_CONF CONCAT_BOARD_PARAM(pwmcfg, S6_TIM)
184 #endif
185 
186 #ifndef USE_PWM7
187 #define USE_PWM7 1
188 #endif
189 #if USE_PWM7
190 #define PWM_SERVO_7 7
191 #define PWM_SERVO_7_GPIO PAL_PORT(LINE_S7)
192 #define PWM_SERVO_7_PIN PAL_PAD(LINE_S7)
193 #define PWM_SERVO_7_AF AF_S7
194 #define PWM_SERVO_7_DRIVER CONCAT_BOARD_PARAM(PWMD, S7_TIM)
195 #define PWM_SERVO_7_CHANNEL (S7_TIM_CH-1)
196 #define PWM_SERVO_7_CONF CONCAT_BOARD_PARAM(pwmcfg, S7_TIM)
197 #endif
198 
199 #ifndef USE_PWM8
200 #define USE_PWM8 1
201 #endif
202 #if USE_PWM8
203 #define PWM_SERVO_8 8
204 #define PWM_SERVO_8_GPIO PAL_PORT(LINE_S8)
205 #define PWM_SERVO_8_PIN PAL_PAD(LINE_S8)
206 #define PWM_SERVO_8_AF AF_S8
207 #define PWM_SERVO_8_DRIVER CONCAT_BOARD_PARAM(PWMD, S8_TIM)
208 #define PWM_SERVO_8_CHANNEL (S8_TIM_CH-1)
209 #define PWM_SERVO_8_CONF CONCAT_BOARD_PARAM(pwmcfg, S8_TIM)
210 #endif
211 
212 #ifndef USE_PWM9
213 #define USE_PWM9 1
214 #endif
215 #if USE_PWM9
216 #define PWM_SERVO_9 9
217 #define PWM_SERVO_9_GPIO PAL_PORT(LINE_S9)
218 #define PWM_SERVO_9_PIN PAL_PAD(LINE_S9)
219 #define PWM_SERVO_9_AF AF_S9
220 #define PWM_SERVO_9_DRIVER CONCAT_BOARD_PARAM(PWMD, S9_TIM)
221 #define PWM_SERVO_9_CHANNEL (S9_TIM_CH-1)
222 #define PWM_SERVO_9_CONF CONCAT_BOARD_PARAM(pwmcfg, S9_TIM)
223 #endif
224 
225 #ifndef USE_PWM10
226 #define USE_PWM10 1
227 #endif
228 #if USE_PWM10
229 #define PWM_SERVO_10 10
230 #define PWM_SERVO_10_GPIO PAL_PORT(LINE_S10)
231 #define PWM_SERVO_10_PIN PAL_PAD(LINE_S10)
232 #define PWM_SERVO_10_AF AF_S10
233 #define PWM_SERVO_10_DRIVER CONCAT_BOARD_PARAM(PWMD, S10_TIM)
234 #define PWM_SERVO_10_CHANNEL (S10_TIM_CH-1)
235 #define PWM_SERVO_10_CONF CONCAT_BOARD_PARAM(pwmcfg, S10_TIM)
236 #endif
237 
238 #ifndef USE_PWM11
239 #define USE_PWM11 0
240 #endif
241 #if USE_PWM11
242 #define PWM_SERVO_11 11
243 #define PWM_SERVO_11_GPIO PAL_PORT(LINE_S11)
244 #define PWM_SERVO_11_PIN PAL_PAD(LINE_S11)
245 #define PWM_SERVO_11_AF AF_S11
246 #define PWM_SERVO_11_DRIVER CONCAT_BOARD_PARAM(PWMD, S11_TIM)
247 #define PWM_SERVO_11_CHANNEL (S11_TIM_CH-1)
248 #define PWM_SERVO_11_CONF CONCAT_BOARD_PARAM(pwmcfg, S11_TIM)
249 #endif
250 
251 #ifndef USE_PWM12
252 #define USE_PWM12 0
253 #endif
254 #if USE_PWM12
255 #define PWM_SERVO_12 12
256 #define PWM_SERVO_12_GPIO PAL_PORT(LINE_S12)
257 #define PWM_SERVO_12_PIN PAL_PAD(LINE_S12)
258 #define PWM_SERVO_12_AF AF_12
259 #define PWM_SERVO_12_DRIVER CONCAT_BOARD_PARAM(PWMD, S12_TIM)
260 #define PWM_SERVO_12_CHANNEL (S12_TIM_CH-1)
261 #define PWM_SERVO_12_CONF CONCAT_BOARD_PARAM(pwmcfg, S12_TIM)
262 #endif
263 
264 // servo index starting at 1 + regular servos + aux servos
265 // so NB = 1+10+2
266 #define ACTUATORS_PWM_NB 13
267 
268 
272 #ifndef DSHOT_TELEMETRY_DEV
273 #define DSHOT_TELEMETRY_DEV NULL
274 #endif
275 
276 #ifndef USE_DSHOT_TIM4
277 #define USE_DSHOT_TIM4 1
278 #endif
279 
280 #if USE_DSHOT_TIM4 // Servo 7, 8, 9, 10 on TIM4
281 
282 // Servo B1, B2, B3, B4 on TM4 are primary DSHOT connector
283 #define DSHOT_SERVO_7 1
284 #define DSHOT_SERVO_7_GPIO PAL_PORT(LINE_S7)
285 #define DSHOT_SERVO_7_PIN PAL_PAD(LINE_S7)
286 #define DSHOT_SERVO_7_AF AF_S7
287 #define DSHOT_SERVO_7_DRIVER CONCAT_BOARD_PARAM(DSHOTD, S7_TIM)
288 #define DSHOT_SERVO_7_CHANNEL S7_TIM_CH
289 
290 #define DSHOT_SERVO_8 2
291 #define DSHOT_SERVO_8_GPIO PAL_PORT(LINE_S8)
292 #define DSHOT_SERVO_8_PIN PAL_PAD(LINE_S8)
293 #define DSHOT_SERVO_8_AF AF_S8
294 #define DSHOT_SERVO_8_DRIVER CONCAT_BOARD_PARAM(DSHOTD, S8_TIM)
295 #define DSHOT_SERVO_8_CHANNEL S8_TIM_CH
296 
297 #define DSHOT_SERVO_9 3
298 #define DSHOT_SERVO_9_GPIO PAL_PORT(LINE_S9)
299 #define DSHOT_SERVO_9_PIN PAL_PAD(LINE_S9)
300 #define DSHOT_SERVO_9_AF AF_S9
301 #define DSHOT_SERVO_9_DRIVER CONCAT_BOARD_PARAM(DSHOTD, S9_TIM)
302 #define DSHOT_SERVO_9_CHANNEL S9_TIM_CH
303 
304 #define DSHOT_SERVO_10 4
305 #define DSHOT_SERVO_10_GPIO PAL_PORT(LINE_S10)
306 #define DSHOT_SERVO_10_PIN PAL_PAD(LINE_S10)
307 #define DSHOT_SERVO_10_AF AF_S10
308 #define DSHOT_SERVO_10_DRIVER CONCAT_BOARD_PARAM(DSHOTD, S10_TIM)
309 #define DSHOT_SERVO_10_CHANNEL S10_TIM_CH
310 
311 #define DSHOT_CONF_TIM4 1
312 #define DSHOT_CONF4_DEF { \
313  .dma_stream = STM32_PWM4_UP_DMA_STREAM, \
314  .dma_channel = STM32_PWM4_UP_DMA_CHANNEL, \
315  .pwmp = &PWMD4, \
316  .tlm_sd = DSHOT_TELEMETRY_DEV, \
317  .dma_buf = &dshot4DmaBuffer, \
318  .dcache_memory_in_use = false \
319 }
320 
321 #endif
322 
326 #define UART7_GPIO_PORT_TX PAL_PORT(LINE_UART7_TX)
327 #define UART7_GPIO_TX PAL_PAD(LINE_UART7_TX)
328 #define UART7_GPIO_PORT_RX PAL_PORT(LINE_UART7_RX)
329 #define UART7_GPIO_RX PAL_PAD(LINE_UART7_RX)
330 #define UART7_GPIO_AF AF_UART7_TX
331 #ifndef UART7_HW_FLOW_CONTROL
332 #define UART7_HW_FLOW_CONTROL FALSE
333 #endif
334 
340 #define UART2_GPIO_PORT_TX PAL_PORT(LINE_UART2_TX)
341 #define UART2_GPIO_TX PAL_PAD(LINE_UART2_TX)
342 #define UART2_GPIO_PORT_RX PAL_PORT(LINE_UART2_RX)
343 #define UART2_GPIO_RX PAL_PAD(LINE_UART2_RX)
344 #define UART2_GPIO_AF AF_UART2_TX
345 
346 #define UART3_GPIO_PORT_TX PAL_PORT(LINE_UART3_TX)
347 #define UART3_GPIO_TX PAL_PAD(LINE_UART3_TX)
348 #define UART3_GPIO_PORT_RX PAL_PORT(LINE_UART3_RX)
349 #define UART3_GPIO_RX PAL_PAD(LINE_UART3_RX)
350 #define UART3_GPIO_AF AF_UART3_TX
351 
356 #define UART8_GPIO_PORT_TX PAL_PORT(LINE_UART8_TX)
357 #define UART8_GPIO_TX PAL_PAD(LINE_UART8_TX)
358 #define UART8_GPIO_PORT_RX PAL_PORT(LINE_UART8_RX)
359 #define UART8_GPIO_RX PAL_PAD(LINE_UART8_RX)
360 #define UART8_GPIO_AF AF_UART8_TX
361 
366 #define USE_UART6_RX TRUE
367 #define USE_UART6_TX FALSE
368 #define UART6_GPIO_PORT_RX PAL_PORT(LINE_RC1)
369 #define UART6_GPIO_RX PAL_PAD(LINE_RC1)
370 #define UART6_GPIO_AF RC1_USART_AF
371 
372 /* The line that is pulled low at power up to initiate the bind process
373  * PB1: AUXb4
374  */
375 #define SPEKTRUM_BIND_PIN PAL_PORT(LINE_XXX)
376 #define SPEKTRUM_BIND_PIN_PORT PAL_PAD(LINE_XXX)
377 
378 // no wait with chibios as the RTC oscillator takes longer to stabilize
379 #define SPEKTRUM_BIND_WAIT 30000
380 
386 #define RC_PPM_TICKS_PER_USEC 6
387 #define PPM_TIMER_FREQUENCY 6000000
388 #define PPM_CHANNEL CONCAT_BOARD_PARAM(ICU_CHANNEL_, RC2_TIM_CH)
389 #define PPM_TIMER CONCAT_BOARD_PARAM(ICUD, RC2_TIM)
390 
391 /*
392  * PWM input
393  */
394 // PWM_INPUT 1
395 #define PWM_INPUT1_ICU ICUD1
396 #define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
397 #define PWM_INPUT1_GPIO_PORT PAL_PORT(LINE_LED_WS2812)
398 #define PWM_INPUT1_GPIO_PIN PAL_PAD(LINE_LED_WS2812)
399 #define PWM_INPUT1_GPIO_AF AF_LED_WS2812
400 
404 // Digital noise filter: 0 disabled, [0x1 - 0xF] enable up to n t_I2CCLK
405 #define STM32_CR1_DNF(n) ((n & 0x0f) << 8)
406 // Timing register
407 #define I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(0U) | \
408  STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(0U) | \
409  STM32_TIMINGR_SCLH(34U) | STM32_TIMINGR_SCLL(86U))
410 #define I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(1U) | \
411  STM32_TIMINGR_SCLDEL(9U) | STM32_TIMINGR_SDADEL(0U) | \
412  STM32_TIMINGR_SCLH(105U) | STM32_TIMINGR_SCLL(153U))
413 
414 
415 #ifndef I2C1_CLOCK_SPEED
416 #define I2C1_CLOCK_SPEED 400000
417 #endif
418 
419 #if I2C1_CLOCK_SPEED == 400000
420 #define I2C1_CFG_DEF { \
421  .timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
422  .cr1 = STM32_CR1_DNF(0), \
423  .cr2 = 0 \
424 }
425 #elif I2C1_CLOCK_SPEED == 100000
426 #define I2C1_CFG_DEF { \
427  .timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
428  .cr1 = STM32_CR1_DNF(0), \
429  .cr2 = 0 \
430 }
431 #else
432 #error "Unknown I2C1 clock speed"
433 #endif
434 
435 #ifndef I2C2_CLOCK_SPEED
436 #define I2C2_CLOCK_SPEED 400000
437 #endif
438 
439 #if I2C2_CLOCK_SPEED == 400000
440 #define I2C2_CFG_DEF { \
441  .timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
442  .cr1 = STM32_CR1_DNF(0), \
443  .cr2 = 0 \
444 }
445 #elif I2C2_CLOCK_SPEED == 100000
446 #define I2C2_CFG_DEF { \
447  .timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
448  .cr1 = STM32_CR1_DNF(0), \
449  .cr2 = 0 \
450 }
451 #else
452 #error "Unknown I2C2 clock speed"
453 #endif
454 
459 // Internal SPI (IMU1)
460 #define SPI3_GPIO_AF AF_SPI3_CLK
461 #define SPI3_GPIO_PORT_MISO PAL_PORT(LINE_SPI3_MISO)
462 #define SPI3_GPIO_MISO PAL_PAD(LINE_SPI3_MISO)
463 #define SPI3_GPIO_PORT_MOSI PAL_PORT(LINE_SPI3_MOSI)
464 #define SPI3_GPIO_MOSI PAL_PAD(LINE_SPI3_MOSI)
465 #define SPI3_GPIO_PORT_SCK PAL_PORT(LINE_SPI3_CLK)
466 #define SPI3_GPIO_SCK PAL_PAD(LINE_SPI3_CLK)
467 
468 // Internal SPI (IMU2)
469 #define SPI1_GPIO_AF AF_SPI1_CLK
470 #define SPI1_GPIO_PORT_MISO PAL_PORT(LINE_SPI1_MISO)
471 #define SPI1_GPIO_MISO PAL_PAD(LINE_SPI1_MISO)
472 #define SPI1_GPIO_PORT_MOSI PAL_PORT(LINE_SPI1_MOSI)
473 #define SPI1_GPIO_MOSI PAL_PAD(LINE_SPI1_MOSI)
474 #define SPI1_GPIO_PORT_SCK PAL_PORT(LINE_SPI1_CLK)
475 #define SPI1_GPIO_SCK PAL_PAD(LINE_SPI1_CLK)
476 
477 // Internal SPI (OSD)
478 #define SPI2_GPIO_AF AF_SPI2_CLK
479 #define SPI2_GPIO_PORT_MISO PAL_PORT(LINE_SPI2_MISO)
480 #define SPI2_GPIO_MISO PAL_PAD(LINE_SPI2_MISO)
481 #define SPI2_GPIO_PORT_MOSI PAL_PORT(LINE_SPI2_MOSI)
482 #define SPI2_GPIO_MOSI PAL_PAD(LINE_SPI2_MOSI)
483 #define SPI2_GPIO_PORT_SCK PAL_PORT(LINE_SPI2_CLK)
484 #define SPI2_GPIO_SCK PAL_PAD(LINE_SPI2_CLK)
485 
486 // External SPI
487 #define SPI4_GPIO_AF AF_SPI4_INTERNAL_CLK
488 #define SPI4_GPIO_PORT_MISO PAL_PORT(LINE_SPI4_INTERNAL_MISO)
489 #define SPI4_GPIO_MISO PAL_PAD(LINE_SPI4_INTERNAL_MISO)
490 #define SPI4_GPIO_PORT_MOSI PAL_PORT(LINE_SPI4_INTERNAL_MOSI)
491 #define SPI4_GPIO_MOSI PAL_PAD(LINE_SPI4_INTERNAL_MOSI)
492 #define SPI4_GPIO_PORT_SCK PAL_PORT(LINE_SPI4_INTERNAL_CLK)
493 #define SPI4_GPIO_SCK PAL_PAD(LINE_SPI4_INTERNAL_CLK)
494 
495 // SLAVE0 on SPI4 connector
496 #define SPI_SELECT_SLAVE0_PORT PAL_PORT(LINE_SPI4_CS)
497 #define SPI_SELECT_SLAVE0_PIN PAL_PAD(LINE_SPI4_CS)
498 // SLAVE1 on S11
499 #define SPI_SELECT_SLAVE1_PORT PAL_PORT(LINE_S11)
500 #define SPI_SELECT_SLAVE1_PIN PAL_PAD(LINE_S11)
501 // SLAVE2 on S12
502 #define SPI_SELECT_SLAVE2_PORT PAL_PORT(LINE_S11)
503 #define SPI_SELECT_SLAVE2_PIN PAL_PAD(LINE_S12)
504 // SLAVE3 on IMU1 (MPU6000)
505 #define SPI_SELECT_SLAVE3_PORT PAL_PORT(LINE_IMU1_CS)
506 #define SPI_SELECT_SLAVE3_PIN PAL_PAD(LINE_IMU1_CS)
507 // SLAVE4 on IMU2 (ICM20602)
508 #define SPI_SELECT_SLAVE4_PORT PAL_PORT(LINE_IMU2_CS)
509 #define SPI_SELECT_SLAVE4_PIN PAL_PAD(LINE_IMU2_CS)
510 // SLAVE5 on OSD
511 #define SPI_SELECT_SLAVE5_PORT PAL_PORT(LINE_OSD_CS)
512 #define SPI_SELECT_SLAVE5_PIN PAL_PAD(LINE_OSD_CS)
513 
520 #ifndef USE_BARO_BOARD
521 #define USE_BARO_BOARD 0
522 #endif
523 
527 #define SDIO_D0_PORT PAL_PORT(LINE_SDMMC1_D0)
528 #define SDIO_D0_PIN PAL_PAD(LINE_SDMMC1_D0)
529 #define SDIO_D1_PORT PAL_PORT(LINE_SDMMC1_D1)
530 #define SDIO_D1_PIN PAL_PAD(LINE_SDMMC1_D1)
531 #define SDIO_D2_PORT PAL_PORT(LINE_SDMMC1_D2)
532 #define SDIO_D2_PIN PAL_PAD(LINE_SDMMC1_D2)
533 #define SDIO_D3_PORT PAL_PORT(LINE_SDMMC1_D3)
534 #define SDIO_D3_PIN PAL_PAD(LINE_SDMMC1_D3)
535 #define SDIO_CK_PORT PAL_PORT(LINE_SDMMC1_CK)
536 #define SDIO_CK_PIN PAL_PAD(LINE_SDMMC1_CK)
537 #define SDIO_CMD_PORT PAL_PORT(LINE_SDMMC1_CMD)
538 #define SDIO_CMD_PIN PAL_PAD(LINE_SDMMC1_CMD)
539 #define SDIO_AF AF_SDMMC1_CK
540 // bat monitoring for file closing
541 #define SDLOG_BAT_ADC CONCAT_BOARD_PARAM(ADCD, VBAT_MEAS_ADC)
542 #define SDLOG_BAT_CHAN CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, VBAT_MEAS_ADC_IN)
543 // usb led status
544 #define SDLOG_USB_LED 2
545 //#define SDLOG_USB_VBUS_PORT PAL_PORT(LINE_USB_VBUS) // FIXME
546 //#define SDLOG_USB_VBUS_PIN PAL_PAD(LINE_USB_VBUS)
547 
548 
549 /*
550  * Actuators for fixedwing
551  */
552  /* Default actuators driver */
553 #define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
554 #define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
555 #define ActuatorsDefaultInit() ActuatorsPwmInit()
556 #define ActuatorsDefaultCommit() ActuatorsPwmCommit()
557 
561 #define WS2812D1_GPIO PAL_PORT(LINE_LED_WS2812)
562 #define WS2812D1_PIN PAL_PAD(LINE_LED_WS2812)
563 #define WS2812D1_AF AF_LED_WS2812
564 #define WS2812D1_CFG_DEF { \
565  .dma_stream = STM32_PWM1_UP_DMA_STREAM, \
566  .dma_channel = STM32_PWM1_UP_DMA_CHANNEL, \
567  .dma_priority = STM32_PWM1_UP_DMA_PRIORITY, \
568  .pwm_channel = 0, \
569  .pwmp = &PWMD1 \
570 }
571 
572 #endif /* CONFIG_MATEK_F765_WING_H */
573 
board.h