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 TARGET_BOARD_IDENTIFIER "CHF3" // Chebuzz F3
21 
22 #define USE_QUAD_MIXER_ONLY 0
23 #define USE_TILT 0
24 #define LED0_GPIO GPIOE
25 #define LED0_PIN Pin_8|Pin_12 // Blue LEDs - PE8/PE12
26 #define LED0_PERIPHERAL RCC_AHBPeriph_GPIOE
27 #define LED0_INVERTED
28 #define LED1_GPIO GPIOE
29 #define LED1_PIN Pin_10|Pin_14 // Orange LEDs - PE10/PE14
30 #define LED1_PERIPHERAL RCC_AHBPeriph_GPIOE
31 #define LED1_INVERTED
32 
33 #define BEEP_GPIO GPIOE
34 #define BEEP_PIN Pin_9|Pin_13 // Red LEDs - PE9/PE13
35 #define BEEP_PERIPHERAL RCC_AHBPeriph_GPIOE
36 #define BEEPER_INVERTED
37 
38 #define USABLE_TIMER_CHANNEL_COUNT 18
39 
40 #define USE_SPI
41 #define USE_SPI_DEVICE_1
42 #define USE_SPI_DEVICE_2
43 
44 #define SPI2_GPIO GPIOB
45 #define SPI2_GPIO_PERIPHERAL RCC_AHBPeriph_GPIOB
46 #define SPI2_NSS_PIN Pin_12
47 #define SPI2_NSS_PIN_SOURCE GPIO_PinSource12
48 #define SPI2_SCK_PIN Pin_13
49 #define SPI2_SCK_PIN_SOURCE GPIO_PinSource13
50 #define SPI2_MISO_PIN Pin_14
51 #define SPI2_MISO_PIN_SOURCE GPIO_PinSource14
52 #define SPI2_MOSI_PIN Pin_15
53 #define SPI2_MOSI_PIN_SOURCE GPIO_PinSource15
54 
55 #define USE_SDCARD
56 #define USE_SDCARD_SPI2
57 
58 #define SDCARD_DETECT_PIN GPIO_Pin_14
59 #define SDCARD_DETECT_EXTI_LINE EXTI_Line14
60 #define SDCARD_DETECT_EXTI_PIN_SOURCE EXTI_PinSource14
61 #define SDCARD_DETECT_GPIO_PORT GPIOC
62 #define SDCARD_DETECT_GPIO_CLK RCC_AHBPeriph_GPIOC
63 #define SDCARD_DETECT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
64 #define SDCARD_DETECT_EXTI_IRQn EXTI15_10_IRQn
65 
66 #define SDCARD_SPI_INSTANCE SPI2
67 #define SDCARD_SPI_CS_GPIO SPI2_GPIO
68 #define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
69 
70 // SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
71 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 128
72 // Divide to under 25MHz for normal operation:
73 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 2
74 
75 // Note, this is the same DMA channel as USART1_RX. Luckily we don't use DMA for USART Rx.
76 #define SDCARD_DMA_CHANNEL_TX DMA1_Channel5
77 #define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA1_FLAG_TC5
78 
79 //#define USE_FLASHFS
80 //#define USE_FLASH_M25P16
81 
82 //#define M25P16_CS_GPIO GPIOB
83 //#define M25P16_CS_PIN GPIO_Pin_12
84 //#define M25P16_SPI_INSTANCE SPI2
85 
86 #define GYRO
87 #define USE_GYRO_L3GD20
88 #define USE_GYRO_MPU6050
89 
90 #define L3GD20_SPI SPI1
91 #define L3GD20_CS_GPIO_CLK_PERIPHERAL RCC_AHBPeriph_GPIOE
92 #define L3GD20_CS_GPIO GPIOE
93 #define L3GD20_CS_PIN GPIO_Pin_3
94 
95 #define GYRO_L3GD20_ALIGN CW270_DEG
96 #define GYRO_MPU6050_ALIGN CW0_DEG
97 
98 #define ACC
99 #define USE_ACC_MPU6050
100 #define USE_ACC_LSM303DLHC
101 
102 #define ACC_MPU6050_ALIGN CW0_DEG
103 
104 #define BARO
105 #define USE_BARO_MS5611
106 
107 #define USE_MAG 1
108 #define USE_MAG_AK8975
109 
110 #define MAG_AK8975_ALIGN CW90_DEG_FLIP
111 
112 #define USE_BEEPER 1
113 #define LED0
114 #define LED1
115 
116 #define USB_IO
117 
118 #define USE_VCP
119 #define USE_UART1
120 #define USE_UART2
121 #define USE_UART3
122 #define USE_UART4
123 #define USE_UART5
124 
125 #define SERIAL_PORT_COUNT 6
126 
127 #define UART1_TX_PIN GPIO_Pin_9 // PA9
128 #define UART1_RX_PIN GPIO_Pin_10 // PA10
129 #define UART1_GPIO GPIOA
130 #define UART1_GPIO_AF GPIO_AF_7
131 #define UART1_TX_PINSOURCE GPIO_PinSource9
132 #define UART1_RX_PINSOURCE GPIO_PinSource10
133 
134 #define UART2_TX_PIN GPIO_Pin_5 // PD5
135 #define UART2_RX_PIN GPIO_Pin_6 // PD6
136 #define UART2_GPIO GPIOD
137 #define UART2_GPIO_AF GPIO_AF_7
138 #define UART2_TX_PINSOURCE GPIO_PinSource5
139 #define UART2_RX_PINSOURCE GPIO_PinSource6
140 
141 #define USE_I2C
142 #define I2C_DEVICE (I2CDEV_1)
143 
144 #define USE_ADC
145 
146 #define ADC_INSTANCE ADC1
147 #define ADC_AHB_PERIPHERAL RCC_AHBPeriph_DMA1
148 #define ADC_DMA_CHANNEL DMA1_Channel1
149 
150 #define VBAT_ADC_GPIO GPIOC
151 #define VBAT_ADC_GPIO_PIN GPIO_Pin_0
152 #define VBAT_ADC_CHANNEL ADC_Channel_6
153 
154 #define CURRENT_METER_ADC_GPIO GPIOC
155 #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_1
156 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_7
157 
158 #define RSSI_ADC_GPIO GPIOC
159 #define RSSI_ADC_GPIO_PIN GPIO_Pin_2
160 #define RSSI_ADC_CHANNEL ADC_Channel_8
161 
162 #define EXTERNAL1_ADC_GPIO GPIOC
163 #define EXTERNAL1_ADC_GPIO_PIN GPIO_Pin_3
164 #define EXTERNAL1_ADC_CHANNEL ADC_Channel_9
165 
166 #define GPS
167 #define LED_STRIP
168 #if 1
169 #define LED_STRIP_TIMER TIM16
170 #define WS2811_GPIO GPIOB
171 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOB
172 #define WS2811_GPIO_AF GPIO_AF_1
173 #define WS2811_PIN GPIO_Pin_8 // TIM16_CH1
174 #define WS2811_PIN_SOURCE GPIO_PinSource8
175 #define WS2811_TIMER TIM16
176 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM16
177 #define WS2811_DMA_CHANNEL DMA1_Channel3
178 #define WS2811_IRQ DMA1_Channel3_IRQn
179 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC3
180 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH3_HANDLER
181 #else
182 // alternative LED strip configuration, tested working.
183 #define LED_STRIP_TIMER TIM1
184 
185 #define WS2811_GPIO GPIOA
186 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
187 #define WS2811_GPIO_AF GPIO_AF_6
188 #define WS2811_PIN GPIO_Pin_8
189 #define WS2811_PIN_SOURCE GPIO_PinSource8
190 #define WS2811_TIMER TIM1
191 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM1
192 #define WS2811_DMA_CHANNEL DMA1_Channel2
193 #define WS2811_IRQ DMA1_Channel2_IRQn
194 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC2
195 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH2_HANDLER
196 #endif
197 
198 #define BLACKBOX
199 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
200 #define DISPLAY
201 #define GTUNE
202 #define TELEMETRY
203 #define SERIAL_RX
204 #define USE_SERVOS
205 #define USE_CLI