LED updates
[betaflight.git] / src / main / target / CHEBUZZF3 / target.h
blob816ad857ec9bc544cd2e6f945ca79ad6b9c97fa6
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 "CHF3" // Chebuzz F3
22 #define LED0 PE8 // Blue LEDs - PE8/PE12
23 #define LED0_INVERTED
24 #define LED1 PE10 // Orange LEDs - PE10/PE14
25 #define LED1_INVERTED
27 #define BEEPER PE9 // Red LEDs - PE9/PE13
28 #define BEEPER_INVERTED
30 #define USABLE_TIMER_CHANNEL_COUNT 18
32 #define USE_SPI
33 #define USE_SPI_DEVICE_1
34 #define USE_SPI_DEVICE_2
36 #define SPI2_GPIO GPIOB
37 #define SPI2_GPIO_PERIPHERAL RCC_AHBPeriph_GPIOB
38 #define SPI2_NSS_PIN Pin_12
39 #define SPI2_NSS_PIN_SOURCE GPIO_PinSource12
40 #define SPI2_SCK_PIN Pin_13
41 #define SPI2_SCK_PIN_SOURCE GPIO_PinSource13
42 #define SPI2_MISO_PIN Pin_14
43 #define SPI2_MISO_PIN_SOURCE GPIO_PinSource14
44 #define SPI2_MOSI_PIN Pin_15
45 #define SPI2_MOSI_PIN_SOURCE GPIO_PinSource15
47 #define USE_SDCARD
48 #define USE_SDCARD_SPI2
50 #define SDCARD_DETECT_PIN GPIO_Pin_14
51 #define SDCARD_DETECT_EXTI_LINE EXTI_Line14
52 #define SDCARD_DETECT_EXTI_PIN_SOURCE EXTI_PinSource14
53 #define SDCARD_DETECT_GPIO_PORT GPIOC
54 #define SDCARD_DETECT_GPIO_CLK RCC_AHBPeriph_GPIOC
55 #define SDCARD_DETECT_EXTI_PORT_SOURCE EXTI_PortSourceGPIOC
56 #define SDCARD_DETECT_EXTI_IRQn EXTI15_10_IRQn
58 #define SDCARD_SPI_INSTANCE SPI2
59 #define SDCARD_SPI_CS_GPIO SPI2_GPIO
60 #define SDCARD_SPI_CS_PIN SPI2_NSS_PIN
62 // SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
63 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 128
64 // Divide to under 25MHz for normal operation:
65 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 2
67 // Note, this is the same DMA channel as USART1_RX. Luckily we don't use DMA for USART Rx.
68 #define SDCARD_DMA_CHANNEL_TX DMA1_Channel5
69 #define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA1_FLAG_TC5
71 //#define USE_FLASHFS
72 //#define USE_FLASH_M25P16
74 //#define M25P16_CS_GPIO GPIOB
75 //#define M25P16_CS_PIN GPIO_Pin_12
76 //#define M25P16_SPI_INSTANCE SPI2
78 #define GYRO
79 #define USE_GYRO_L3GD20
80 #define USE_GYRO_MPU6050
82 #define L3GD20_SPI SPI1
83 #define L3GD20_CS_GPIO_CLK_PERIPHERAL RCC_AHBPeriph_GPIOE
84 #define L3GD20_CS_GPIO GPIOE
85 #define L3GD20_CS_PIN GPIO_Pin_3
87 #define GYRO_L3GD20_ALIGN CW270_DEG
88 #define GYRO_MPU6050_ALIGN CW0_DEG
90 #define ACC
91 #define USE_ACC_MPU6050
92 #define USE_ACC_LSM303DLHC
94 #define ACC_MPU6050_ALIGN CW0_DEG
96 #define BARO
97 #define USE_BARO_MS5611
99 #define MAG
100 #define USE_MAG_AK8975
102 #define MAG_AK8975_ALIGN CW90_DEG_FLIP
104 #define USE_VCP
105 #define USE_USART1
106 #define USE_USART2
107 #define SERIAL_PORT_COUNT 3
109 #define USE_I2C
110 #define I2C_DEVICE (I2CDEV_1)
112 #define USE_ADC
114 #define ADC_INSTANCE ADC1
115 #define ADC_AHB_PERIPHERAL RCC_AHBPeriph_DMA1
116 #define ADC_DMA_CHANNEL DMA1_Channel1
118 #define VBAT_ADC_GPIO GPIOC
119 #define VBAT_ADC_GPIO_PIN GPIO_Pin_0
120 #define VBAT_ADC_CHANNEL ADC_Channel_6
122 #define CURRENT_METER_ADC_GPIO GPIOC
123 #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_1
124 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_7
126 #define RSSI_ADC_GPIO GPIOC
127 #define RSSI_ADC_GPIO_PIN GPIO_Pin_2
128 #define RSSI_ADC_CHANNEL ADC_Channel_8
130 #define EXTERNAL1_ADC_GPIO GPIOC
131 #define EXTERNAL1_ADC_GPIO_PIN GPIO_Pin_3
132 #define EXTERNAL1_ADC_CHANNEL ADC_Channel_9
134 #define GPS
135 #define LED_STRIP
136 #if 1
137 #define LED_STRIP_TIMER TIM16
138 #else
139 // alternative LED strip configuration, tested working.
140 #define LED_STRIP_TIMER TIM1
142 #define USE_LED_STRIP_ON_DMA1_CHANNEL2
143 #define WS2811_GPIO GPIOA
144 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOA
145 #define WS2811_GPIO_AF GPIO_AF_6
146 #define WS2811_PIN GPIO_Pin_8
147 #define WS2811_PIN_SOURCE GPIO_PinSource8
148 #define WS2811_TIMER TIM1
149 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM1
150 #define WS2811_DMA_CHANNEL DMA1_Channel2
151 #define WS2811_IRQ DMA1_Channel2_IRQn
152 #endif
154 #define BLACKBOX
155 #define GTUNE
156 #define TELEMETRY
157 #define SERIAL_RX
158 #define USE_SERVOS
159 #define USE_CLI
161 // IO - assuming 303 in 64pin package, TODO
162 #define TARGET_IO_PORTA 0xffff
163 #define TARGET_IO_PORTB 0xffff
164 #define TARGET_IO_PORTC 0xffff
165 #define TARGET_IO_PORTD (BIT(2))
166 #define TARGET_IO_PORTF (BIT(0)|BIT(1)|BIT(4))