Ensure that we don't initialise more motors than are defined in target.h. Make MAX_PW...
[betaflight.git] / src / main / target / FURYF3 / target.h
blob0483beccc2504b9a341998653af0d5a516f73884
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight 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.
9 * Cleanflight 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.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #define TARGET_BOARD_IDENTIFIER "FYF3"
22 #define LED0 PC14
24 #define BEEPER PC15
25 #define BEEPER_INVERTED
27 #define USE_EXTI
28 #define MPU_INT_EXTI PC4
29 //#define EXTI_CALLBACK_HANDLER_COUNT 2 // MPU INT, SDCardDetect
30 #define EXTI_CALLBACK_HANDLER_COUNT 1 // MPU INT
31 #define USE_MPU_DATA_READY_SIGNAL
32 #define ENSURE_MPU_DATA_READY_IS_LOW
34 #define MPU6000_CS_PIN PA4
35 #define MPU6000_SPI_INSTANCE SPI1
37 #define MPU6500_CS_PIN PA4
38 #define MPU6500_SPI_INSTANCE SPI1
40 #define GYRO
41 #define USE_GYRO_SPI_MPU6000
42 #define GYRO_MPU6000_ALIGN CW180_DEG // changedkb 270
43 #define USE_GYRO_MPU6500
44 #define USE_GYRO_SPI_MPU6500
45 #define GYRO_MPU6500_ALIGN CW90_DEG // changedkb 270
47 #define ACC
48 #define USE_ACC_SPI_MPU6000
49 #define ACC_MPU6000_ALIGN CW180_DEG // changedkb 270
50 #define USE_ACC_MPU6500
51 #define USE_ACC_SPI_MPU6500
52 #define ACC_MPU6500_ALIGN CW90_DEG // changedkb 270
54 #define MAG
55 #define USE_MAG_AK8975
56 #define USE_MAG_HMC5883
57 #define USE_MAG_MAG3110
59 #define BARO
60 #define USE_BARO_MS5611
61 #define USE_BARO_BMP280
63 #define USE_SPI
64 #define USE_SPI_DEVICE_1
65 #define USE_SPI_DEVICE_2 // PB12,13,14,15 on AF5
67 #define SPI2_NSS_PIN PB12
68 #define SPI2_SCK_PIN PB13
69 #define SPI2_MISO_PIN PB14
70 #define SPI2_MOSI_PIN PB15
72 #ifdef FURYF3_SPIFLASH
73 #define USE_FLASHFS
74 #undef BEEPER_INVERTED
75 #else
76 #define USE_SDCARD
77 #endif
79 #ifdef USE_FLASHFS
80 #define USE_FLASH_M25P16
81 #define M25P16_CS_PIN PB12
82 #define M25P16_SPI_INSTANCE SPI2
83 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
84 #endif
86 #ifdef USE_SDCARD
87 #define USE_SDCARD_SPI2
89 #define SDCARD_DETECT_INVERTED
91 #define SDCARD_DETECT_PIN PB2
92 #define SDCARD_DETECT_EXTI_LINE EXTI_Line2
93 #define SDCARD_DETECT_EXTI_PIN_SOURCE EXTI_PinSource2
94 #define SDCARD_DETECT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOB
95 #define SDCARD_DETECT_EXTI_IRQn EXTI15_10_IRQn
97 #define SDCARD_SPI_INSTANCE SPI2
98 #define SDCARD_SPI_CS_GPIO SPI2_GPIO
99 #define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
101 // SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
102 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 128
103 // Divide to under 25MHz for normal operation:
104 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 2
106 // Note, this is the same DMA channel as UART1_RX. Luckily we don't use DMA for USART Rx.
107 #define SDCARD_DMA_CHANNEL_TX DMA1_Channel5
108 #define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA1_FLAG_TC5
109 #endif
111 #define USB_IO
113 #define USE_VCP
114 #define USE_UART1
115 #define USE_UART2
116 #define USE_UART3
117 #define USE_SOFTSERIAL1
118 #define SERIAL_PORT_COUNT 5
120 #define UART1_TX_PIN PA9
121 #define UART1_RX_PIN PA10
123 #define UART2_TX_PIN PA14
124 #define UART2_RX_PIN PA15
126 #define UART3_TX_PIN PB10 // PB10 (AF7)
127 #define UART3_RX_PIN PB11 // PB11 (AF7)
129 #define SOFTSERIAL_1_TIMER TIM3
130 #define SOFTSERIAL_1_TIMER_RX_HARDWARE 1
131 #define SOFTSERIAL_1_TIMER_TX_HARDWARE 2
133 #define USE_I2C
134 #define I2C_DEVICE (I2CDEV_1) // SDA (PB9/AF4), SCL (PB8/AF4)
136 #define I2C1_SCL_PIN PB8
137 #define I2C1_SDA_PIN PB9
139 #define BOARD_HAS_VOLTAGE_DIVIDER
140 #define USE_ADC
141 #define ADC_INSTANCE ADC1
142 #define VBAT_ADC_PIN PA0
143 #define RSSI_ADC_PIN PA1
144 #define CURRENT_METER_ADC_PIN PA2
146 #define LED_STRIP
147 #define USE_LED_STRIP_ON_DMA1_CHANNEL2
148 #define WS2811_PIN PA8
149 #define WS2811_TIMER TIM1
150 #define WS2811_DMA_CHANNEL DMA1_Channel2
151 #define WS2811_IRQ DMA1_Channel2_IRQn
152 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC2
153 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH2_HANDLER
155 #define SONAR
156 #define SONAR_TRIGGER_PIN PB0 // RC_CH7 (PB0) - only 3.3v ( add a 1K Ohms resistor )
157 #define SONAR_ECHO_PIN PB1 // RC_CH8 (PB1) - only 3.3v ( add a 1K Ohms resistor )
159 #define NAV
160 #define NAV_AUTO_MAG_DECLINATION
161 #define NAV_GPS_GLITCH_DETECTION
162 #define NAV_MAX_WAYPOINTS 60
164 #define DEFAULT_FEATURES FEATURE_BLACKBOX
165 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
167 #define SPEKTRUM_BIND
168 // UART3,
169 #define BIND_PIN PB11
171 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
173 // Number of available PWM outputs
174 #define MAX_PWM_OUTPUT_PORTS 6
176 // IO - stm32f303cc in 48pin package
177 #define TARGET_IO_PORTA 0xffff
178 #define TARGET_IO_PORTB 0xffff
179 #define TARGET_IO_PORTC 0xffff
180 #define TARGET_IO_PORTD 0xffff
181 #define TARGET_IO_PORTF (BIT(4))
183 #define USABLE_TIMER_CHANNEL_COUNT 8
184 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(16) |TIM_N(17))