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 "103R"
22 
23 #define USE_TILT 0
24 #define LED0_GPIO GPIOB
25 #define LED0_PIN Pin_3 // PB3 (LED)
26 #define LED0_PERIPHERAL RCC_APB2Periph_GPIOB
27 
28 #define LED1_GPIO GPIOB
29 #define LED1_PIN Pin_4 // PB4 (LED)
30 #define LED1_PERIPHERAL RCC_APB2Periph_GPIOB
31 
32 #define LED2_GPIO GPIOD
33 #define LED2_PIN Pin_2 // PD2 (LED) - Labelled LED4
34 #define LED2_PERIPHERAL RCC_APB2Periph_GPIOD
35 
36 #define BEEP_GPIO GPIOA
37 #define BEEP_PIN Pin_12 // PA12 (Beeper)
38 #define BEEP_PERIPHERAL RCC_APB2Periph_GPIOA
39 
40 #define BARO_XCLR_GPIO GPIOC
41 #define BARO_XCLR_PIN Pin_13
42 #define BARO_EOC_GPIO GPIOC
43 #define BARO_EOC_PIN Pin_14
44 #define BARO_APB2_PERIPHERALS RCC_APB2Periph_GPIOC
45 
46 #define INVERTER_PIN Pin_2 // PB2 (BOOT1) abused as inverter select GPIO
47 #define INVERTER_GPIO GPIOB
48 #define INVERTER_PERIPHERAL RCC_APB2Periph_GPIOB
49 #define INVERTER_USART USART2
50 
51 #define USE_SPI
52 #define USE_SPI_DEVICE_2
53 
54 #define PORT103R_SPI_INSTANCE SPI2
55 #define PORT103R_SPI_CS_GPIO GPIOB
56 #define PORT103R_SPI_CS_PIN GPIO_Pin_12
57 
58 // We either have this 16mbit flash chip on SPI or the MPU6500 acc/gyro depending on board revision:
59 #define M25P16_CS_GPIO PORT103R_SPI_CS_GPIO
60 #define M25P16_CS_PIN PORT103R_SPI_CS_PIN
61 #define M25P16_SPI_INSTANCE PORT103R_SPI_INSTANCE
62 
63 #define MPU6000_CS_GPIO PORT103R_SPI_CS_GPIO
64 #define MPU6000_CS_PIN PORT103R_SPI_CS_PIN
65 #define MPU6000_SPI_INSTANCE PORT103R_SPI_INSTANCE
66 
67 #define MPU6500_CS_GPIO PORT103R_SPI_CS_GPIO
68 #define MPU6500_CS_PIN PORT103R_SPI_CS_PIN
69 #define MPU6500_SPI_INSTANCE PORT103R_SPI_INSTANCE
70 #define MPU6500_CS_GPIO_CLK_PERIPHERAL RCC_APB2Periph_GPIOB
71 
72 #define GYRO
73 #define USE_FAKE_GYRO
74 //#define USE_GYRO_L3G4200D
75 //#define USE_GYRO_L3GD20
76 //#define USE_GYRO_MPU3050
77 #define USE_GYRO_MPU6050
78 #define USE_GYRO_SPI_MPU6000
79 #define USE_GYRO_SPI_MPU6500
80 
81 #define ACC
82 #define USE_FAKE_ACC
83 //#define USE_ACC_ADXL345
84 //#define USE_ACC_BMA280
85 //#define USE_ACC_MMA8452
86 #define USE_ACC_MPU6050
87 #define USE_ACC_SPI_MPU6000
88 #define USE_ACC_SPI_MPU6500
89 
90 #define BARO
91 #define USE_BARO_MS5611
92 #define USE_BARO_BMP085
93 
94 #define USE_MAG 1
95 #define USE_MAG_HMC5883
96 #define USE_MAG_AK8975
97 
98 #define USE_FLASHFS
99 #define USE_FLASHTOOLS
100 #define USE_FLASH_M25P16
101 
102 #define USE_BEEPER 1
103 #define LED0
104 #define LED1
105 #define LED2
106 #define INVERTER
107 #define DISPLAY
108 
109 #define SONAR
110 #define SONAR_PWM_TRIGGER_PIN Pin_8 // PWM5 (PB8) - 5v tolerant
111 #define SONAR_PWM_TRIGGER_GPIO GPIOB
112 #define SONAR_PWM_ECHO_PIN Pin_9 // PWM6 (PB9) - 5v tolerant
113 #define SONAR_PWM_ECHO_GPIO GPIOB
114 #define SONAR_PWM_EXTI_LINE EXTI_Line9
115 #define SONAR_PWM_EXTI_PIN_SOURCE GPIO_PinSource9
116 #define SONAR_PWM_EXTI_IRQN EXTI9_5_IRQn
117 #define SONAR_TRIGGER_PIN Pin_0 // RX7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
118 #define SONAR_TRIGGER_GPIO GPIOB
119 #define SONAR_ECHO_PIN Pin_1 // RX8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
120 #define SONAR_ECHO_GPIO GPIOB
121 #define SONAR_EXTI_LINE EXTI_Line1
122 #define SONAR_EXTI_PIN_SOURCE GPIO_PinSource1
123 #define SONAR_EXTI_IRQN EXTI1_IRQn
124 
125 #define USE_UART1
126 #define USE_UART2
127 #define USE_UART3
128 #define USE_UART4
129 #define USE_UART5
130 #define USE_SOFTSERIAL1
131 #define USE_SOFTSERIAL2
132 #define SERIAL_PORT_COUNT 7
133 
134 #define SOFTSERIAL_1_TIMER TIM3
135 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5
136 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
137 #define SOFTSERIAL_2_TIMER TIM3
138 #define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7
139 #define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
140 
141 #define USE_I2C
142 #define I2C_DEVICE (I2CDEV_2)
143 
144 // #define SOFT_I2C // enable to test software i2c
145 // #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011)
146 // #define SOFT_I2C_PB67
147 
148 #define USE_ADC
149 
150 #define CURRENT_METER_ADC_GPIO GPIOB
151 #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_1
152 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_9
153 
154 #define VBAT_ADC_GPIO GPIOA
155 #define VBAT_ADC_GPIO_PIN GPIO_Pin_4
156 #define VBAT_ADC_CHANNEL ADC_Channel_4
157 
158 #define RSSI_ADC_GPIO GPIOA
159 #define RSSI_ADC_GPIO_PIN GPIO_Pin_1
160 #define RSSI_ADC_CHANNEL ADC_Channel_1
161 
162 #define EXTERNAL1_ADC_GPIO GPIOA
163 #define EXTERNAL1_ADC_GPIO_PIN GPIO_Pin_5
164 #define EXTERNAL1_ADC_CHANNEL ADC_Channel_5
165 
166 #define LED0
167 
168 #define LED_STRIP
169 #define LED_STRIP_TIMER TIM3
170 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC6
171 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH6_HANDLER
172 
173 #define BLACKBOX
174 #define GPS
175 #define GTUNE
176 #define SERIAL_RX
177 #define TELEMETRY
178 #define USE_SERVOS
179 #define USE_CLI
180 
181 #define USE_SERIAL_4WAY_BLHELI_INTERFACE