Added common target header file.
[betaflight.git] / src / main / target / SPARKY / target.h
blob304fcf3685a6c4f8bb212b56658e5a64cc7b9858
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 "SPKY" // SParKY
22 #define LED0_GPIO GPIOB
23 #define LED0_PIN Pin_4 // Blue (Rev 1 & 2) - PB4
24 #define LED0_PERIPHERAL RCC_AHBPeriph_GPIOB
25 #define LED1_GPIO GPIOB
26 #define LED1_PIN Pin_5 // Green (Rev 1) / Red (Rev 2) - PB5
27 #define LED1_PERIPHERAL RCC_AHBPeriph_GPIOB
29 #define USABLE_TIMER_CHANNEL_COUNT 11
31 // MPU 9150 INT connected to PA15, pulled up to VCC by 10K Resistor, contains MPU6050 and AK8975 in single component.
32 #define GYRO
33 #define USE_GYRO_MPU6050
35 #define GYRO_MPU6050_ALIGN CW270_DEG
37 #define ACC
38 #define USE_ACC_MPU6050
40 #define ACC_MPU6050_ALIGN CW270_DEG
42 #define BARO
43 #define USE_BARO_MS5611
45 #define MAG
46 #define USE_MAG_HMC5883
47 #define USE_MAG_AK8975
48 #define USE_MAG_MAG3110
50 #define MAG_AK8975_ALIGN CW180_DEG_FLIP
52 #define LED0
53 #define LED1
55 #define USE_VCP
56 #define USE_USART1 // Conn 1 - TX (PB6) RX PB7 (AF7)
57 #define USE_USART2 // Input - RX (PA3)
58 #define USE_USART3 // Servo out - 10/RX (PB11) 11/TX (PB10)
59 #define SERIAL_PORT_COUNT 4
61 #define UART1_TX_PIN GPIO_Pin_6 // PB6
62 #define UART1_RX_PIN GPIO_Pin_7 // PB7
63 #define UART1_GPIO GPIOB
64 #define UART1_GPIO_AF GPIO_AF_7
65 #define UART1_TX_PINSOURCE GPIO_PinSource6
66 #define UART1_RX_PINSOURCE GPIO_PinSource7
68 #define UART2_TX_PIN GPIO_Pin_2 // PA2 - Clashes with PWM6 input.
69 #define UART2_RX_PIN GPIO_Pin_3 // PA3
70 #define UART2_GPIO GPIOA
71 #define UART2_GPIO_AF GPIO_AF_7
72 #define UART2_TX_PINSOURCE GPIO_PinSource2
73 #define UART2_RX_PINSOURCE GPIO_PinSource3
75 #define UART3_TX_PIN GPIO_Pin_10 // PB10 (AF7)
76 #define UART3_RX_PIN GPIO_Pin_11 // PB11 (AF7)
77 #define UART3_GPIO_AF GPIO_AF_7
78 #define UART3_GPIO GPIOB
79 #define UART3_TX_PINSOURCE GPIO_PinSource10
80 #define UART3_RX_PINSOURCE GPIO_PinSource11
82 // Note: PA5 and PA0 are N/C on the sparky - potentially use for ADC or LED STRIP?
84 #define USE_I2C
85 #define I2C_DEVICE (I2CDEV_2) // SDA (PA10/AF4), SCL (PA9/AF4)
87 #define I2C2_SCL_GPIO GPIOA
88 #define I2C2_SCL_GPIO_AF GPIO_AF_4
89 #define I2C2_SCL_PIN GPIO_Pin_9
90 #define I2C2_SCL_PIN_SOURCE GPIO_PinSource9
91 #define I2C2_SCL_CLK_SOURCE RCC_AHBPeriph_GPIOA
92 #define I2C2_SDA_GPIO GPIOA
93 #define I2C2_SDA_GPIO_AF GPIO_AF_4
94 #define I2C2_SDA_PIN GPIO_Pin_10
95 #define I2C2_SDA_PIN_SOURCE GPIO_PinSource10
96 #define I2C2_SDA_CLK_SOURCE RCC_AHBPeriph_GPIOA
98 #define USE_ADC
100 #define ADC_INSTANCE ADC2
101 #define ADC_DMA_CHANNEL DMA2_Channel1
102 #define ADC_AHB_PERIPHERAL RCC_AHBPeriph_DMA2
104 #define VBAT_ADC_GPIO GPIOA
105 #define VBAT_ADC_GPIO_PIN GPIO_Pin_4
106 #define VBAT_ADC_CHANNEL ADC_Channel_1
108 #define CURRENT_METER_ADC_GPIO GPIOA
109 #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_7
110 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_4
112 #define BLACKBOX
114 #define NAV
115 #define NAV_AUTO_MAG_DECLINATION
116 #define NAV_GPS_GLITCH_DETECTION
118 #define GPS
119 #define GPS_PROTO_NMEA
120 #define GPS_PROTO_UBLOX
121 #define GPS_PROTO_I2C_NAV
122 #define GPS_PROTO_NAZA
124 #define SERIAL_RX
125 #define TELEMETRY
126 #define TELEMETRY_FRSKY
127 #define TELEMETRY_HOTT
128 #define TELEMETRY_SMARTPORT
129 #define TELEMETRY_LTM
131 #define USE_SERVOS
132 #define USE_CLI
134 #define SONAR
135 #define SONAR_TRIGGER_PIN Pin_2 // PWM6 (PA2) - only 3.3v ( add a 1K Ohms resistor )
136 #define SONAR_TRIGGER_GPIO GPIOA
137 #define SONAR_ECHO_PIN Pin_1 // PWM7 (PB1) - only 3.3v ( add a 1K Ohms resistor )
138 #define SONAR_ECHO_GPIO GPIOB
139 #define SONAR_EXTI_LINE EXTI_Line1
140 #define SONAR_EXTI_PIN_SOURCE EXTI_PinSource1
141 #define SONAR_EXTI_IRQN EXTI1_IRQn
143 #define LED_STRIP
144 #if 1
145 // LED strip configuration using PWM motor output pin 5.
146 #define LED_STRIP_TIMER TIM16
148 #define USE_LED_STRIP_ON_DMA1_CHANNEL3
149 #define WS2811_GPIO GPIOA
150 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
151 #define WS2811_GPIO_AF GPIO_AF_1
152 #define WS2811_PIN GPIO_Pin_6 // TIM16_CH1
153 #define WS2811_PIN_SOURCE GPIO_PinSource6
154 #define WS2811_TIMER TIM16
155 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM16
156 #define WS2811_DMA_CHANNEL DMA1_Channel3
157 #define WS2811_IRQ DMA1_Channel3_IRQn
158 #endif
160 #if 0
161 // Alternate LED strip pin
162 // FIXME DMA IRQ Transfer Complete is never called because the TIM17_DMA_RMP needs to be set in SYSCFG_CFGR1
163 #define LED_STRIP_TIMER TIM17
165 #define USE_LED_STRIP_ON_DMA1_CHANNEL7
166 #define WS2811_GPIO GPIOA
167 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
168 #define WS2811_GPIO_AF GPIO_AF_1
169 #define WS2811_PIN GPIO_Pin_7 // TIM17_CH1
170 #define WS2811_PIN_SOURCE GPIO_PinSource7
171 #define WS2811_TIMER TIM17
172 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM17
173 #define WS2811_DMA_CHANNEL DMA1_Channel7
174 #define WS2811_IRQ DMA1_Channel7_IRQn
175 #endif
177 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
179 #define SPEKTRUM_BIND
180 // USART2, PA3
181 #define BIND_PORT GPIOA
182 #define BIND_PIN Pin_3