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