Ensure that we don't initialise more motors than are defined in target.h. Make MAX_PW...
[betaflight.git] / src / main / target / SPARKY / target.h
blobb1832001e30f5d3a22bace3a25b52ed0462d031b
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 PB4 // Blue (Rev 1 & 2) - PB4
23 #define LED1 PB5 // Green (Rev 1) / Red (Rev 2) - PB5
25 #define BEEPER PA1
26 #define BEEPER_INVERTED
28 // MPU6050 interrupts
29 #define USE_EXTI
30 #define MPU_INT_EXTI PA15
31 #define EXTI15_10_CALLBACK_HANDLER_COUNT 1 // MPU data ready
32 #define USE_MPU_DATA_READY_SIGNAL
34 // MPU 9150 INT connected to PA15, pulled up to VCC by 10K Resistor, contains MPU6050 and AK8975 in single component.
35 #define GYRO
36 #define USE_GYRO_MPU6050
37 #define GYRO_MPU6050_ALIGN CW270_DEG
39 #define ACC
40 #define USE_ACC_MPU6050
41 #define ACC_MPU6050_ALIGN CW270_DEG
43 #define BARO
44 #define USE_BARO_MS5611
45 #define USE_BARO_BMP280
47 #define MAG
48 #define USE_MAG_HMC5883
49 #define USE_MAG_AK8975
50 #define USE_MAG_MAG3110
51 #define MAG_AK8975_ALIGN CW180_DEG_FLIP
53 #define USE_VCP
54 #define USE_UART1 // Conn 1 - TX (PB6) RX PB7 (AF7)
55 #define USE_UART2 // Input - RX (PA3)
56 #define USE_UART3 // Servo out - 10/RX (PB11) 11/TX (PB10)
57 #define SERIAL_PORT_COUNT 4
58 #define AVOID_UART3_FOR_PWM_PPM
60 #define UART1_TX_PIN PB6
61 #define UART1_RX_PIN PB7
63 #define UART2_TX_PIN PA2 // PA2 - Clashes with PWM6 input.
64 #define UART2_RX_PIN PA3
66 #define UART3_TX_PIN PB10 // PB10 (AF7)
67 #define UART3_RX_PIN PB11 // PB11 (AF7)
69 // Note: PA5 and PA0 are N/C on the sparky - potentially use for ADC or LED STRIP?
71 #define USE_I2C
72 #define I2C_DEVICE (I2CDEV_2) // SDA (PA10/AF4), SCL (PA9/AF4)
74 #define USE_ADC
75 #define ADC_INSTANCE ADC2
76 #define VBAT_ADC_PIN PA4
77 #define CURRENT_METER_ADC_PIN PA7
79 #define NAV
80 #define NAV_AUTO_MAG_DECLINATION
81 #define NAV_GPS_GLITCH_DETECTION
82 #define NAV_MAX_WAYPOINTS 60
84 #define LED_STRIP
85 #if 1
86 // LED strip configuration using PWM motor output pin 5.
87 #define USE_LED_STRIP_ON_DMA1_CHANNEL3
88 #define WS2811_PIN PA6 // TIM16_CH1
89 #define WS2811_TIMER TIM16
90 #define WS2811_DMA_CHANNEL DMA1_Channel3
91 #define WS2811_IRQ DMA1_Channel3_IRQn
92 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC3
93 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH3_HANDLER
94 #endif
96 #if 0
97 // Alternate LED strip pin
98 // FIXME DMA IRQ Transfer Complete is never called because the TIM17_DMA_RMP needs to be set in SYSCFG_CFGR1
99 #define LED_STRIP_TIMER TIM17
101 #define USE_LED_STRIP_ON_DMA1_CHANNEL7
102 #define WS2811_GPIO GPIOA
103 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
104 #define WS2811_GPIO_AF GPIO_AF_1
105 #define WS2811_PIN GPIO_Pin_7 // TIM17_CH1
106 #define WS2811_PIN_SOURCE GPIO_PinSource7
107 #define WS2811_TIMER TIM17
108 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM17
109 #define WS2811_DMA_CHANNEL DMA1_Channel7
110 #define WS2811_IRQ DMA1_Channel7_IRQn
111 #endif
113 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
115 #define SPEKTRUM_BIND
116 // USART2, PA3
117 #define BIND_PIN PA3
119 #define SONAR
120 #define SONAR_TRIGGER_PIN PA2 // PWM6 (PA2) - only 3.3v ( add a 1K Ohms resistor )
121 #define SONAR_ECHO_PIN PB1 // PWM7 (PB1) - only 3.3v ( add a 1K Ohms resistor )
123 #define DEFAULT_RX_FEATURE FEATURE_RX_PPM
125 // Number of available PWM outputs
126 #define MAX_PWM_OUTPUT_PORTS 10
128 // available IO pins (from schematics)
129 //#define TARGET_IO_PORTA (BIT(1)|BIT(2)|BIT(3)|BIT(4)|BIT(6)|BIT(7)|BIT(8)|BIT(9)|BIT(10)|BIT(11)|BIT(12)|BIT(13)|BIT(14)|BIT(15))
130 //#define TARGET_IO_PORTB (BIT(0)|BIT(1)|BIT(10)|BIT(11)|BIT(14)|BIT(15)|BIT(3)|BIT(4)|BIT(5)|BIT(6)|BIT(7)|BIT(8)|BIT(9))
131 // !!TODO - check following lines are correct
132 #define TARGET_IO_PORTA (BIT(1)|BIT(2)|BIT(3)|BIT(4)|BIT(5)|BIT(6)|BIT(7)|BIT(8)|BIT(9)|BIT(10)|BIT(11)|BIT(12)|BIT(13)|BIT(14)|BIT(15))
133 #define TARGET_IO_PORTB (BIT(0)|BIT(1)|BIT(6)|BIT(10)|BIT(11)|BIT(14)|BIT(15)|BIT(3)|BIT(4)|BIT(5)|BIT(6)|BIT(7)|BIT(8)|BIT(9)|BIT(12)|BIT(13))
134 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))
136 #define USABLE_TIMER_CHANNEL_COUNT 11
137 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(15) | TIM_N(17))