[FLYWOOF411] add board documentation
[inav/snaewe.git] / src / main / target / FF_PIKOF4 / target.h
blob59337ad53b0505e64e7032c3c2ff7fa75c03b713
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
19 #if defined(FF_PIKOF4OSD)
20 #define TARGET_BOARD_IDENTIFIER "PKOS"
21 #define USBD_PRODUCT_STRING "PikoF4OSD"
22 #else
23 #define TARGET_BOARD_IDENTIFIER "PIK4"
24 #define USBD_PRODUCT_STRING "PikoF4"
25 #endif
26 /*--------------LED----------------*/
27 #if defined(FF_PIKOF4OSD)
28 #define LED0 PB5
29 #define LED1 PB4
30 #else
31 #define LED0 PA15
32 #define LED1 PB6
33 #endif
34 /*---------------------------------*/
36 /*------------BEEPER---------------*/
37 #define BEEPER PA14
38 #define BEEPER_INVERTED
39 /*---------------------------------*/
41 /*----------CAMERA CONTROL---------*/
42 // #define CAMERA_CONTROL_PIN PB7
43 /*---------------------------------*/
45 /*------------SENSORS--------------*/
46 // MPU interrupt
47 #define USE_EXTI
48 #define GYRO_INT_EXTI PC4
49 //#define DEBUG_MPU_DATA_READY_INTERRUPT
50 #define USE_MPU_DATA_READY_SIGNAL
51 #define ENSURE_MPU_DATA_READY_IS_LOW
53 #if defined(FF_PIKOF4OSD)
54 #define MPU6000_CS_PIN PA15
55 #define MPU6000_SPI_BUS BUS_SPI3
57 #define MPU6500_CS_PIN PA15
58 #define MPU6500_SPI_BUS BUS_SPI3
59 #else
60 #define MPU6000_CS_PIN PA4
61 #define MPU6000_SPI_BUS BUS_SPI1
63 #define MPU6500_CS_PIN PA4
64 #define MPU6500_SPI_BUS BUS_SPI1
65 #endif
67 #define USE_IMU_MPU6000
68 #define IMU_MPU6000_ALIGN CW180_DEG
70 #define USE_IMU_MPU6500
71 #define IMU_MPU6500_ALIGN CW180_DEG
72 /*---------------------------------*/
74 #if defined(FF_PIKOF4OSD)
75 /*-------------OSD-----------------*/
76 #define USE_OSD
77 #define USE_MAX7456
78 #define MAX7456_SPI_BUS BUS_SPI1
79 #define MAX7456_CS_PIN PA4
80 //#define MAX7456_SPI_CLK (SPI_CLOCK_STANDARD) // 10MHz
81 //#define MAX7456_RESTORE_CLK (SPI_CLOCK_FAST)
82 /*---------------------------------*/
83 #else
84 /*------------FLASH----------------*/
85 #define M25P16_CS_PIN PB3
86 #define M25P16_SPI_BUS BUS_SPI3
88 #define USE_FLASHFS
89 #define USE_FLASH_M25P16
90 /*---------------------------------*/
91 #endif
93 /*-----------USB-UARTs-------------*/
94 #define USB_IO
95 #define USE_VCP
96 //#define VBUS_SENSING_PIN PA8
97 //#define VBUS_SENSING_ENABLED
99 #define USE_UART_INVERTER
101 #define USE_UART1
102 #define UART1_RX_PIN PA10
103 #define UART1_TX_PIN PA9
105 #define USE_UART3
106 #define UART3_RX_PIN PB11
107 #define UART3_TX_PIN PB10
108 #if defined(FF_PIKOF4OSD)
109 #define INVERTER_PIN_UART3_RX PC3
110 #else
111 #define INVERTER_PIN_UART3_RX PC8
112 #endif
114 #define USE_UART4
115 #define UART4_TX_PIN PA0
116 #define UART4_RX_PIN PA1
118 #define USE_UART6
119 #define UART6_RX_PIN PC7
120 #define UART6_TX_PIN PC6
122 #define SERIAL_PORT_COUNT 5
125 /*---------------------------------*/
127 /*-------------SPIs----------------*/
128 #define USE_SPI
130 #define USE_SPI_DEVICE_1
131 #define SPI1_NSS_PIN PA4
132 #define SPI1_SCK_PIN PA5
133 #define SPI1_MISO_PIN PA6
134 #define SPI1_MOSI_PIN PA7
136 #define USE_SPI_DEVICE_3
137 #if defined(FF_PIKOF4OSD)
138 #define SPI3_NSS_PIN PA15
139 #else
140 #define SPI3_NSS_PIN PB3
141 #endif
142 #define SPI3_SCK_PIN PC10
143 #define SPI3_MISO_PIN PC11
144 #define SPI3_MOSI_PIN PC12
145 /*---------------------------------*/
147 /*-------------ADCs----------------*/
148 #define USE_ADC
149 #define ADC1_DMA_STREAM DMA2_Stream0
150 #define ADC_CHANNEL_1_PIN PC2
151 #define VBAT_ADC_CHANNEL ADC_CHN_1
152 #if defined(FF_PIKOF4OSD)
153 #define ADC_CHANNEL_2_PIN PC1
154 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
155 #endif
156 /*---------------------------------*/
158 /*-----------LED Strip-------------*/
159 #define USE_LED_STRIP
160 #define WS2811_PIN PB7
161 #define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST2_HANDLER
162 #define WS2811_DMA_STREAM DMA1_Stream2
163 #define WS2811_DMA_CHANNEL DMA_Channel_3
164 /*---------------------------------*/
166 /*-------------ESCs----------------*/
167 #define USE_ESC_SENSOR
168 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
169 #define USE_ESCSERIAL
170 #define ESCSERIAL_TIMER_TX_PIN PA3 // (HARDARE=0)
171 /*---------------------------------*/
173 /*--------DEFAULT VALUES-----------*/
174 #if defined(FF_PIKOF4OSD)
175 #define DEFAULT_FEATURES ( FEATURE_TELEMETRY | FEATURE_OSD )
176 #endif
177 #define SERIALRX_PROVIDER SERIALRX_SBUS
178 #define SERIALRX_UART SERIAL_PORT_USART3
180 #define TARGET_IO_PORTA 0xffff
181 #define TARGET_IO_PORTB 0xffff
182 #define TARGET_IO_PORTC 0xffff
183 #define TARGET_IO_PORTD (BIT(2))
184 /*---------------------------------*/
186 /*--------------TIMERS-------------*/
187 #if defined(FF_PIKOF4OSD)
188 #define MAX_PWM_OUTPUT_PORTS 7
189 #else
190 #define MAX_PWM_OUTPUT_PORTS 5
191 #endif
192 /*---------------------------------*/