[FLYWOOF411] add board documentation
[inav/snaewe.git] / src / main / target / KAKUTEF4 / target.h
blob0bc68d3e3d6014b5c3d4f692fe2ccf045fe07206
1 /*
2 * This file is part of INAV.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/.
8 * Alternatively, the contents of this file may be used under the terms
9 * of the GNU General Public License Version 3, as described below:
11 * This file is free software: you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation, either version 3 of the License, or (at your
14 * option) any later version.
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 * Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see http://www.gnu.org/licenses/.
25 #pragma once
26 #if defined(KAKUTEF4V2)
27 # define TARGET_BOARD_IDENTIFIER "KTV2"
28 # define USBD_PRODUCT_STRING "KakuteF4-V2"
29 #else
30 # define TARGET_BOARD_IDENTIFIER "KTV1"
31 # define USBD_PRODUCT_STRING "KakuteF4-V1"
32 #endif
34 #define LED0 PB5
35 #define LED1 PB4
36 #define LED2 PB6
38 #define BEEPER PC9
39 #define BEEPER_INVERTED
41 #define USE_EXTI
42 #define GYRO_INT_EXTI PC5
43 #define USE_MPU_DATA_READY_SIGNAL
45 #define USE_IMU_MPU6500
46 #define IMU_MPU6500_ALIGN CW270_DEG
47 #define MPU6500_CS_PIN PC4
48 #define MPU6500_SPI_BUS BUS_SPI1
51 #ifdef KAKUTEF4V2
52 # define USE_I2C
53 # define USE_I2C_DEVICE_1
54 # define I2C1_SCL PB8 // SCL pad
55 # define I2C1_SDA PB9 // SDA pad
57 # define USE_MAG
58 # define MAG_I2C_BUS BUS_I2C1
59 # define USE_MAG_HMC5883
60 # define MAG_HMC5883_ALIGN CW180_DEG
61 # define USE_MAG_QMC5883
62 # define USE_MAG_MAG3110
63 # define USE_MAG_IST8310
64 # define USE_MAG_IST8308
65 # define USE_MAG_LIS3MDL
67 # define TEMPERATURE_I2C_BUS BUS_I2C1
69 # define USE_BARO
70 # define BARO_I2C_BUS BUS_I2C1
71 # define USE_BARO_MS5611
72 # define USE_BARO_BMP280
73 #endif
75 #define USE_OSD
76 #define USE_MAX7456
77 #define MAX7456_SPI_BUS BUS_SPI3
78 #define MAX7456_CS_PIN PB14
80 #define M25P16_CS_PIN PB3
81 #define M25P16_SPI_BUS BUS_SPI3
83 #define USE_FLASHFS
84 #define USE_FLASH_M25P16
86 #define USB_IO
87 #define USE_VCP
88 #define VBUS_SENSING_PIN PA8
89 #define VBUS_SENSING_ENABLED
91 #define USE_UART_INVERTER
93 #define USE_UART1
94 #define UART1_RX_PIN PA10
95 #define UART1_TX_PIN PA9
97 #define USE_UART3
98 #define UART3_RX_PIN PB11
99 #define UART3_TX_PIN PB10
100 #define INVERTER_PIN_UART3_RX PB15
102 #define USE_UART6
103 #define UART6_RX_PIN PC7
104 #define UART6_TX_PIN PC6
106 #ifdef KAKUTEF4V2
107 # define USE_UART4
108 # define UART4_RX_PIN PA1
109 # define UART4_TX_PIN PA0
111 # define USE_UART5
112 # define UART5_RX_PIN PD2
113 # define UART5_TX_PIN NONE
115 // # define USE_SOFTSERIAL1
116 # define SERIAL_PORT_COUNT 6
117 #else
118 // # define USE_SOFTSERIAL1
119 // # define USE_SOFTSERIAL2
120 # define SERIAL_PORT_COUNT 4
121 #endif
123 #define USE_SPI
125 // SPI1: Connected to ICM gyro
126 #define USE_SPI_DEVICE_1
127 #define SPI1_NSS_PIN PC4
128 #define SPI1_SCK_PIN PA5
129 #define SPI1_MISO_PIN PA6
130 #define SPI1_MOSI_PIN PA7
132 // SPI3: Connected to flash memory
133 #define USE_SPI_DEVICE_3
134 #define SPI3_NSS_PIN PB3
135 #define SPI3_SCK_PIN PC10
136 #define SPI3_MISO_PIN PC11
137 #define SPI3_MOSI_PIN PC12
139 #define USE_ADC
140 #define ADC_CHANNEL_1_PIN PC3
141 #define ADC_CHANNEL_2_PIN PC2
142 #define ADC_CHANNEL_3_PIN PC1
144 #define USE_LED_STRIP
145 #define WS2811_PIN PC8
146 #define WS2811_DMA_HANDLER_IDENTIFER DMA2_ST4_HANDLER
147 #define WS2811_DMA_STREAM DMA2_Stream4
148 #define WS2811_DMA_CHANNEL DMA_Channel_7
150 #define VBAT_ADC_CHANNEL ADC_CHN_1
151 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
152 #define RSSI_ADC_CHANNEL ADC_CHN_3
154 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_TELEMETRY | FEATURE_OSD)
155 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
156 #define SERIALRX_PROVIDER SERIALRX_SBUS
157 #define SERIALRX_UART SERIAL_PORT_USART3
158 #define TELEMETRY_UART SERIAL_PORT_USART1
160 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
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))
167 #define USE_DSHOT
168 #define USE_SERIALSHOT
169 #define USE_ESC_SENSOR
171 #ifdef KAKUTEF4V2
172 # define MAX_PWM_OUTPUT_PORTS 4
173 #else
174 # define MAX_PWM_OUTPUT_PORTS 6
175 #endif