Added SPARKY2 target (#544)
[betaflight.git] / src / main / target / SPARKY2 / target.h
blob2038b17f9dd77532446b8c06c4bbb15de5718345
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
19 #define TARGET_BOARD_IDENTIFIER "SPK2"
21 #define CONFIG_START_FLASH_ADDRESS 0x08080000 //0x08080000 to 0x080A0000 (FLASH_Sector_8)
23 #define USBD_PRODUCT_STRING "Sparky 2.0"
24 #ifdef OPBL
25 #define USBD_SERIALNUMBER_STRING "0x8020000"
26 #endif
28 #define LED0 PB5
29 #define LED1 PB4
30 #define LED2 PB6
32 #define BEEPER PC9
34 #define INVERTER PC6
35 #define INVERTER_USART USART6
37 // MPU9250 interrupt
38 #define USE_EXTI
39 #define MPU_INT_EXTI PC5
40 #define EXTI_CALLBACK_HANDLER_COUNT 1 // MPU data ready
41 //#define DEBUG_MPU_DATA_READY_INTERRUPT
42 #define USE_MPU_DATA_READY_SIGNAL
43 #define ENSURE_MPU_DATA_READY_IS_LOW
45 #define MPU9250_CS_PIN PC4
46 #define MPU9250_SPI_INSTANCE SPI1
48 #define ACC
49 #define USE_ACC_SPI_MPU9250
50 #define ACC_MPU9250_ALIGN CW270_DEG
52 #define GYRO
53 #define USE_GYRO_SPI_MPU9250
54 #define GYRO_MPU9250_ALIGN CW270_DEG
56 #define MAG
57 #define USE_MAG_AK8963
58 #define USE_MAG_AK8975
59 #define USE_MAG_HMC5883
60 #define USE_MAG_MAG3110
61 #define MAG_AK8963_ALIGN CW270_DEG
63 #define BARO
64 #define USE_BARO_MS5611
65 #define USE_BARO_BMP085
66 #define USE_BARO_BMP280
68 #define M25P16_CS_PIN PB3
69 #define M25P16_SPI_INSTANCE SPI3
71 //#define RFM22B_CS_PIN PA15
72 //#define RFM22B_SPI_INSTANCE SPI3
74 #define USE_FLASHFS
75 #define USE_FLASH_M25P16
76 #define USE_FLASH_TOOLS
78 #define USE_VCP
79 #define VBUS_SENSING_PIN PA8
81 #define USE_UART1
82 #define UART1_RX_PIN PA10
83 #define UART1_TX_PIN PA9
84 #define UART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2
86 #define USE_UART3
87 #define UART3_RX_PIN PB11
88 #define UART3_TX_PIN PB10
90 #define USE_UART6
91 #define UART6_RX_PIN PC7
92 #define UART6_TX_PIN PC6 //inverter
94 #define SERIAL_PORT_COUNT 4
96 #define USE_SPI
98 #define USE_SPI_DEVICE_1 //MPU9250
99 #define SPI1_NSS_PIN PC4
100 #define SPI1_SCK_PIN PA5
101 #define SPI1_MISO_PIN PA6
102 #define SPI1_MOSI_PIN PA7
104 #define USE_SPI_DEVICE_3 //dataflash
105 #define SPI3_NSS_PIN PB3
106 #define SPI3_SCK_PIN PC10
107 #define SPI3_MISO_PIN PC11
108 #define SPI3_MOSI_PIN PC12
110 #define USE_I2C
111 #define I2C_DEVICE (I2CDEV_1)
112 //#define I2C_DEVICE_EXT (I2CDEV_2)
114 #define USE_ADC
115 // PC2 shared with SONAR
116 #define CURRENT_METER_ADC_PIN PC2
117 #define VBAT_ADC_PIN PC1
118 //#define RSSI_ADC_GPIO_PIN PA0
120 #define LED_STRIP
121 #define LED_STRIP_TIMER TIM5
123 //#define SONAR
124 //#define SONAR_TRIGGER_PIN PC2
125 //#define SONAR_ECHO_PIN PC3
126 //#define USE_SONAR_SRF10
128 #define DEFAULT_FEATURES FEATURE_BLACKBOX
129 #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL
130 #define SERIALRX_PROVIDER SERIALRX_SBUS
131 #define SERIALRX_UART SERIAL_PORT_USART3
133 #define NAV
134 #define NAV_AUTO_MAG_DECLINATION
135 #define NAV_GPS_GLITCH_DETECTION
136 #define NAV_MAX_WAYPOINTS 60
138 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
140 #define MAX_PWM_OUTPUT_PORTS 11
142 #define TARGET_IO_PORTA 0xffff
143 #define TARGET_IO_PORTB 0xffff
144 #define TARGET_IO_PORTC 0xffff
146 #define USABLE_TIMER_CHANNEL_COUNT 11
147 #define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(12) | TIM_N(8) | TIM_N(9))