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 "SRF3"
22 
23 #define USE_TILT 1
24 #define LED0_GPIO GPIOB
25 #define LED0_PIN Pin_3
26 #define LED0_PERIPHERAL RCC_AHBPeriph_GPIOB
27 
28 #define BEEP_GPIO GPIOC
29 #define BEEP_PIN Pin_15
30 #define BEEP_PERIPHERAL RCC_AHBPeriph_GPIOC
31 #define BEEPER_INVERTED
32 
33 #define USABLE_TIMER_CHANNEL_COUNT 17
34 
35 #define EXTI_CALLBACK_HANDLER_COUNT 2 // MPU data ready and MAG data ready
36 
37 #define USE_MPU_DATA_READY_SIGNAL
38 #define ENSURE_MPU_DATA_READY_IS_LOW
39 
40 #define USE_MAG_DATA_READY_SIGNAL
41 #define ENSURE_MAG_DATA_READY_IS_HIGH
42 
43 
44 #define GYRO
45 #define USE_GYRO_MPU6050
46 #define GYRO_MPU6050_ALIGN CW270_DEG
47 
48 #define ACC
49 #define USE_ACC_MPU6050
50 #define ACC_MPU6050_ALIGN CW270_DEG
51 
52 #define BARO
53 #define USE_BARO_MS5611
54 
55 #define USE_MAG 0
56 #define USE_MAG_AK8975
57 #define USE_MAG_HMC5883
58 #define MAG_HMC5883_ALIGN CW270_DEG
59 
60 #define USE_FLASHFS
61 #define USE_FLASH_M25P16
62 
63 #define USE_BEEPER 1
64 #define LED0
65 
66 //#define SONAR
67 #define SONAR_TRIGGER_PIN Pin_0 // RC_CH7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
68 #define SONAR_TRIGGER_GPIO GPIOB
69 #define SONAR_ECHO_PIN Pin_1 // RC_CH8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
70 #define SONAR_ECHO_GPIO GPIOB
71 #define SONAR_EXTI_LINE EXTI_Line1
72 #define SONAR_EXTI_PIN_SOURCE EXTI_PinSource1
73 #define SONAR_EXTI_IRQN EXTI1_IRQn
74 
75 #define USE_UART1
76 #define USE_UART2
77 #define USE_UART3
78 #define USE_SOFTSERIAL1
79 #define USE_SOFTSERIAL2
80 #define SERIAL_PORT_COUNT 5
81 
82 #ifndef UART1_GPIO
83 #define UART1_TX_PIN GPIO_Pin_9 // PA9
84 #define UART1_RX_PIN GPIO_Pin_10 // PA10
85 #define UART1_GPIO GPIOA
86 #define UART1_GPIO_AF GPIO_AF_7
87 #define UART1_TX_PINSOURCE GPIO_PinSource9
88 #define UART1_RX_PINSOURCE GPIO_PinSource10
89 #endif
90 
91 #define UART2_TX_PIN GPIO_Pin_14 // PA14 / SWCLK
92 #define UART2_RX_PIN GPIO_Pin_15 // PA15
93 #define UART2_GPIO GPIOA
94 #define UART2_GPIO_AF GPIO_AF_7
95 #define UART2_TX_PINSOURCE GPIO_PinSource14
96 #define UART2_RX_PINSOURCE GPIO_PinSource15
97 
98 #ifndef UART3_GPIO
99 #define UART3_TX_PIN GPIO_Pin_10 // PB10 (AF7)
100 #define UART3_RX_PIN GPIO_Pin_11 // PB11 (AF7)
101 #define UART3_GPIO_AF GPIO_AF_7
102 #define UART3_GPIO GPIOB
103 #define UART3_TX_PINSOURCE GPIO_PinSource10
104 #define UART3_RX_PINSOURCE GPIO_PinSource11
105 #endif
106 
107 #define SOFTSERIAL_1_TIMER TIM3
108 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5
109 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
110 #define SOFTSERIAL_2_TIMER TIM3
111 #define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7
112 #define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
113 
114 #define USE_I2C
115 #define I2C_DEVICE (I2CDEV_1) // PB6/SCL, PB7/SDA
116 
117 #define USE_SPI
118 #define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
119 
120 #define M25P16_CS_GPIO GPIOB
121 #define M25P16_CS_PIN GPIO_Pin_12
122 #define M25P16_SPI_INSTANCE SPI2
123 
124 #define USE_ADC
125 #define BOARD_HAS_VOLTAGE_DIVIDER
126 
127 
128 #define ADC_INSTANCE ADC2
129 #define ADC_DMA_CHANNEL DMA2_Channel1
130 #define ADC_AHB_PERIPHERAL RCC_AHBPeriph_DMA2
131 
132 #define VBAT_ADC_GPIO GPIOA
133 #define VBAT_ADC_GPIO_PIN GPIO_Pin_4
134 #define VBAT_ADC_CHANNEL ADC_Channel_1
135 
136 #define CURRENT_METER_ADC_GPIO GPIOA
137 #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_5
138 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_2
139 
140 #define RSSI_ADC_GPIO GPIOB
141 #define RSSI_ADC_GPIO_PIN GPIO_Pin_2
142 #define RSSI_ADC_CHANNEL ADC_Channel_12
143 
144 #define LED_STRIP
145 #define LED_STRIP_TIMER TIM1
146 
147 #define WS2811_GPIO GPIOA
148 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
149 #define WS2811_GPIO_AF GPIO_AF_6
150 #define WS2811_PIN GPIO_Pin_8
151 #define WS2811_PIN_SOURCE GPIO_PinSource8
152 #define WS2811_TIMER TIM1
153 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM1
154 #define WS2811_DMA_CHANNEL DMA1_Channel2
155 #define WS2811_IRQ DMA1_Channel2_IRQn
156 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC2
157 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH2_HANDLER
158 
159 
160 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
161 
162 //#define BLACKBOX
163 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
164 
165 //#define DISPLAY
166 //#define GPS
167 //#define GTUNE
168 //#define SERIAL_RX
169 //#define TELEMETRY
170 #define USE_SERVOS
171 #define USE_CLI
172 
173 //#define SPEKTRUM_BIND
174 // UART3,
175 #define BIND_PORT GPIOB
176 #define BIND_PIN Pin_11
177 
178 #define USE_SERIAL_4WAY_BLHELI_INTERFACE