-
Notifications
You must be signed in to change notification settings - Fork 0
/
board_7_0.h
640 lines (565 loc) · 23 KB
/
board_7_0.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
/*
This file is part of AutoQuad.
AutoQuad is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
AutoQuad is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with AutoQuad. If not, see <http://www.gnu.org/licenses/>.
Copyright © 2011-2014 Bill Nesbitt
*/
#ifndef _board_h
#define _board_h
#define SDIO_DMA DMA2
#define SDIO_DMA_STREAM DMA2_Stream3
#define SDIO_DMA_CHANNEL DMA_Channel_4
#define SDIO_DMA_FLAG_FEIF DMA_FLAG_FEIF3
#define SDIO_DMA_FLAG_DMEIF DMA_FLAG_DMEIF3
#define SDIO_DMA_FLAG_TEIF DMA_FLAG_TEIF3
#define SDIO_DMA_FLAG_HTIF DMA_FLAG_HTIF3
#define SDIO_DMA_FLAG_TCIF DMA_FLAG_TCIF3
#define SDIO_DMA_IRQHANDLER DMA2_Stream3_IRQHandler
#define SDIO_DMA_IRQn DMA2_Stream3_IRQn
#define SDIO_POWER_PORT GPIOC
#define SDIO_POWER_PIN GPIO_Pin_5
#define SDIO_DETECT_GPIO_PORT GPIOB
#define SDIO_DETECT_PIN GPIO_Pin_1
#define SDIO_DETECT_PORT_SOURCE EXTI_PortSourceGPIOB
#define SDIO_DETECT_PIN_SOURCE EXTI_PinSource1
#define SDIO_DETECT_IRQ EXTI1_IRQn
#define SDIO_DETECT_HANDLER EXTI1_IRQHandler
#define SDIO_DETECT_EXTI_LINE EXTI_Line1
#define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x00) // SDIO Data Transfer Frequency (24MHz max)
//#define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x02) // SDIO Data Transfer Frequency (12MHz max)
//#define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x04) // SDIO Data Transfer Frequency (6MHz max)
//#define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x08) // SDIO Data Transfer Frequency (3MHz max)
//#define SDIO_TRANSFER_CLK_DIV ((uint8_t)0x10) // SDIO Data Transfer Frequency (1.5MHz max)
enum pwmPorts {
PWM_1 = 0,
PWM_2,
PWM_3,
PWM_4,
PWM_5,
PWM_6,
PWM_7,
PWM_8,
PWM_9,
PWM_NUM_PORTS
};
#define PPM_PWM_CHANNEL 8 // which PWM channel to use for PPM capture
#define PWM_TIMERS const TIM_TypeDef *pwmTimers[] = { \
TIM1, \
TIM1, \
TIM1, \
TIM1, \
TIM4, \
TIM4, \
TIM9, \
TIM9, \
TIM11 \
};
#define PWM_AFS const uint8_t pwmAFs[] = { \
GPIO_AF_TIM1, \
GPIO_AF_TIM1, \
GPIO_AF_TIM1, \
GPIO_AF_TIM1, \
GPIO_AF_TIM4, \
GPIO_AF_TIM4, \
GPIO_AF_TIM9, \
GPIO_AF_TIM9, \
GPIO_AF_TIM11 \
};
#define PWM_PORTS const GPIO_TypeDef *pwmPorts[] = { \
GPIOE, \
GPIOE, \
GPIOE, \
GPIOE, \
GPIOD, \
GPIOD, \
GPIOE, \
GPIOE, \
GPIOB \
};
#define PWM_PINS const uint32_t pwmPins[] = { \
GPIO_Pin_9, \
GPIO_Pin_11, \
GPIO_Pin_13, \
GPIO_Pin_14, \
GPIO_Pin_15, \
GPIO_Pin_14, \
GPIO_Pin_5, \
GPIO_Pin_6, \
GPIO_Pin_9 \
};
#define PWM_PINSOURCES const uint16_t pwmPinSources[] = { \
GPIO_PinSource9, \
GPIO_PinSource11, \
GPIO_PinSource13, \
GPIO_PinSource14, \
GPIO_PinSource15, \
GPIO_PinSource14, \
GPIO_PinSource5, \
GPIO_PinSource6, \
GPIO_PinSource9 \
};
#define PWM_TIMERCHANNELS const uint8_t pwmTimerChannels[] = { \
TIM_Channel_1, \
TIM_Channel_2, \
TIM_Channel_3, \
TIM_Channel_4, \
TIM_Channel_4, \
TIM_Channel_3, \
TIM_Channel_1, \
TIM_Channel_2, \
TIM_Channel_1 \
};
#define PWM_BDTRS const uint8_t pwmBDTRs[] = { \
1, \
1, \
1, \
1, \
0, \
0, \
0, \
0, \
0 \
};
#define PWM_CLOCKS const uint32_t pwmClocks[] = { \
168000000, \
168000000, \
168000000, \
168000000, \
84000000, \
84000000, \
168000000, \
168000000, \
168000000 \
};
#define PWM_IC_IRQS const uint8_t pwmIcIrqChannels[] = { \
TIM1_CC_IRQn, \
TIM1_CC_IRQn, \
TIM1_CC_IRQn, \
TIM1_CC_IRQn, \
TIM4_IRQn, \
TIM4_IRQn, \
TIM1_BRK_TIM9_IRQn, \
TIM1_BRK_TIM9_IRQn, \
TIM1_TRG_COM_TIM11_IRQn \
};
#define PWM_IRQ_TIM1_CH1 0
#define PWM_IRQ_TIM1_CH2 1
#define PWM_IRQ_TIM1_CH3 2
#define PWM_IRQ_TIM1_CH4 3
#define PWM_IRQ_TIM4_CH4 4
#define PWM_IRQ_TIM4_CH3 5
#define PWM_IRQ_TIM9_CH1 6
#define PWM_IRQ_TIM9_CH2 7
#define PWM_IRQ_TIM11_CH1 8
#define RC1_UART UART4
#define RC2_UART UART7
#define SUPERVISOR_READY_PORT GPIOA
#define SUPERVISOR_READY_PIN GPIO_Pin_8
#define SUPERVISOR_DEBUG_PORT GPIOD
#define SUPERVISOR_DEBUG_PIN GPIO_Pin_3
#define GPS_USART USART2
#define GPS_LED_PORT GPIOD
#define GPS_LED_PIN GPIO_Pin_4
#define GPS_TP_PORT GPIOA
#define GPS_TP_PIN GPIO_Pin_0
#define GPS_TP_PORT_SOURCE EXTI_PortSourceGPIOA
#define GPS_TP_PIN_SOURCE EXTI_PinSource0
#define GPS_TP_IRQ EXTI0_IRQn
#define GPS_TP_HANDLER EXTI0_IRQHandler
#define GPS_TP_EXTI_LINE EXTI_Line0
#define ADC_DMA_STREAM DMA2_Stream4
#define ADC_DMA_CHANNEL DMA_Channel_0
#define ADC_DMA_FLAGS (DMA_IT_TEIF4 | DMA_IT_DMEIF4 | DMA_IT_FEIF4 | DMA_IT_TCIF4 | DMA_IT_HTIF4)
#define ADC_DMA_TC_FLAG DMA_IT_TCIF4
#define ADC_DMA_ISR DMA2->HISR
#define ADC_DMA_CR DMA2->HIFCR
#define ADC_DMA_IRQ DMA2_Stream4_IRQn
#define ADC_DMA_HANDLER DMA2_Stream4_IRQHandler
#define CANx CAN1
#define CAN_CLK RCC_APB1Periph_CAN1
#define CAN_RX_PIN GPIO_Pin_0
#define CAN_TX_PIN GPIO_Pin_1
#define CAN_GPIO_PORT GPIOD
#define CAN_AF_PORT GPIO_AF_CAN1
#define CAN_RX_SOURCE GPIO_PinSource0
#define CAN_TX_SOURCE GPIO_PinSource1
#define CAN_RX0_IRQ CAN1_RX0_IRQn
#define CAN_RX0_HANDLER CAN1_RX0_IRQHandler
#define CAN_TX_IRQ CAN1_TX_IRQn
#define CAN_TX_HANDLER CAN1_TX_IRQHandler
#define SPI_SPI1_CLOCK RCC_APB2Periph_SPI1
#define SPI_SPI1_AF GPIO_AF_SPI1
#define SPI_SPI1_SCK_PORT GPIOA
#define SPI_SPI1_MISO_PORT GPIOA
#define SPI_SPI1_MOSI_PORT GPIOA
#define SPI_SPI1_SCK_PIN GPIO_Pin_5
#define SPI_SPI1_MISO_PIN GPIO_Pin_6
#define SPI_SPI1_MOSI_PIN GPIO_Pin_7
#define SPI_SPI1_SCK_SOURCE GPIO_PinSource5
#define SPI_SPI1_MISO_SOURCE GPIO_PinSource6
#define SPI_SPI1_MOSI_SOURCE GPIO_PinSource7
#define SPI_SPI1_DMA_RX DMA2_Stream0
#define SPI_SPI1_DMA_RX_CHANNEL DMA_Channel_3
#define SPI_SPI1_DMA_RX_FLAGS (DMA_IT_TEIF0 | DMA_IT_DMEIF0 | DMA_IT_FEIF0 | DMA_IT_TCIF0 | DMA_IT_HTIF0)
#define SPI_SPI1_DMA_RX_IRQ DMA2_Stream0_IRQn
#define SPI_SPI1_DMA_RX_HANDLER DMA2_Stream0_IRQHandler
#define SPI_SPI1_DMA_TX DMA2_Stream5
#define SPI_SPI1_DMA_TX_CHANNEL DMA_Channel_3
#define SPI_SPI1_DMA_TX_FLAGS (DMA_IT_TEIF5 | DMA_IT_DMEIF5 | DMA_IT_FEIF5 | DMA_IT_TCIF5 | DMA_IT_HTIF5)
//#define SPI_SPI2_CLOCK RCC_APB1Periph_SPI2
//#define SPI_SPI2_AF GPIO_AF_SPI2
//#define SPI_SPI2_SCK_PORT GPIOB
//#define SPI_SPI2_MISO_PORT GPIOB
//#define SPI_SPI2_MOSI_PORT GPIOB
//#define SPI_SPI2_SCK_PIN GPIO_Pin_13
//#define SPI_SPI2_MISO_PIN GPIO_Pin_14
//#define SPI_SPI2_MOSI_PIN GPIO_Pin_15
//#define SPI_SPI2_SCK_SOURCE GPIO_PinSource13
//#define SPI_SPI2_MISO_SOURCE GPIO_PinSource14
//#define SPI_SPI2_MOSI_SOURCE GPIO_PinSource15
//
//#define SPI_SPI2_DMA_RX DMA1_Stream3
//#define SPI_SPI2_DMA_RX_CHANNEL DMA_Channel_0
//#define SPI_SPI2_DMA_RX_FLAGS (DMA_IT_TEIF3 | DMA_IT_DMEIF3 | DMA_IT_FEIF3 | DMA_IT_TCIF3 | DMA_IT_HTIF3)
//#define SPI_SPI2_DMA_RX_IRQ DMA1_Stream3_IRQn
//#define SPI_SPI2_DMA_RX_HANDLER DMA1_Stream3_IRQHandler
//
//#define SPI_SPI2_DMA_TX DMA1_Stream4
//#define SPI_SPI2_DMA_TX_CHANNEL DMA_Channel_0
//#define SPI_SPI2_DMA_TX_FLAGS (DMA_IT_TEIF4 | DMA_IT_DMEIF4 | DMA_IT_FEIF4 | DMA_IT_TCIF4 | DMA_IT_HTIF4)
#define HAS_DIGITAL_IMU
#define USE_DIGITAL_IMU
#define DIMU_HAVE_EEPROM
#define DIMU_HAVE_MPU6000
#define DIMU_HAVE_HMC5983
#define DIMU_HAVE_MS5611
#define MPU6000_ACC_SCALE 8 // g (2, 4, 8, 16)
#define MPU6000_GYO_SCALE 1000 // deg/s (250, 500, 1000, 2000)
#define DIMU_ORIENT_ACC_X (+in[0])
#define DIMU_ORIENT_ACC_Y (+in[1])
#define DIMU_ORIENT_ACC_Z (+in[2])
#define DIMU_ORIENT_GYO_X (-in[0])
#define DIMU_ORIENT_GYO_Y (-in[1])
#define DIMU_ORIENT_GYO_Z (+in[2])
#define DIMU_ORIENT_MAG_X (-in[0])
#define DIMU_ORIENT_MAG_Y (-in[1])
#define DIMU_ORIENT_MAG_Z (+in[2])
#define DIMU_EEPROM_SPI SPI1
#define DIMU_EEPROM_CS_PORT GPIOD
#define DIMU_EEPROM_CS_PIN GPIO_Pin_7
#define DIMU_HMC5983_SPI SPI1
#define DIMU_HMC5983_CS_PORT GPIOE
#define DIMU_HMC5983_CS_PIN GPIO_Pin_7
#define DIMU_HMC5983_INT_PORT GPIOE
#define DIMU_HMC5983_INT_PIN GPIO_Pin_3
#define DIMU_HMC5983_INT_EXTI_PORT EXTI_PortSourceGPIOE
#define DIMU_HMC5983_INT_EXTI_PIN EXTI_PinSource3
#define DIMU_HMC5983_INT_EXTI_LINE EXTI_Line3
#define DIMU_HMC5983_INT_EXTI_IRQ EXTI3_IRQn
#define DIMU_HMC5983_INT_ISR EXTI3_IRQHandler
#define DIMU_MS5611_SPI SPI1
#define DIMU_MS5611_CS_PORT GPIOD
#define DIMU_MS5611_CS_PIN GPIO_Pin_13
#define DIMU_MPU6000_SPI SPI1
#define DIMU_MPU6000_CS_PORT GPIOC
#define DIMU_MPU6000_CS_PIN GPIO_Pin_15
#define DIMU_MPU6000_INT_PORT GPIOE
#define DIMU_MPU6000_INT_PIN GPIO_Pin_2
#define DIMU_MPU6000_INT_EXTI_PORT EXTI_PortSourceGPIOE
#define DIMU_MPU6000_INT_EXTI_PIN EXTI_PinSource2
#define DIMU_MPU6000_INT_EXTI_LINE EXTI_Line2
#define DIMU_MPU6000_INT_EXTI_IRQ EXTI2_IRQn
#define DIMU_MPU6000_INT_ISR EXTI2_IRQHandler
#define COMM_PORT1 USART1 // front FTDI interface
//#define COMM_PORT2 USART8 // expansion header
#define COMM_PORT3 USART3 // USB interface
#define COMM_PORT4 USART6 // OMAP interface
#define SERIAL_UART1_PORT GPIOA
#define SERIAL_UART1_RX_PIN GPIO_Pin_10
#define SERIAL_UART1_TX_PIN GPIO_Pin_9
#define SERIAL_UART1_CTS_PIN GPIO_Pin_11
#define SERIAL_UART1_RTS_PIN GPIO_Pin_12
#define SERIAL_UART1_RX_SOURCE GPIO_PinSource10
#define SERIAL_UART1_TX_SOURCE GPIO_PinSource9
#define SERIAL_UART1_CTS_SOURCE GPIO_PinSource11
#define SERIAL_UART1_RTS_SOURCE GPIO_PinSource12
#define SERIAL_UART1_RX_DMA_ST DMA2_Stream2
#define SERIAL_UART1_TX_DMA_ST DMA2_Stream7
#define SERIAL_UART1_RX_DMA_CH DMA_Channel_4
#define SERIAL_UART1_TX_DMA_CH DMA_Channel_4
#define SERIAL_UART1_TX_DMA_IT DMA2_Stream7_IRQHandler
#define SERIAL_UART1_TX_IRQn DMA2_Stream7_IRQn
#define SERIAL_UART1_RX_TC_FLAG DMA_FLAG_TCIF2
#define SERIAL_UART1_RX_HT_FLAG DMA_FLAG_HTIF2
#define SERIAL_UART1_RX_TE_FLAG DMA_FLAG_TEIF2
#define SERIAL_UART1_RX_DM_FLAG DMA_FLAG_DMEIF2
#define SERIAL_UART1_RX_FE_FLAG DMA_FLAG_FEIF2
#define SERIAL_UART1_TX_TC_FLAG DMA_FLAG_TCIF7
#define SERIAL_UART1_TX_HT_FLAG DMA_FLAG_HTIF7
#define SERIAL_UART1_TX_TE_FLAG DMA_FLAG_TEIF7
#define SERIAL_UART1_TX_DM_FLAG DMA_FLAG_DMEIF7
#define SERIAL_UART1_TX_FE_FLAG DMA_FLAG_FEIF7
#define SERIAL_UART2_PORT GPIOD
#define SERIAL_UART2_RX_PIN GPIO_Pin_6
#define SERIAL_UART2_TX_PIN GPIO_Pin_5
#define SERIAL_UART2_CTS_PIN GPIO_Pin_3
#define SERIAL_UART2_RTS_PIN GPIO_Pin_4
#define SERIAL_UART2_RX_SOURCE GPIO_PinSource6
#define SERIAL_UART2_TX_SOURCE GPIO_PinSource5
#define SERIAL_UART2_CTS_SOURCE GPIO_PinSource3
#define SERIAL_UART2_RTS_SOURCE GPIO_PinSource4
#define SERIAL_UART2_RX_DMA_ST DMA1_Stream5
#define SERIAL_UART2_TX_DMA_ST DMA1_Stream6
#define SERIAL_UART2_RX_DMA_CH DMA_Channel_4
#define SERIAL_UART2_TX_DMA_CH DMA_Channel_4
#define SERIAL_UART2_TX_DMA_IT DMA1_Stream6_IRQHandler
#define SERIAL_UART2_TX_IRQn DMA1_Stream6_IRQn
#define SERIAL_UART2_RX_TC_FLAG DMA_FLAG_TCIF5
#define SERIAL_UART2_RX_HT_FLAG DMA_FLAG_HTIF5
#define SERIAL_UART2_RX_TE_FLAG DMA_FLAG_TEIF5
#define SERIAL_UART2_RX_DM_FLAG DMA_FLAG_DMEIF5
#define SERIAL_UART2_RX_FE_FLAG DMA_FLAG_FEIF5
#define SERIAL_UART2_TX_TC_FLAG DMA_FLAG_TCIF6
#define SERIAL_UART2_TX_HT_FLAG DMA_FLAG_HTIF6
#define SERIAL_UART2_TX_TE_FLAG DMA_FLAG_TEIF6
#define SERIAL_UART2_TX_DM_FLAG DMA_FLAG_DMEIF6
#define SERIAL_UART2_TX_FE_FLAG DMA_FLAG_FEIF6
#define SERIAL_UART3_PORT GPIOD
#define SERIAL_UART3_RX_PIN GPIO_Pin_9
#define SERIAL_UART3_TX_PIN GPIO_Pin_8
#define SERIAL_UART3_CTS_PIN GPIO_Pin_11
#define SERIAL_UART3_RTS_PIN GPIO_Pin_12
#define SERIAL_UART3_RX_SOURCE GPIO_PinSource9
#define SERIAL_UART3_TX_SOURCE GPIO_PinSource8
#define SERIAL_UART3_CTS_SOURCE GPIO_PinSource11
#define SERIAL_UART3_RTS_SOURCE GPIO_PinSource12
#define SERIAL_UART3_RX_DMA_ST DMA1_Stream1
#define SERIAL_UART3_TX_DMA_ST DMA1_Stream4
#define SERIAL_UART3_RX_DMA_CH DMA_Channel_4
#define SERIAL_UART3_TX_DMA_CH DMA_Channel_7
#define SERIAL_UART3_TX_DMA_IT DMA1_Stream4_IRQHandler
#define SERIAL_UART3_TX_IRQn DMA1_Stream4_IRQn
#define SERIAL_UART3_RX_TC_FLAG DMA_FLAG_TCIF1
#define SERIAL_UART3_RX_HT_FLAG DMA_FLAG_HTIF1
#define SERIAL_UART3_RX_TE_FLAG DMA_FLAG_TEIF1
#define SERIAL_UART3_RX_DM_FLAG DMA_FLAG_DMEIF1
#define SERIAL_UART3_RX_FE_FLAG DMA_FLAG_FEIF1
#define SERIAL_UART3_TX_TC_FLAG DMA_FLAG_TCIF4
#define SERIAL_UART3_TX_HT_FLAG DMA_FLAG_HTIF4
#define SERIAL_UART3_TX_TE_FLAG DMA_FLAG_TEIF4
#define SERIAL_UART3_TX_DM_FLAG DMA_FLAG_DMEIF4
#define SERIAL_UART3_TX_FE_FLAG DMA_FLAG_FEIF4
#define SERIAL_UART4_PORT GPIOA
#define SERIAL_UART4_RX_PIN GPIO_Pin_1
//#define SERIAL_UART4_TX_PIN GPIO_Pin_0
#define SERIAL_UART4_RX_SOURCE GPIO_PinSource1
//#define SERIAL_UART4_TX_SOURCE GPIO_PinSource0
#define SERIAL_UART4_RX_DMA_ST DMA1_Stream2
//#define SERIAL_UART4_TX_DMA_ST
#define SERIAL_UART4_RX_DMA_CH DMA_Channel_4
//#define SERIAL_UART4_TX_DMA_CH
//#define SERIAL_UART4_TX_DMA_IT
//#define SERIAL_UART4_TX_IRQn
#define SERIAL_UART4_RX_TC_FLAG DMA_FLAG_TCIF2
#define SERIAL_UART4_RX_HT_FLAG DMA_FLAG_HTIF2
#define SERIAL_UART4_RX_TE_FLAG DMA_FLAG_TEIF2
#define SERIAL_UART4_RX_DM_FLAG DMA_FLAG_DMEIF2
#define SERIAL_UART4_RX_FE_FLAG DMA_FLAG_FEIF2
//#define SERIAL_UART4_TX_TC_FLAG
//#define SERIAL_UART4_TX_HT_FLAG
//#define SERIAL_UART4_TX_TE_FLAG
//#define SERIAL_UART4_TX_DM_FLAG
//#define SERIAL_UART4_TX_FE_FLAG
//#define SERIAL_UART5_PORT GPIOD
//#define SERIAL_UART5_TX_PIN GPIO_Pin_10
//#define SERIAL_UART5_RX_PIN GPIO_Pin_2
//#define SERIAL_UART5_TX_SOURCE GPIO_PinSource10
//#define SERIAL_UART5_RX_SOURCE GPIO_PinSource2
//#define SERIAL_UART5_RX_DMA_ST DMA1_Stream0
//#define SERIAL_UART5_TX_DMA_ST DMA1_Stream7
//#define SERIAL_UART5_RX_DMA_CH DMA_Channel_4
//#define SERIAL_UART5_TX_DMA_CH DMA_Channel_4
//#define SERIAL_UART5_TX_DMA_IT DMA1_Stream7_IRQHandler
//#define SERIAL_UART5_TX_IRQn DMA1_Stream7_IRQn
//#define SERIAL_UART5_RX_TC_FLAG DMA_FLAG_TCIF0
//#define SERIAL_UART5_RX_HT_FLAG DMA_FLAG_HTIF0
//#define SERIAL_UART5_RX_TE_FLAG DMA_FLAG_TEIF0
//#define SERIAL_UART5_RX_DM_FLAG DMA_FLAG_DMEIF0
//#define SERIAL_UART5_RX_FE_FLAG DMA_FLAG_FEIF0
//#define SERIAL_UART5_TX_TC_FLAG DMA_FLAG_TCIF7
//#define SERIAL_UART5_TX_HT_FLAG DMA_FLAG_HTIF7
//#define SERIAL_UART5_TX_TE_FLAG DMA_FLAG_TEIF7
//#define SERIAL_UART5_TX_DM_FLAG DMA_FLAG_DMEIF7
//#define SERIAL_UART5_TX_FE_FLAG DMA_FLAG_FEIF7
#define SERIAL_UART6_PORT GPIOC
#define SERIAL_UART6_RX_PIN GPIO_Pin_7
#define SERIAL_UART6_TX_PIN GPIO_Pin_6
//#define SERIAL_UART6_CTS_PIN GPIO_Pin_11
//#define SERIAL_UART6_RTS_PIN GPIO_Pin_12
#define SERIAL_UART6_RX_SOURCE GPIO_PinSource7
#define SERIAL_UART6_TX_SOURCE GPIO_PinSource6
//#define SERIAL_UART6_CTS_SOURCE GPIO_PinSource11
//#define SERIAL_UART6_RTS_SOURCE GPIO_PinSource12
#define SERIAL_UART6_RX_DMA_ST DMA2_Stream1
#define SERIAL_UART6_TX_DMA_ST DMA2_Stream6
#define SERIAL_UART6_RX_DMA_CH DMA_Channel_5
#define SERIAL_UART6_TX_DMA_CH DMA_Channel_5
#define SERIAL_UART6_TX_DMA_IT DMA2_Stream6_IRQHandler
#define SERIAL_UART6_TX_IRQn DMA2_Stream6_IRQn
#define SERIAL_UART6_RX_TC_FLAG DMA_FLAG_TCIF1
#define SERIAL_UART6_RX_HT_FLAG DMA_FLAG_HTIF1
#define SERIAL_UART6_RX_TE_FLAG DMA_FLAG_TEIF1
#define SERIAL_UART6_RX_DM_FLAG DMA_FLAG_DMEIF1
#define SERIAL_UART6_RX_FE_FLAG DMA_FLAG_FEIF1
#define SERIAL_UART6_TX_TC_FLAG DMA_FLAG_TCIF6
#define SERIAL_UART6_TX_HT_FLAG DMA_FLAG_HTIF6
#define SERIAL_UART6_TX_TE_FLAG DMA_FLAG_TEIF6
#define SERIAL_UART6_TX_DM_FLAG DMA_FLAG_DMEIF6
#define SERIAL_UART6_TX_FE_FLAG DMA_FLAG_FEIF6
#define RADIO_RC1_SELECT_PORT GPIOC
#define RADIO_RC1_SELECT_PIN GPIO_Pin_14
#define RADIO_RC2_SELECT_PORT GPIOD
#define RADIO_RC2_SELECT_PIN GPIO_Pin_10
#define DAC_TP_PORT GPIOA
#define DAC_TP_PIN GPIO_Pin_4
#define ANALOG_REF_VOLTAGE 3.3f
#define ANALOG_CHANNEL_EXT_VOLT ADC_Channel_10
#define ANALOG_CHANNEL_EXT_AMP ADC_Channel_11
#define ANALOG_CHANNEL_VIN ADC_Channel_12
#define ANALOG_CHANNEL_SPARE4 ADC_Channel_13
#define ANALOG_CHANNEL_SPARE5 ADC_Channel_2
#define ANALOG_CHANNEL_SPARE6 ADC_Channel_3
#define ANALOG_CHANNEL_SPARE7 ADC_Channel_14
#define ANALOG_VIN_RTOP 10.0f
#define ANALOG_VIN_RBOT 1.0f
#define ANALOG_EXT_VOLT_RTOP 140.0f
#define ANALOG_EXT_VOLT_RBOT 10.0f
#define ANALOG_EXT_AMP_RTOP 1.0f
#define ANALOG_EXT_AMP_RBOT 1.2f
#define ANALOG_DMA_STREAM DMA2_Stream4
#define ANALOG_DMA_CHANNEL DMA_Channel_0
#define ANALOG_DMA_FLAGS (DMA_IT_TEIF4 | DMA_IT_DMEIF4 | DMA_IT_FEIF4 | DMA_IT_TCIF4 | DMA_IT_HTIF4)
#define ANALOG_DMA_TC_FLAG DMA_IT_TCIF4
#define ANALOG_DMA_ISR DMA2->HISR
#define ANALOG_DMA_IRQ DMA2_Stream4_IRQn
#define ANALOG_DMA_HANDLER DMA2_Stream4_IRQHandler
#define EEPROM_CS_PORT GPIOE
#define EEPROM_CS_PIN GPIO_Pin_12
#define UKF_VEL_Q +3.2545e-02 // +0.032544903471 0.000000350530 +0.000037342305
#define UKF_VEL_ALT_Q +1.4483e-01 // +0.144827254833 0.000000347510 -0.000055111229
#define UKF_POS_Q +7.1562e+03 // +7156.240473309331 0.000000352142 +2.727925965284749
#define UKF_POS_ALT_Q +5.3884e+03 // +5388.369673129109 0.000000351319 -6.187843541372100
#define UKF_ACC_BIAS_Q +1.3317e-03 // +0.001331748045 0.000000359470 +0.000000039113
#define UKF_GYO_BIAS_Q +4.5256e-02 // +0.045255679186 0.000000349060 +0.000045999290
#define UKF_QUAT_Q +5.4005e-04 // +0.000540045060 0.000000353882 +0.000000029711
#define UKF_PRES_ALT_Q +6.3105e+01 // +63.104671424320 0.000000353790 +0.0166164673283
#define UKF_ACC_BIAS_V +7.8673e-07 // +0.000000786725 0.000000345847 -0.000000000977
#define UKF_GYO_BIAS_V +4.0297e-09 // +0.000000004030 0.000000359017 +0.000000000000
#define UKF_RATE_V +1.7538e-05 // +0.000017538388 0.000000358096 +0.000000000397
#define UKF_VEL_V +2.8605e-07 // +0.000000286054 0.000000351709 +0.000000000183
#define UKF_ALT_VEL_V +6.8304e-08 // +0.000000068304 0.000000362348 -0.000000000050
#define UKF_GPS_POS_N +8.0703e-06 // +0.000008070349 0.000000353490 +0.000000005602
#define UKF_GPS_POS_M_N +3.0245e-05 // +0.000030245341 0.000000345021 -0.000000008396
#define UKF_GPS_ALT_N +1.1796e-05 // +0.000011795879 0.000000356036 -0.000000010027
#define UKF_GPS_ALT_M_N +3.8329e-05 // +0.000038328879 0.000000346581 +0.000000027268
#define UKF_GPS_VEL_N +1.7640e-01 // +0.176404763511 0.000000355574 -0.000094105688
#define UKF_GPS_VEL_M_N +3.0138e-02 // +0.030138272888 0.000000343584 -0.000002668997
#define UKF_GPS_VD_N +4.6379e+00 // +4.637855992835 0.000000358079 +0.000310962082
#define UKF_GPS_VD_M_N +1.3127e-02 // +0.013127146795 0.000000347978 -0.000001550944
#define UKF_ALT_N +9.5913e-02 // +0.095913477777 0.000000356359 -0.000049781087
#define UKF_ACC_N +6.3287e-05 // +0.000063286884 0.000000342761 -0.000000022717
#define UKF_DIST_N +9.7373e-03 // +0.009737270392 0.000000356147 +0.000009059372
#define UKF_MAG_N +5.2355e-01 // +0.523549973965 0.000000500000 +0.000000000000
#define UKF_POS_DELAY +2.1923e+03 // +2192.300048828125 0.000000500000 +0.000000000000125
#define UKF_VEL_DELAY -1.0182e+05 // -101820.000000000000 0.000000500000 +0.00000000000000000
#define MOTORS_PWM_FREQ 400 // Hz
#define DEFAULT_IMU_ACC_BIAS_X 0.0
#define DEFAULT_IMU_ACC_BIAS_Y 0.0
#define DEFAULT_IMU_ACC_BIAS_Z 0.0
#define DEFAULT_IMU_ACC_BIAS1_X 0.0
#define DEFAULT_IMU_ACC_BIAS1_Y 0.0
#define DEFAULT_IMU_ACC_BIAS1_Z 0.0
#define DEFAULT_IMU_ACC_BIAS2_X 0.0
#define DEFAULT_IMU_ACC_BIAS2_Y 0.0
#define DEFAULT_IMU_ACC_BIAS2_Z 0.0
#define DEFAULT_IMU_ACC_BIAS3_X 0.0
#define DEFAULT_IMU_ACC_BIAS3_Y 0.0
#define DEFAULT_IMU_ACC_BIAS3_Z 0.0
#define DEFAULT_IMU_ACC_SCAL_X 1.0
#define DEFAULT_IMU_ACC_SCAL_Y 1.0
#define DEFAULT_IMU_ACC_SCAL_Z 1.0
#define DEFAULT_IMU_ACC_SCAL1_X 0.0
#define DEFAULT_IMU_ACC_SCAL1_Y 0.0
#define DEFAULT_IMU_ACC_SCAL1_Z 0.0
#define DEFAULT_IMU_ACC_SCAL2_X 0.0
#define DEFAULT_IMU_ACC_SCAL2_Y 0.0
#define DEFAULT_IMU_ACC_SCAL2_Z 0.0
#define DEFAULT_IMU_ACC_SCAL3_X 0.0
#define DEFAULT_IMU_ACC_SCAL3_Y 0.0
#define DEFAULT_IMU_ACC_SCAL3_Z 0.0
#define DEFAULT_IMU_ACC_ALGN_XY 0.0
#define DEFAULT_IMU_ACC_ALGN_XZ 0.0
#define DEFAULT_IMU_ACC_ALGN_YX 0.0
#define DEFAULT_IMU_ACC_ALGN_YZ 0.0
#define DEFAULT_IMU_ACC_ALGN_ZX 0.0
#define DEFAULT_IMU_ACC_ALGN_ZY 0.0
#define DEFAULT_IMU_MAG_BIAS_X 0.0
#define DEFAULT_IMU_MAG_BIAS_Y 0.0
#define DEFAULT_IMU_MAG_BIAS_Z 0.0
#define DEFAULT_IMU_MAG_BIAS1_X 0.0
#define DEFAULT_IMU_MAG_BIAS1_Y 0.0
#define DEFAULT_IMU_MAG_BIAS1_Z 0.0
#define DEFAULT_IMU_MAG_BIAS2_X 0.0
#define DEFAULT_IMU_MAG_BIAS2_Y 0.0
#define DEFAULT_IMU_MAG_BIAS2_Z 0.0
#define DEFAULT_IMU_MAG_BIAS3_X 0.0
#define DEFAULT_IMU_MAG_BIAS3_Y 0.0
#define DEFAULT_IMU_MAG_BIAS3_Z 0.0
#define DEFAULT_IMU_MAG_SCAL_X 1.0
#define DEFAULT_IMU_MAG_SCAL_Y 1.0
#define DEFAULT_IMU_MAG_SCAL_Z 1.0
#define DEFAULT_IMU_MAG_SCAL1_X 0.0
#define DEFAULT_IMU_MAG_SCAL1_Y 0.0
#define DEFAULT_IMU_MAG_SCAL1_Z 0.0
#define DEFAULT_IMU_MAG_SCAL2_X 0.0
#define DEFAULT_IMU_MAG_SCAL2_Y 0.0
#define DEFAULT_IMU_MAG_SCAL2_Z 0.0
#define DEFAULT_IMU_MAG_SCAL3_X 0.0
#define DEFAULT_IMU_MAG_SCAL3_Y 0.0
#define DEFAULT_IMU_MAG_SCAL3_Z 0.0
#define DEFAULT_IMU_MAG_ALGN_XY 0.0
#define DEFAULT_IMU_MAG_ALGN_XZ 0.0
#define DEFAULT_IMU_MAG_ALGN_YX 0.0
#define DEFAULT_IMU_MAG_ALGN_YZ 0.0
#define DEFAULT_IMU_MAG_ALGN_ZX 0.0
#define DEFAULT_IMU_MAG_ALGN_ZY 0.0
#define DEFAULT_IMU_GYO_BIAS_X 0.0
#define DEFAULT_IMU_GYO_BIAS_Y 0.0
#define DEFAULT_IMU_GYO_BIAS_Z 0.0
#define DEFAULT_IMU_GYO_BIAS1_X 0.0
#define DEFAULT_IMU_GYO_BIAS1_Y 0.0
#define DEFAULT_IMU_GYO_BIAS1_Z 0.0
#define DEFAULT_IMU_GYO_BIAS2_X 0.0
#define DEFAULT_IMU_GYO_BIAS2_Y 0.0
#define DEFAULT_IMU_GYO_BIAS2_Z 0.0
#define DEFAULT_IMU_GYO_BIAS3_X 0.0
#define DEFAULT_IMU_GYO_BIAS3_Y 0.0
#define DEFAULT_IMU_GYO_BIAS3_Z 0.0
#define DEFAULT_IMU_GYO_SCAL_X 1.0
#define DEFAULT_IMU_GYO_SCAL_Y 1.0
#define DEFAULT_IMU_GYO_SCAL_Z 1.0
#define DEFAULT_IMU_GYO_ALGN_XY 0.0
#define DEFAULT_IMU_GYO_ALGN_XZ 0.0
#define DEFAULT_IMU_GYO_ALGN_YX 0.0
#define DEFAULT_IMU_GYO_ALGN_YZ 0.0
#define DEFAULT_IMU_GYO_ALGN_ZX 0.0
#define DEFAULT_IMU_GYO_ALGN_ZY 0.0
#endif