NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
target.h
Go to the documentation of this file.
1 /*
2  * This file is part of Ninjaflight.
3  *
4  * Ninjaflight is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * Ninjaflight is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Ninjaflight. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #pragma once
19 
20 #define USE_QUAD_MIXER_ONLY 0
21 #define TARGET_BOARD_IDENTIFIER "AFF3" // AlienFlight F3.
22 #define USE_HARDWARE_REVISION_DETECTION
23 
24 #define HW_GPIO GPIOB
25 #define HW_PIN Pin_2
26 #define HW_PERIPHERAL RCC_AHBPeriph_GPIOB
27 
28 // LED's V1
29 #define LED0_GPIO GPIOB
30 #define LED0_PIN Pin_4 // Blue LEDs - PB4
31 #define LED0_PERIPHERAL RCC_AHBPeriph_GPIOB
32 #define LED1_GPIO GPIOB
33 #define LED1_PIN Pin_5 // Green LEDs - PB5
34 #define LED1_PERIPHERAL RCC_AHBPeriph_GPIOB
35 
36 // LED's V2
37 #define LED0_GPIO_2 GPIOB
38 #define LED0_PIN_2 Pin_8 // Blue LEDs - PB8
39 #define LED0_PERIPHERAL_2 RCC_AHBPeriph_GPIOB
40 #define LED1_GPIO_2 GPIOB
41 #define LED1_PIN_2 Pin_9 // Green LEDs - PB9
42 #define LED1_PERIPHERAL_2 RCC_AHBPeriph_GPIOB
43 
44 #define BEEP_GPIO GPIOA
45 #define BEEP_PIN Pin_5 // White LEDs - PA5
46 #define BEEP_PERIPHERAL RCC_AHBPeriph_GPIOA
47 
48 #define USABLE_TIMER_CHANNEL_COUNT 11
49 
50 #define EXTI_CALLBACK_HANDLER_COUNT 1 // MPU data ready
51 
52 //#define DEBUG_MPU_DATA_READY_INTERRUPT
53 #define USE_MPU_DATA_READY_SIGNAL
54 
55 // Using MPU6050 for the moment.
56 #define GYRO
57 #define USE_GYRO_MPU6050
58 #define USE_GYRO_MPU6500
59 #define USE_GYRO_SPI_MPU6500
60 #define USE_TILT 0
61 #define GYRO_MPU6050_ALIGN CW270_DEG
62 #define GYRO_MPU6500_ALIGN CW270_DEG
63 
64 #define ACC
65 #define USE_ACC_MPU6050
66 #define USE_ACC_MPU6500
67 #define USE_ACC_SPI_MPU6500
68 
69 #define ACC_MPU6050_ALIGN CW270_DEG
70 #define ACC_MPU6500_ALIGN CW270_DEG
71 
72 // No baro support.
73 //#define BARO
74 //#define USE_BARO_MS5611
75 
76 // option to use MPU9150 or MPU9250 integrated AK89xx Mag
77 #define USE_MAG 1
78 #define USE_MAG_AK8963
79 
80 #define MAG_AK8963_ALIGN CW0_DEG_FLIP
81 
82 #define USE_BEEPER 1
83 #define LED0
84 #define LED1
85 
86 #define USB_IO
87 
88 #define USE_VCP
89 #define USE_UART1 // Not connected - TX (PB6) RX PB7 (AF7)
90 #define USE_UART2 // Receiver - RX (PA3)
91 #define USE_UART3 // Not connected - 10/RX (PB11) 11/TX (PB10)
92 #define SERIAL_PORT_COUNT 4
93 
94 #define UART1_TX_PIN GPIO_Pin_6 // PB6
95 #define UART1_RX_PIN GPIO_Pin_7 // PB7
96 #define UART1_GPIO GPIOB
97 #define UART1_GPIO_AF GPIO_AF_7
98 #define UART1_TX_PINSOURCE GPIO_PinSource6
99 #define UART1_RX_PINSOURCE GPIO_PinSource7
100 
101 #define UART2_TX_PIN GPIO_Pin_2 // PA2
102 #define UART2_RX_PIN GPIO_Pin_3 // PA3
103 #define UART2_GPIO GPIOA
104 #define UART2_GPIO_AF GPIO_AF_7
105 #define UART2_TX_PINSOURCE GPIO_PinSource2
106 #define UART2_RX_PINSOURCE GPIO_PinSource3
107 
108 #define UART3_TX_PIN GPIO_Pin_10 // PB10 (AF7)
109 #define UART3_RX_PIN GPIO_Pin_11 // PB11 (AF7)
110 #define UART3_GPIO_AF GPIO_AF_7
111 #define UART3_GPIO GPIOB
112 #define UART3_TX_PINSOURCE GPIO_PinSource10
113 #define UART3_RX_PINSOURCE GPIO_PinSource11
114 
115 
116 #define USE_I2C
117 #define I2C_DEVICE (I2CDEV_2) // SDA (PA10/AF4), SCL (PA9/AF4)
118 
119 #define I2C2_SCL_GPIO GPIOA
120 #define I2C2_SCL_GPIO_AF GPIO_AF_4
121 #define I2C2_SCL_PIN GPIO_Pin_9
122 #define I2C2_SCL_PIN_SOURCE GPIO_PinSource9
123 #define I2C2_SCL_CLK_SOURCE RCC_AHBPeriph_GPIOA
124 #define I2C2_SDA_GPIO GPIOA
125 #define I2C2_SDA_GPIO_AF GPIO_AF_4
126 #define I2C2_SDA_PIN GPIO_Pin_10
127 #define I2C2_SDA_PIN_SOURCE GPIO_PinSource10
128 #define I2C2_SDA_CLK_SOURCE RCC_AHBPeriph_GPIOA
129 
130 // SPI3
131 // PA15 38 SPI3_NSS
132 // PB3 39 SPI3_SCK
133 // PB4 40 SPI3_MISO
134 // PB5 41 SPI3_MOSI
135 
136 #define USE_SPI
137 #define USE_SPI_DEVICE_3
138 
139 #define MPU6500_CS_GPIO_CLK_PERIPHERAL RCC_AHBPeriph_GPIOA
140 #define MPU6500_CS_GPIO GPIOA
141 #define MPU6500_CS_PIN GPIO_Pin_15
142 #define MPU6500_SPI_INSTANCE SPI3
143 
144 #define USE_ADC
145 
146 #define ADC_INSTANCE ADC2
147 #define ADC_DMA_CHANNEL DMA2_Channel1
148 #define ADC_AHB_PERIPHERAL RCC_AHBPeriph_DMA2
149 
150 //#define BOARD_HAS_VOLTAGE_DIVIDER
151 
152 #define VBAT_ADC_GPIO GPIOA
153 #define VBAT_ADC_GPIO_PIN GPIO_Pin_4
154 #define VBAT_ADC_CHANNEL ADC_Channel_1
155 
156 #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
157 #define DEFAULT FEATURES FEATURE_MOTOR_STOP
158 
159 //#define BLACKBOX
160 #define SERIAL_RX
161 //#define GPS
162 #define GTUNE
163 //#define DISPLAY
164 #define USE_SERVOS
165 #define USE_CLI
166 
167 #define SPEKTRUM_BIND
168 // UART2, PA3
169 #define BIND_PORT GPIOA
170 #define BIND_PIN Pin_3
171 
172 // alternative defaults for AlienFlight F3 target
173 #define ALIENFLIGHT
174 #define HARDWARE_BIND_PLUG
175 
176 // Hardware bind plug at PB12 (Pin 25)
177 #define BINDPLUG_PORT GPIOB
178 #define BINDPLUG_PIN Pin_12
179