add SPL06 in Matek targets
[inav/snaewe.git] / src / main / target / CLRACINGF4AIR / target.h
blobdab824e03684b106a31a54861172865387491246
1 /*
2 * This is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation, either version 3 of the License, or
5 * (at your option) any later version.
7 * This software is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this software. If not, see <http://www.gnu.org/licenses/>.
15 #pragma once
17 #if defined(CLRACINGF4AIRV2)
18 #define TARGET_BOARD_IDENTIFIER "CLA2"
19 #define USBD_PRODUCT_STRING "CLRACINGF4AIRV2"
20 #elif defined(CLRACINGF4AIRV3)
21 #define TARGET_BOARD_IDENTIFIER "CLA3"
22 #define USBD_PRODUCT_STRING "CLRACINGF4AIRV3"
23 #else
24 #define TARGET_BOARD_IDENTIFIER "CLRA"
25 #define USBD_PRODUCT_STRING "CLRACINGF4AIR"
26 #endif
27 #if defined(CLRACINGF4AIRV3)
28 #define LED0 PC14
29 #else
30 #define LED0 PB5
31 #endif
32 #define BEEPER PB4
33 #define BEEPER_INVERTED
35 #define USE_SPI
36 #define USE_SPI_DEVICE_1
37 #define USE_SPI_DEVICE_3
38 #define SPI3_NSS_PIN PA15
39 #define SPI3_SCK_PIN PC10
40 #define SPI3_MISO_PIN PC11
41 #if defined(CLRACINGF4AIRV3)
42 #define SPI3_MOSI_PIN PB5
43 #else
44 #define SPI3_MOSI_PIN PC12
45 #endif
47 //MPU-9250
48 #define MPU9250_CS_PIN PA4
49 #define MPU9250_SPI_BUS BUS_SPI1
50 #define USE_IMU_MPU9250
51 #define IMU_MPU9250_ALIGN CW0_DEG
53 #define USE_MAG
54 #define USE_MAG_MPU9250
56 // MPU6 interrupts
57 #define USE_EXTI
58 #define GYRO_INT_EXTI PC4
59 #define USE_MPU_DATA_READY_SIGNAL
61 #define USE_BARO
62 #define USE_BARO_BMP280
63 #define USE_BARO_SPI_BMP280
64 #define BMP280_SPI_BUS BUS_SPI3
65 #define BMP280_CS_PIN PB3
67 #define USE_MAX7456
68 #define MAX7456_SPI_BUS BUS_SPI3
69 #define MAX7456_CS_PIN PA15
71 #define USE_LED_STRIP
72 #define WS2811_PIN PB8
74 #define USE_VCP
76 #define USE_UART_INVERTER
78 #define USE_UART1
79 #define UART1_RX_PIN PA10
80 #define UART1_TX_PIN PA9
81 #define UART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2
82 #define INVERTER_PIN_UART1_RX PC0 // PC0 used as inverter select GPIO
84 #if defined( CLRACINGF4AIRV2) || defined(CLRACINGF4AIRV3)
85 #define USE_UART2
86 #define UART2_RX_PIN PA2
87 #define UART2_TX_PIN PA3
88 #endif
89 #define USE_UART3
90 #define UART3_RX_PIN PB11
91 #define UART3_TX_PIN PB10
92 #define USE_UART4
93 #define UART4_RX_PIN PA1
94 #define UART4_TX_PIN PA0
95 #define USE_UART6
96 #define UART6_RX_PIN PC7
97 #define UART6_TX_PIN PC6
98 #if defined( CLRACINGF4AIRV2 )
99 #define SERIAL_PORT_COUNT 6 //VCP, USART1, UART2, USART3,USART4, USART6,
100 #elif defined(CLRACINGF4AIRV3)
101 #define USE_UART5
102 #define UART5_RX_PIN PD2
103 #define UART5_TX_PIN PC12
104 #define SERIAL_PORT_COUNT 7 //VCP, USART1, UART2, USART3,USART4, USART5,USART6,
105 #else
106 #define SERIAL_PORT_COUNT 5 //VCP, USART1, USART3,USART4, USART6,
107 #endif
108 #define USE_ESCSERIAL
109 #define ESCSERIAL_TIMER_TX_HARDWARE 0 // PWM 1
110 #if defined( CLRACINGF4AIRV2 ) || defined(CLRACINGF4AIRV3)
111 #define USE_I2C
112 #define I2C_DEVICE (I2CDEV_2)
113 #define I2C2_SCL PB10
114 #define I2C2_SDA PB11
116 #define TEMPERATURE_I2C_BUS BUS_I2C2
117 #define BNO055_I2C_BUS BUS_I2C2
118 #define MAG_I2C_BUS BUS_I2C2
119 #endif
121 #define USE_ADC
122 #define ADC_INSTANCE ADC1
123 #define ADC_CHANNEL_1_PIN PC1
124 #define ADC_CHANNEL_2_PIN PC2
125 #define ADC_CHANNEL_3_PIN PC3
127 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_1
128 #define VBAT_ADC_CHANNEL ADC_CHN_2
129 #define RSSI_ADC_CHANNEL ADC_CHN_3
131 // V2 has airspeed input
132 #if defined( CLRACINGF4AIRV2 ) || defined(CLRACINGF4AIRV3)
133 #define ADC_CHANNEL_4_PIN PC5
134 #define ADC_AIRSPEED_CHANNEL ADC_CHN_4
135 #define CURRENT_METER_SCALE 250
136 #endif
138 #define USE_ESC_SENSOR
139 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_CURRENT_METER | FEATURE_TELEMETRY| FEATURE_VBAT | FEATURE_OSD )
141 #define SPEKTRUM_BIND_PIN UART1_RX_PIN
142 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
143 // Number of available PWM outputs
144 #define MAX_PWM_OUTPUT_PORTS 8
145 #define TARGET_MOTOR_COUNT 8
147 #define TARGET_IO_PORTA (0xffff)
148 #define TARGET_IO_PORTB (0xffff)
149 #define TARGET_IO_PORTC (0xffff)
150 #define TARGET_IO_PORTD BIT(2)