[FLYWOOF411] add board documentation
[inav/snaewe.git] / src / main / target / IFLIGHTF4_TWING / target.h
blobcbb9d29428ec29f577565d214c669bb91de703c6
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 "IF4T"
21 #define USBD_PRODUCT_STRING "IFLIGHTF4_TWING"
23 #define LED0 PB5
25 #define BEEPER PB4
26 #define BEEPER_INVERTED
28 // *************** Gyro & ACC **********************
29 #define USE_TARGET_IMU_HARDWARE_DESCRIPTORS // Don't use common busdev descriptors for IMU
31 #define USE_SPI
32 #define USE_SPI_DEVICE_1
33 #define SPI1_SCK_PIN PA5
34 #define SPI1_MISO_PIN PA6
35 #define SPI1_MOSI_PIN PA7
37 #define USE_DUAL_GYRO
39 #define USE_IMU_MPU6500
40 #define IMU_0_ALIGN CW0_DEG
41 #define IMU_1_ALIGN CW0_DEG
43 #define MPU6500_0_CS_PIN PA4
44 #define MPU6500_0_SPI_BUS BUS_SPI1
45 #define MPU6500_0_EXTI_PIN PC4
47 #define MPU6500_1_CS_PIN PC3
48 #define MPU6500_1_SPI_BUS BUS_SPI1
49 #define MPU6500_1_EXTI_PIN PA8
51 #define USE_EXTI
52 #define USE_MPU_DATA_READY_SIGNAL
54 // *************** I2C/Baro/Mag *********************
55 #define USE_I2C
56 #define USE_I2C_DEVICE_1
57 #define I2C1_SCL PB8
58 #define I2C1_SDA PB9
60 #define USE_BARO
61 #define BARO_I2C_BUS BUS_I2C1
62 #define USE_BARO_BMP280
63 #define USE_BARO_DPS310
65 #define USE_MAG
66 #define MAG_I2C_BUS BUS_I2C1
67 #define USE_MAG_HMC5883
68 #define USE_MAG_QMC5883
69 #define USE_MAG_IST8310
70 #define USE_MAG_IST8308
71 #define USE_MAG_MAG3110
72 #define USE_MAG_LIS3MDL
74 #define TEMPERATURE_I2C_BUS BUS_I2C1
76 #define PITOT_I2C_BUS BUS_I2C1
78 #define USE_RANGEFINDER
79 #define RANGEFINDER_I2C_BUS BUS_I2C1
81 #define PCA9685_I2C_BUS BUS_I2C1
83 // *************** OSD *****************************
84 #define USE_SPI_DEVICE_2
85 #define SPI2_SCK_PIN PB13
86 #define SPI2_MISO_PIN PB14
87 #define SPI2_MOSI_PIN PB15
89 #define USE_OSD
90 #define USE_MAX7456
91 #define MAX7456_SPI_BUS BUS_SPI2
92 #define MAX7456_CS_PIN PB12
94 // *************** FLASH **************************
95 #define USE_SPI_DEVICE_3
96 #define SPI3_SCK_PIN PC10
97 #define SPI3_MISO_PIN PC11
98 #define SPI3_MOSI_PIN PC12
100 #define M25P16_CS_PIN PA15
101 #define M25P16_SPI_BUS BUS_SPI3
103 #define USE_FLASHFS
104 #define USE_FLASH_M25P16
105 #define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT
107 // *************** UART *****************************
108 #define USE_VCP
109 #define VBUS_SENSING_PIN PC5
110 #define VBUS_SENSING_ENABLED
112 #define USE_UART_INVERTER
114 #define USE_UART1
115 #define UART1_RX_PIN PA10
116 #define UART1_TX_PIN PA9
117 #define UART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2
119 #define USE_UART2
120 #define UART2_RX_PIN PA3
121 #define UART2_TX_PIN PA2
122 // PC13 used as inverter select GPIO for UART2
123 #define INVERTER_PIN_UART2_RX PC13
125 #define USE_UART3
126 #define UART3_RX_PIN PB11
127 #define UART3_TX_PIN PB10
129 #define USE_UART6
130 #define UART6_RX_PIN PC7
131 #define UART6_TX_PIN PC6
133 #define SERIAL_PORT_COUNT 5 // VCP, USART1, USART2, USART3, USART6
135 // *************** ADC *****************************
136 #define USE_ADC
137 #define ADC_CHANNEL_1_PIN PC1
138 #define ADC_CHANNEL_2_PIN PC2
139 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_1
140 #define VBAT_ADC_CHANNEL ADC_CHN_2
142 // *************** OTHERS *****************************
143 #define USE_LED_STRIP
144 #define WS2811_PIN PB6
146 #define SERIALRX_PROVIDER SERIALRX_SBUS
147 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
148 #define SERIALRX_UART SERIAL_PORT_USART2
150 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_VBAT | FEATURE_CURRENT_METER | FEATURE_TELEMETRY | FEATURE_OSD | FEATURE_BLACKBOX)
152 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
154 #define TARGET_IO_PORTA (0xffff & ~(BIT(14)|BIT(13)))
155 #define TARGET_IO_PORTB (0xffff & ~(BIT(2)))
156 #define TARGET_IO_PORTC (0xffff & ~(BIT(15)|BIT(14)))
157 #define TARGET_IO_PORTD BIT(2)
159 #define MAX_PWM_OUTPUT_PORTS 4