Adding support for UART0 (#14094)
[betaflight.git] / src / main / target / common_defaults_post.h
blob820eba06772c0ce41228c58076d8c69d11f536f7
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 // pg/max7456
23 #ifndef DEBUG_MODE
24 #define DEBUG_MODE DEBUG_NONE
25 #endif
27 #ifndef I2C1_CLOCKSPEED
28 #define I2C1_CLOCKSPEED 800
29 #endif
30 #ifndef I2C2_CLOCKSPEED
31 #define I2C2_CLOCKSPEED 800
32 #endif
33 #ifndef I2C3_CLOCKSPEED
34 #define I2C3_CLOCKSPEED 800
35 #endif
36 #ifndef I2C4_CLOCKSPEED
37 #define I2C4_CLOCKSPEED 800
38 #endif
40 // Default values for internal pullup
42 #if defined(USE_I2C_PULLUP)
43 #define I2C1_PULLUP true
44 #define I2C2_PULLUP true
45 #define I2C3_PULLUP true
46 #define I2C4_PULLUP true
47 #else
48 #define I2C1_PULLUP false
49 #define I2C2_PULLUP false
50 #define I2C3_PULLUP false
51 #define I2C4_PULLUP false
52 #endif
54 // Extracted from rx/rx.c and rx/rx.h
56 #define RX_MAPPABLE_CHANNEL_COUNT 8
58 #ifndef RX_SPI_DEFAULT_PROTOCOL
59 #define RX_SPI_DEFAULT_PROTOCOL 0
60 #endif
62 #define RX_MIN_USEC 885
63 #define RX_MAX_USEC 2115
64 #define RX_MID_USEC 1500
66 #ifndef SPEKTRUM_BIND_PIN
67 #define SPEKTRUM_BIND_PIN NONE
68 #endif
70 #ifndef BINDPLUG_PIN
71 #define BINDPLUG_PIN NONE
72 #endif
74 // Previously there was logic here to default GYRO_1_CUSTOM_ALIGN and GYRO_2_CUSTOM_ALIGN
75 // to CUSTOM_ALIGN_CW0_DEG if they weren't defined in the target. The defaulting logic
76 // has been moved to pg/gyrodev.c to set the custom alignment based on the sensor alignment
77 // if a custom alignment is not applied in the target.
79 #ifdef USE_VCP
80 #ifndef USB_DETECT_PIN
81 #define USB_DETECT_PIN NONE
82 #endif
83 #ifndef USB_MSC_BUTTON_PIN
84 #define USB_MSC_BUTTON_PIN NONE
85 #endif
86 #if !defined(MSC_BUTTON_IPU)
87 #define MSC_BUTTON_IPU true
88 #endif
89 #endif
91 #ifdef USE_TIMER_MGMT
92 #ifndef MAX_TIMER_PINMAP_COUNT
93 #define MAX_TIMER_PINMAP_COUNT 21 // Largest known for F405RG (OMNINXT)
94 #endif
95 #endif
97 #ifndef DEFAULT_MIXER
98 #define DEFAULT_MIXER MIXER_QUADX
99 #endif
101 #if defined(USE_RANGEFINDER) && defined(USE_RANGEFINDER_HCSR04)
102 #ifndef RANGEFINDER_HCSR04_TRIGGER_PIN
103 #define RANGEFINDER_HCSR04_TRIGGER_PIN NONE
104 #endif
105 #ifndef RANGEFINDER_HCSR04_ECHO_PIN
106 #define RANGEFINDER_HCSR04_ECHO_PIN NONE
107 #endif
108 #endif
110 // Mag
111 #if defined(USE_MAG)
112 #ifndef MAG_SPI_INSTANCE
113 #define MAG_SPI_INSTANCE NULL
114 #endif
115 #ifndef MAG_CS_PIN
116 #define MAG_CS_PIN NONE
117 #endif
118 #ifndef MAG_I2C_INSTANCE
119 #define MAG_I2C_INSTANCE I2C_DEVICE
120 #endif
121 #endif
123 #ifndef MAG_INT_EXTI
124 #define MAG_INT_EXTI NONE
125 #endif
127 // Baro
128 #if defined(USE_BARO)
129 #ifndef BARO_SPI_INSTANCE
130 #define BARO_SPI_INSTANCE NULL
131 #endif
132 #ifndef BARO_CS_PIN
133 #define BARO_CS_PIN NONE
134 #endif
135 #ifndef BARO_I2C_INSTANCE
136 #define BARO_I2C_INSTANCE I2C_DEVICE
137 #endif
138 #ifndef BARO_XCLR_PIN
139 #define BARO_XCLR_PIN NONE
140 #endif
141 #endif
143 #ifdef USE_ADC
145 #if !defined(ADC1_DMA_OPT)
146 #define ADC1_DMA_OPT (DMA_OPT_UNUSED)
147 #endif
148 #if !defined(ADC2_DMA_OPT)
149 #define ADC2_DMA_OPT (DMA_OPT_UNUSED)
150 #endif
151 #if !defined(ADC3_DMA_OPT)
152 #define ADC3_DMA_OPT (DMA_OPT_UNUSED)
153 #endif
154 #if !defined(ADC4_DMA_OPT)
155 #define ADC4_DMA_OPT (DMA_OPT_UNUSED)
156 #endif
157 #if !defined(ADC5_DMA_OPT)
158 #define ADC5_DMA_OPT (DMA_OPT_UNUSED)
159 #endif
161 #endif // USE_ADC
163 #ifdef USE_SPI
164 #ifdef USE_SPI_DEVICE_1
165 #ifndef SPI1_TX_DMA_OPT
166 #define SPI1_TX_DMA_OPT (DMA_OPT_UNUSED)
167 #endif
168 #ifndef SPI1_RX_DMA_OPT
169 #define SPI1_RX_DMA_OPT (DMA_OPT_UNUSED)
170 #endif
171 #endif
172 #ifdef USE_SPI_DEVICE_2
173 #ifndef SPI2_TX_DMA_OPT
174 #define SPI2_TX_DMA_OPT (DMA_OPT_UNUSED)
175 #endif
176 #ifndef SPI2_RX_DMA_OPT
177 #define SPI2_RX_DMA_OPT (DMA_OPT_UNUSED)
178 #endif
179 #endif
180 #ifdef USE_SPI_DEVICE_3
181 #ifndef SPI3_TX_DMA_OPT
182 #define SPI3_TX_DMA_OPT (DMA_OPT_UNUSED)
183 #endif
184 #ifndef SPI3_RX_DMA_OPT
185 #define SPI3_RX_DMA_OPT (DMA_OPT_UNUSED)
186 #endif
187 #endif
188 #ifdef USE_SPI_DEVICE_4
189 #ifndef SPI4_TX_DMA_OPT
190 #define SPI4_TX_DMA_OPT (DMA_OPT_UNUSED)
191 #endif
192 #ifndef SPI4_RX_DMA_OPT
193 #define SPI4_RX_DMA_OPT (DMA_OPT_UNUSED)
194 #endif
195 #endif
196 #ifdef USE_SPI_DEVICE_5
197 #ifndef SPI5_TX_DMA_OPT
198 #define SPI5_TX_DMA_OPT (DMA_OPT_UNUSED)
199 #endif
200 #ifndef SPI5_RX_DMA_OPT
201 #define SPI5_RX_DMA_OPT (DMA_OPT_UNUSED)
202 #endif
203 #endif
204 #ifdef USE_SPI_DEVICE_6
205 #ifndef SPI6_TX_DMA_OPT
206 #define SPI6_TX_DMA_OPT (DMA_OPT_UNUSED)
207 #endif
208 #ifndef SPI6_RX_DMA_OPT
209 #define SPI6_RX_DMA_OPT (DMA_OPT_UNUSED)
210 #endif
211 #endif
212 #endif
214 #ifdef USE_UART0
215 #ifndef UART0_TX_DMA_OPT
216 #define UART0_TX_DMA_OPT (DMA_OPT_UNUSED)
217 #endif
218 #ifndef UART0_RX_DMA_OPT
219 #define UART0_RX_DMA_OPT (DMA_OPT_UNUSED)
220 #endif
221 #endif
223 #ifdef USE_UART1
224 #ifndef UART1_TX_DMA_OPT
225 #define UART1_TX_DMA_OPT (DMA_OPT_UNUSED)
226 #endif
227 #ifndef UART1_RX_DMA_OPT
228 #define UART1_RX_DMA_OPT (DMA_OPT_UNUSED)
229 #endif
230 #endif
232 #ifdef USE_UART2
233 #ifndef UART2_TX_DMA_OPT
234 #define UART2_TX_DMA_OPT (DMA_OPT_UNUSED)
235 #endif
236 #ifndef UART2_RX_DMA_OPT
237 #define UART2_RX_DMA_OPT (DMA_OPT_UNUSED)
238 #endif
239 #endif
241 #ifdef USE_UART3
242 #ifndef UART3_TX_DMA_OPT
243 #define UART3_TX_DMA_OPT (DMA_OPT_UNUSED)
244 #endif
245 #ifndef UART3_RX_DMA_OPT
246 #define UART3_RX_DMA_OPT (DMA_OPT_UNUSED)
247 #endif
248 #endif
250 #ifdef USE_UART4
251 #ifndef UART4_TX_DMA_OPT
252 #define UART4_TX_DMA_OPT (DMA_OPT_UNUSED)
253 #endif
254 #ifndef UART4_RX_DMA_OPT
255 #define UART4_RX_DMA_OPT (DMA_OPT_UNUSED)
256 #endif
257 #endif
259 #ifdef USE_UART5
260 #ifndef UART5_TX_DMA_OPT
261 #define UART5_TX_DMA_OPT (DMA_OPT_UNUSED)
262 #endif
263 #ifndef UART5_RX_DMA_OPT
264 #define UART5_RX_DMA_OPT (DMA_OPT_UNUSED)
265 #endif
266 #endif
268 #ifdef USE_UART6
269 #ifndef UART6_TX_DMA_OPT
270 #define UART6_TX_DMA_OPT (DMA_OPT_UNUSED)
271 #endif
272 #ifndef UART6_RX_DMA_OPT
273 #define UART6_RX_DMA_OPT (DMA_OPT_UNUSED)
274 #endif
275 #endif
277 #ifdef USE_UART7
278 #ifndef UART7_TX_DMA_OPT
279 #define UART7_TX_DMA_OPT (DMA_OPT_UNUSED)
280 #endif
281 #ifndef UART7_RX_DMA_OPT
282 #define UART7_RX_DMA_OPT (DMA_OPT_UNUSED)
283 #endif
284 #endif
286 #ifdef USE_UART8
287 #ifndef UART8_TX_DMA_OPT
288 #define UART8_TX_DMA_OPT (DMA_OPT_UNUSED)
289 #endif
290 #ifndef UART8_RX_DMA_OPT
291 #define UART8_RX_DMA_OPT (DMA_OPT_UNUSED)
292 #endif
293 #endif
295 #ifdef USE_UART9
296 #ifndef UART9_TX_DMA_OPT
297 #define UART9_TX_DMA_OPT (DMA_OPT_UNUSED)
298 #endif
299 #ifndef UART9_RX_DMA_OPT
300 #define UART9_RX_DMA_OPT (DMA_OPT_UNUSED)
301 #endif
302 #endif
304 #ifdef USE_UART10
305 #ifndef UART10_TX_DMA_OPT
306 #define UART10_TX_DMA_OPT (DMA_OPT_UNUSED)
307 #endif
308 #ifndef UART10_RX_DMA_OPT
309 #define UART10_RX_DMA_OPT (DMA_OPT_UNUSED)
310 #endif
311 #endif
313 #ifndef RTC6705_CS_PIN
314 #define RTC6705_CS_PIN NONE
315 #endif
317 #ifndef RTC6705_POWER_PIN
318 #define RTC6705_POWER_PIN NONE
319 #endif
321 #ifndef RTC6705_SPICLK_PIN
322 #define RTC6705_SPICLK_PIN NONE
323 #endif
325 #ifndef RTC6705_SPI_SDO_PIN
326 #define RTC6705_SPI_SDO_PIN NONE
327 #endif
329 #ifndef RTC6705_SPI_INSTANCE
330 #define RTC6705_SPI_INSTANCE NULL
331 #endif
333 #if defined(USE_QUAD_MIXER_ONLY)
334 #define MAX_SUPPORTED_MOTORS 4
335 #define MAX_SUPPORTED_SERVOS 1
336 #else
337 #ifndef MAX_SUPPORTED_MOTORS
338 #define MAX_SUPPORTED_MOTORS 8
339 #endif
340 #define MAX_SUPPORTED_SERVOS 8
341 #endif
343 #ifndef BOX_USER1_NAME
344 #define BOX_USER1_NAME "USER1"
345 #endif
347 #ifndef BOX_USER2_NAME
348 #define BOX_USER2_NAME "USER2"
349 #endif
351 #ifndef BOX_USER3_NAME
352 #define BOX_USER3_NAME "USER3"
353 #endif
355 #ifndef BOX_USER4_NAME
356 #define BOX_USER4_NAME "USER4"
357 #endif