Merge pull request #11198 from SteveCEvans/sce_rc2
[betaflight.git] / src / main / target / FF_FORTINIF4 / target.h
blobf84c39e2cf92779596dc17959172207694e66b55
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
22 #if defined(FF_FORTINIF4_REV03)
23 #define TARGET_BOARD_IDENTIFIER "FOR3"
24 #define USBD_PRODUCT_STRING "FortiniF4_Rev03"
25 #else
26 #define TARGET_BOARD_IDENTIFIER "FORT"
27 #define USBD_PRODUCT_STRING "FortiniF4"
28 #endif
29 #define USE_TARGET_CONFIG
30 #define USE_HARDWARE_REVISION_DETECTION
31 #define HW_PIN_A PC14
32 #define HW_PIN_B PC8
33 /*--------------LED----------------*/
34 #define LED0_PIN PB5
35 #if defined(FF_FORTINIF4_REV03)
36 #define LED1_PIN PB4
37 #else
38 #define LED1_PIN PB6
39 #endif
40 /*---------------------------------*/
42 /*------------BEEPER---------------*/
43 #define USE_BEEPER
44 #if defined(FF_FORTINIF4_REV03)
45 #define BEEPER_PIN PB3
46 #else
47 #define BEEPER_PIN PB4
48 #endif
49 #define BEEPER_INVERTED
50 /*---------------------------------*/
52 /*------------SENSORS--------------*/
53 // MPU interrupt
54 #define USE_EXTI
55 #define USE_GYRO_EXTI
56 #define GYRO_1_EXTI_PIN PC4
57 #define USE_MPU_DATA_READY_SIGNAL
58 #define ENSURE_MPU_DATA_READY_IS_LOW
60 #define USE_GYRO
61 #define USE_GYRO_SPI_MPU6000
62 #define USE_GYRO_SPI_MPU6500
63 #define USE_GYRO_SPI_ICM20689
64 #define GYRO_1_ALIGN CW180_DEG
66 #define GYRO_1_SPI_INSTANCE SPI1
68 #if defined(FF_FORTINIF4_REV03)
69 #define GYRO_1_CS_PIN PA4
70 #else
71 #define GYRO_1_CS_PIN PA8
72 #endif
74 #define USE_ACC
75 #define USE_ACC_SPI_MPU6000
76 #define USE_ACC_SPI_MPU6500
77 #define USE_ACC_SPI_ICM20689
79 /*---------------------------------*/
81 #if !defined(FF_FORTINIF4_REV03)
82 /*------------FLASH----------------*/
83 #define FLASH_CS_PIN PB3
84 #define FLASH_SPI_INSTANCE SPI3
86 #define USE_FLASHFS
87 #define USE_FLASH_M25P16
88 /*---------------------------------*/
89 #endif
91 /*-------------OSD-----------------*/
92 #define USE_MAX7456
93 #if defined(FF_FORTINIF4_REV03)
94 #define MAX7456_SPI_INSTANCE SPI2
95 #define MAX7456_SPI_CS_PIN SPI2_NSS_PIN
96 #else
97 #define MAX7456_SPI_INSTANCE SPI3
98 #define MAX7456_SPI_CS_PIN SPI3_NSS_PIN
99 #endif
100 /*---------------------------------*/
102 /*-----------USB-UARTs-------------*/
103 #define USE_VCP
104 //#define USB_DETECT_PIN NONE
105 //#define USE_USB_DETECT
107 #define USE_UART1
108 #if defined(FF_FORTINIF4_REV03)
109 #define UART1_RX_PIN PB7
110 #else
111 #define UART1_RX_PIN PA10
112 #endif
113 #define UART1_TX_PIN PA9
115 #define USE_UART4
116 #define UART4_TX_PIN PA0
117 #define UART4_RX_PIN PA1
119 #define USE_UART5
120 #define UART5_RX_PIN PD2
121 #define UART5_TX_PIN PC12
123 #define USE_UART6
124 #define UART6_RX_PIN PC7
125 #define UART6_TX_PIN PC6
127 #if defined(FF_FORTINIF4_REV03)
128 #define USE_UART2
129 #define UART2_RX_PIN PA3
130 #define UART2_TX_PIN PA2
132 #define USE_UART3
133 #define UART3_RX_PIN PC11
134 #define UART3_TX_PIN PC10
135 #define INVERTER_PIN_UART3 PC15
137 #define SERIAL_PORT_COUNT 7
138 #else
139 #define USE_UART3
140 #define UART3_RX_PIN PB11
141 #define UART3_TX_PIN PB10
142 #define INVERTER_PIN_UART3 PC15
144 #define SERIAL_PORT_COUNT 6
145 #endif
146 /*---------------------------------*/
148 /*-------------SPIs----------------*/
149 #define USE_SPI
151 #define USE_SPI_DEVICE_1
152 #if defined(FF_FORTINIF4_REV03)
153 #define SPI1_NSS_PIN PA4
154 #else
155 #define SPI1_NSS_PIN PA8
156 #endif
157 #define SPI1_SCK_PIN PA5
158 #define SPI1_MISO_PIN PA6
159 #define SPI1_MOSI_PIN PA7
161 #if defined(FF_FORTINIF4_REV03)
162 #define USE_SPI_DEVICE_2
163 #define SPI2_NSS_PIN PB12
164 #define SPI2_SCK_PIN PB13
165 #define SPI2_MISO_PIN PB14
166 #define SPI2_MOSI_PIN PB15
167 #else
168 #define USE_SPI_DEVICE_3
169 #define SPI3_NSS_PIN PB3
170 #define SPI3_SCK_PIN PC10
171 #define SPI3_MISO_PIN PC11
172 #define SPI3_MOSI_PIN PC12
173 #endif
174 /*---------------------------------*/
176 #if defined(FF_FORTINIF4_REV03)
177 /*-------------I2C-----------------*/
178 #define USE_I2C
179 #define USE_I2C_PULLUP
180 #define USE_I2C_DEVICE_3
181 #define I2C_DEVICE (I2CDEV_3)
182 #define I2C1_SCL PA8
183 #define I2C1_SDA PC9
184 /*---------------------------------*/
185 #endif
187 /*-------------ADCs----------------*/
188 #define USE_ADC
189 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
190 #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
191 #define VBAT_ADC_PIN PC2
192 #define CURRENT_METER_ADC_PIN PC1
193 /*---------------------------------*/
195 /*-------------ESCs----------------*/
196 #define USE_ESCSERIAL
197 #define ESCSERIAL_TIMER_TX_PIN PB0 // (HARDARE=0)
198 /*---------------------------------*/
200 /*--------DEFAULT VALUES-----------*/
201 #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
202 #define SERIALRX_PROVIDER SERIALRX_SBUS
203 #define SERIALRX_UART SERIAL_PORT_USART3
205 #define TARGET_IO_PORTA 0xffff
206 #define TARGET_IO_PORTB 0xffff
207 #define TARGET_IO_PORTC 0xffff
208 #define TARGET_IO_PORTD (BIT(2))
209 /*---------------------------------*/
211 /*--------------TIMERS-------------*/
212 #if defined(FF_FORTINIF4_REV03)
213 #define USABLE_TIMER_CHANNEL_COUNT 7
214 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) )
215 #else
216 #define USABLE_TIMER_CHANNEL_COUNT 6
217 #define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(4) )
218 #endif
219 /*---------------------------------*/