Removed need to specify timer peripherals in the target.h files. Now present in the...
[betaflight.git] / src / main / target / STM32F3DISCOVERY / target.h
blob570b3197749a9f97486245d7d6eb8166a0bfdb23
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 "SDF3" // STM Discovery F3
22 #define CONFIG_FASTLOOP_PREFERRED_ACC ACC_NONE
24 #define LED0 PE8 // Blue LEDs - PE8/PE12
25 #define LED0_INVERTED
26 #define LED1 PE10 // Orange LEDs - PE10/PE14
27 #define LED1_INVERTED
29 #define BEEPER PE9 // Red LEDs - PE9/PE13
30 #define BEEPER_INVERTED
32 #define USE_SPI
33 #define USE_SPI_DEVICE_1
34 #define USE_SPI_DEVICE_2
36 #define SPI2_NSS_PIN PB12
37 #define SPI2_SCK_PIN PB13
38 #define SPI2_MISO_PIN PB14
39 #define SPI2_MOSI_PIN PB15
41 #define USE_SD_CARD
43 #define SD_DETECT_PIN PC14
44 #define SD_CS_PIN PB12
45 #define SD_SPI_INSTANCE SPI2
47 //#define USE_FLASHFS
48 //#define USE_FLASH_M25P16
50 //#define M25P16_CS_GPIO GPIOB
51 //#define M25P16_CS_PIN GPIO_Pin_12
52 //#define M25P16_SPI_INSTANCE SPI2
53 // SPI1
54 // PB5 SPI1_MOSI
55 // PB4 SPI1_MISO
56 // PB3 SPI1_SCK
57 // PA15 SPI1_NSS
59 // SPI2
60 // PB15 SPI2_MOSI
61 // PB14 SPI2_MISO
62 // PB13 SPI2_SCK
63 // PB12 SPI2_NSS
65 #define GYRO
66 #define USE_GYRO_L3GD20
68 #define L3GD20_SPI SPI1
69 #define L3GD20_CS_PIN PE3
71 #define GYRO_L3GD20_ALIGN CW270_DEG
73 #define USE_SDCARD
74 #define USE_SDCARD_SPI2
76 #define SDCARD_SPI_INSTANCE SPI2
77 #define SDCARD_SPI_CS_PIN PB12
78 // SPI2 is on the APB1 bus whose clock runs at 36MHz. Divide to under 400kHz for init:
79 #define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 128
80 // Divide to under 25MHz for normal operation:
81 #define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 2
83 // Note, this is the same DMA channel as USART1_RX. Luckily we don't use DMA for USART Rx.
84 #define SDCARD_DMA_CHANNEL_TX DMA1_Channel5
85 #define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA1_FLAG_TC5
87 // Performance logging for SD card operations:
88 // #define AFATFS_USE_INTROSPECTIVE_LOGGING
90 #define ACC
91 #define USE_ACC_LSM303DLHC
93 #define MAG
94 #define USE_MAG_HMC5883
96 #define USE_VCP
97 #define USE_USART1
98 #define USE_USART2
99 #define SERIAL_PORT_COUNT 3
101 #define USE_I2C
102 #define I2C_DEVICE (I2CDEV_1)
104 #define USE_ADC
106 #define ADC_INSTANCE ADC1
107 #define ADC_AHB_PERIPHERAL RCC_AHBPeriph_DMA1
108 #define ADC_DMA_CHANNEL DMA1_Channel1
110 #define VBAT_ADC_GPIO GPIOC
111 #define VBAT_ADC_GPIO_PIN GPIO_Pin_0
112 #define VBAT_ADC_CHANNEL ADC_Channel_6
114 #define CURRENT_METER_ADC_GPIO GPIOC
115 #define CURRENT_METER_ADC_GPIO_PIN GPIO_Pin_1
116 #define CURRENT_METER_ADC_CHANNEL ADC_Channel_7
118 #define RSSI_ADC_GPIO GPIOC
119 #define RSSI_ADC_GPIO_PIN GPIO_Pin_2
120 #define RSSI_ADC_CHANNEL ADC_Channel_8
122 #define EXTERNAL1_ADC_GPIO GPIOC
123 #define EXTERNAL1_ADC_GPIO_PIN GPIO_Pin_3
124 #define EXTERNAL1_ADC_CHANNEL ADC_Channel_9
126 #define LED_STRIP
127 #define LED_STRIP_TIMER TIM16
128 #define WS2811_GPIO GPIOB
129 #define WS2811_GPIO_AHB_PERIPHERAL RCC_AHBPeriph_GPIOB
130 #define WS2811_GPIO_AF GPIO_AF_1
131 #define WS2811_PIN GPIO_Pin_8 // TIM16_CH1
132 #define WS2811_PIN_SOURCE GPIO_PinSource8
133 #define WS2811_TIMER TIM16
134 #define WS2811_TIMER_APB2_PERIPHERAL RCC_APB2Periph_TIM16
135 #define WS2811_DMA_CHANNEL DMA1_Channel3
136 #define WS2811_IRQ DMA1_Channel3_IRQn
137 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC3
138 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_CH3_HANDLER
140 #define LED_STRIP
141 #define LED_STRIP_TIMER TIM16
143 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
145 // IO - 303 in 100pin package
146 #define TARGET_IO_PORTA 0xffff
147 #define TARGET_IO_PORTB 0xffff
148 #define TARGET_IO_PORTC 0xffff
149 #define TARGET_IO_PORTD 0xffff
150 #define TARGET_IO_PORTE 0xffff
151 #define TARGET_IO_PORTF 0x00ff
154 #define USED_TIMERS (TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(8) | TIM_N(16) | TIM_N(17))