Skip to content

Commit e61568d

Browse files
committed
Refactor: Split OMNIBUSF4 family into 4 target directories
Previously 9 targets were tangled together into one set of files Directory structure: - DYSF4/ (2 targets): DYSF4PRO, DYSF4PROV2 - Different I2C bus routing (I2C1 vs I2C2) - Different RSSI ADC pin (PC3 vs PA0) - Uses SPI flash for blackbox - OMNIBUSF4/ (1 target): OMNIBUSF4 - Original variant with SPI flash - OMNIBUSF4PRO/ (3 targets): OMNIBUSF4PRO, OMNIBUSF4V3, OMNIBUSF4V3_ICM - Base variants with SD card - No softserial configurations - V3 has UART6 inverter pins - OMNIBUSF4V3_SS/ (3 targets): OMNIBUSF4V3_S6_SS, OMNIBUSF4V3_S5S6_SS, OMNIBUSF4V3_S5_S6_2SS - Softserial variants with different S5/S6 timer configs - Based on OMNIBUSF4V3 hardware Used unifdef to remove irrelevant conditional compilation blocks while preserving exact functionality. Verified with gcc -E preprocessor comparison - all 9 targets produce identical preprocessed output. All 9 targets build successfully.
1 parent fce465e commit e61568d

File tree

6 files changed

+275
-40
lines changed

6 files changed

+275
-40
lines changed
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# the OMNIBUSF4SD has an SDCARD instead of flash, a BMP280 baro and therefore a slightly different ppm/pwm and SPI mapping
1+
# OMNIBUSF4PRO has SD card, BMP280 baro
22
target_stm32f405xg(OMNIBUSF4PRO)
3-
target_stm32f405xg(OMNIBUSF4V3_S5_S6_2SS)
4-
target_stm32f405xg(OMNIBUSF4V3_S5S6_SS)
5-
target_stm32f405xg(OMNIBUSF4V3_S6_SS)
6-
# OMNIBUSF4V3 is a (almost identical) variant of OMNIBUSF4PRO target,
7-
# except for an inverter on UART6.
3+
# OMNIBUSF4V3 is similar to PRO but with UART6 inverter
84
target_stm32f405xg(OMNIBUSF4V3)
95
target_stm32f405xg(OMNIBUSF4V3_ICM SKIP_RELEASES)

src/main/target/OMNIBUSF4PRO/target.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ timerHardware_t timerHardware[] = {
3535

3636
DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT
3737
DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT
38-
#elif defined(OMNIBUSF4V3_S5S6_SS) || defined(OMNIBUSF4V3_S5_S6_2SS)
39-
DEF_TIM(TIM5, CH2, PA1, TIM_USE_ANY, 0, 0), // S5_OUT SOFTSERIAL
40-
DEF_TIM(TIM1, CH1, PA8, TIM_USE_ANY, 0, 0), // S6_OUT SOFTSERIAL
41-
#elif defined(OMNIBUSF4V3_S6_SS)
42-
DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT
43-
DEF_TIM(TIM1, CH1, PA8, TIM_USE_ANY, 0, 0), // S6_OUT SOFTSERIAL
4438
#else
4539
DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT MOTOR, SERVO or LED
4640
DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT

src/main/target/OMNIBUSF4PRO/target.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
#define OMNIBUSF4PRO
2323
#endif
2424
//Same target as OMNIBUSF4V3 with softserial in M5 and M6
25-
#if defined(OMNIBUSF4V3_S6_SS) || defined(OMNIBUSF4V3_S5S6_SS) || defined(OMNIBUSF4V3_S5_S6_2SS)
26-
#define OMNIBUSF4V3
27-
#endif
2825

2926
#ifdef OMNIBUSF4PRO
3027
#define TARGET_BOARD_IDENTIFIER "OBSD"
@@ -136,31 +133,6 @@
136133

137134
#define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
138135

139-
#elif defined(OMNIBUSF4V3_S6_SS) // one softserial on S6
140-
#define USE_SOFTSERIAL1
141-
#define SOFTSERIAL_1_RX_PIN PA8 // S6 output
142-
#define SOFTSERIAL_1_TX_PIN PA8 // S6 output
143-
144-
#define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
145-
146-
#elif defined(OMNIBUSF4V3_S5S6_SS) // one softserial on S5/RX S6/TX
147-
#define USE_SOFTSERIAL1
148-
#define SOFTSERIAL_1_RX_PIN PA1 // S5 output
149-
#define SOFTSERIAL_1_TX_PIN PA8 // S6 output
150-
151-
#define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
152-
153-
#elif defined(OMNIBUSF4V3_S5_S6_2SS) // two softserials, one on S5 and one on S6
154-
#define USE_SOFTSERIAL1
155-
#define SOFTSERIAL_1_RX_PIN PA1 // S5 output
156-
#define SOFTSERIAL_1_TX_PIN PA1 // S5 output
157-
158-
#define USE_SOFTSERIAL2
159-
#define SOFTSERIAL_2_RX_PIN PA8 // S6 output
160-
#define SOFTSERIAL_2_TX_PIN PA8 // S6 output
161-
162-
#define SERIAL_PORT_COUNT 6 // VCP, USART1, USART3, USART6, SOFTSERIAL1, SOFTSERIAL2
163-
164136
#else // One softserial on versions other than OMNIBUSF4V3
165137
#define USE_SOFTSERIAL1
166138
#define SOFTSERIAL_1_RX_PIN PC8 // pad labelled CH5 on OMNIBUSF4PRO
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# OMNIBUSF4V3 softserial variants with different S5/S6 timer configurations
2+
target_stm32f405xg(OMNIBUSF4V3_S6_SS)
3+
target_stm32f405xg(OMNIBUSF4V3_S5S6_SS)
4+
target_stm32f405xg(OMNIBUSF4V3_S5_S6_2SS)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* This file is part of Cleanflight.
3+
*
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.
8+
*
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.
13+
*
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/>.
16+
*/
17+
18+
#include <stdint.h>
19+
20+
#include <platform.h>
21+
#include "drivers/io.h"
22+
#include "drivers/pwm_mapping.h"
23+
#include "drivers/timer.h"
24+
#include "drivers/bus.h"
25+
26+
timerHardware_t timerHardware[] = {
27+
28+
DEF_TIM(TIM3, CH3, PB0, TIM_USE_OUTPUT_AUTO, 0, 0), // S1_OUT D1_ST7
29+
DEF_TIM(TIM3, CH4, PB1, TIM_USE_OUTPUT_AUTO, 0, 0), // S2_OUT D1_ST2
30+
DEF_TIM(TIM2, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 1), // S3_OUT D1_ST6
31+
DEF_TIM(TIM2, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 0), // S4_OUT D1_ST1
32+
33+
// { TIM9, IO_TAG(PA3), TIM_Channel_2, 1, IOCFG_AF_PP_PD, GPIO_AF_TIM9, TIM_USE_OUTPUT_AUTO }, // MOTOR_3
34+
#if (defined(OMNIBUSF4PRO) || defined(OMNIBUSF4V3)) && !(defined(OMNIBUSF4PRO_LEDSTRIPM5) || defined(OMNIBUSF4V3_S6_SS) || defined(OMNIBUSF4V3_S5S6_SS) || defined(OMNIBUSF4V3_S5_S6_2SS))
35+
36+
DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT
37+
DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT
38+
#elif defined(OMNIBUSF4V3_S5S6_SS) || defined(OMNIBUSF4V3_S5_S6_2SS)
39+
DEF_TIM(TIM5, CH2, PA1, TIM_USE_ANY, 0, 0), // S5_OUT SOFTSERIAL
40+
DEF_TIM(TIM1, CH1, PA8, TIM_USE_ANY, 0, 0), // S6_OUT SOFTSERIAL
41+
#elif defined(OMNIBUSF4V3_S6_SS)
42+
DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT
43+
DEF_TIM(TIM1, CH1, PA8, TIM_USE_ANY, 0, 0), // S6_OUT SOFTSERIAL
44+
#else
45+
DEF_TIM(TIM5, CH2, PA1, TIM_USE_OUTPUT_AUTO, 0, 0), // S5_OUT MOTOR, SERVO or LED
46+
DEF_TIM(TIM1, CH1, PA8, TIM_USE_OUTPUT_AUTO, 0, 0), // S6_OUT
47+
#endif
48+
49+
DEF_TIM(TIM4, CH1, PB6, TIM_USE_LED, 0, 0), // LED strip for F4 V2 / F4-Pro-0X and later (RCD_CS for F4)
50+
51+
// DEF_TIM(TIM10, CH1, PB8, TIM_USE_PPM, 0, 0), // PPM
52+
DEF_TIM(TIM4, CH4, PB9, TIM_USE_ANY, 0, 0), // S2_IN
53+
DEF_TIM(TIM8, CH1, PC6, TIM_USE_ANY, 0, 0), // S3_IN, UART6_TX
54+
DEF_TIM(TIM8, CH2, PC7, TIM_USE_ANY, 0, 0), // S4_IN, UART6_RX
55+
DEF_TIM(TIM8, CH3, PC8, TIM_USE_ANY, 0, 0), // S5_IN // pad labelled CH5 on OMNIBUSF4PRO
56+
DEF_TIM(TIM8, CH4, PC9, TIM_USE_ANY, 0, 0), // S6_IN // pad labelled CH6 on OMNIBUSF4PRO
57+
58+
};
59+
60+
const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
/*
2+
* This file is part of Cleanflight.
3+
*
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.
8+
*
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.
13+
*
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/>.
16+
*/
17+
18+
#pragma once
19+
20+
//Same target as OMNIBUSF4PRO with LED strip in M5
21+
//Same target as OMNIBUSF4V3 with softserial in M5 and M6
22+
#if defined(OMNIBUSF4V3_S6_SS) || defined(OMNIBUSF4V3_S5S6_SS) || defined(OMNIBUSF4V3_S5_S6_2SS)
23+
#define OMNIBUSF4V3
24+
#endif
25+
26+
#define TARGET_BOARD_IDENTIFIER "OB43"
27+
28+
#define USBD_PRODUCT_STRING "Omnibus F4"
29+
30+
#define LED0 PB5
31+
32+
#define BEEPER PB4
33+
#define BEEPER_INVERTED
34+
35+
#define USE_I2C
36+
#define USE_I2C_DEVICE_2
37+
#define I2C_DEVICE_2_SHARES_UART3
38+
#define I2C_EXT_BUS BUS_I2C2
39+
40+
#define UG2864_I2C_BUS I2C_EXT_BUS
41+
42+
#define MPU6000_CS_PIN PA4
43+
#define MPU6000_SPI_BUS BUS_SPI1
44+
45+
#define USE_IMU_MPU6000
46+
#define IMU_MPU6000_ALIGN CW270_DEG
47+
48+
// Support for OMNIBUS F4 PRO CORNER - it has ICM20608 instead of MPU6000
49+
#define MPU6500_CS_PIN MPU6000_CS_PIN
50+
#define MPU6500_SPI_BUS MPU6000_SPI_BUS
51+
#define USE_IMU_MPU6500
52+
#define IMU_MPU6500_ALIGN IMU_MPU6000_ALIGN
53+
54+
//BMI270
55+
#define USE_IMU_BMI270
56+
#define IMU_BMI270_ALIGN IMU_MPU6000_ALIGN
57+
#define BMI270_SPI_BUS MPU6000_SPI_BUS
58+
#define BMI270_CS_PIN MPU6000_CS_PIN
59+
60+
#define USE_MAG
61+
#define MAG_I2C_BUS I2C_EXT_BUS
62+
#define USE_MAG_ALL
63+
64+
#define TEMPERATURE_I2C_BUS I2C_EXT_BUS
65+
66+
#define USE_BARO
67+
68+
#define USE_BARO_BMP280
69+
#define BMP280_SPI_BUS BUS_SPI3
70+
#define BMP280_CS_PIN PB3 // v1
71+
// Support external barometers
72+
#define BARO_I2C_BUS I2C_EXT_BUS
73+
#define USE_BARO_BMP085
74+
#define USE_BARO_MS5611
75+
76+
#define PITOT_I2C_BUS I2C_EXT_BUS
77+
78+
#define USE_RANGEFINDER
79+
#define RANGEFINDER_I2C_BUS I2C_EXT_BUS
80+
81+
#define USE_VCP
82+
#define VBUS_SENSING_PIN PC5
83+
#define VBUS_SENSING_ENABLED
84+
85+
#define USE_UART_INVERTER
86+
87+
#define USE_UART1
88+
#define UART1_RX_PIN PA10
89+
#define UART1_TX_PIN PA9
90+
#define UART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2
91+
92+
#define USE_UART3
93+
#define UART3_RX_PIN PB11
94+
#define UART3_TX_PIN PB10
95+
96+
#define USE_UART6
97+
#define UART6_RX_PIN PC7
98+
#define UART6_TX_PIN PC6
99+
#define INVERTER_PIN_UART6_RX PC8
100+
#define INVERTER_PIN_UART6_TX PC9
101+
102+
#if defined(OMNIBUSF4V3) && !(defined(OMNIBUSF4V3_S6_SS) || defined(OMNIBUSF4V3_S5S6_SS) || defined(OMNIBUSF4V3_S5_S6_2SS))
103+
#define USE_SOFTSERIAL1
104+
#define SOFTSERIAL_1_RX_PIN PC6 // shared with UART6 TX
105+
#define SOFTSERIAL_1_TX_PIN PC6 // shared with UART6 TX
106+
107+
#define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
108+
109+
#elif defined(OMNIBUSF4V3_S6_SS) // one softserial on S6
110+
#define USE_SOFTSERIAL1
111+
#define SOFTSERIAL_1_RX_PIN PA8 // S6 output
112+
#define SOFTSERIAL_1_TX_PIN PA8 // S6 output
113+
114+
#define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
115+
116+
#elif defined(OMNIBUSF4V3_S5S6_SS) // one softserial on S5/RX S6/TX
117+
#define USE_SOFTSERIAL1
118+
#define SOFTSERIAL_1_RX_PIN PA1 // S5 output
119+
#define SOFTSERIAL_1_TX_PIN PA8 // S6 output
120+
121+
#define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
122+
123+
#elif defined(OMNIBUSF4V3_S5_S6_2SS) // two softserials, one on S5 and one on S6
124+
#define USE_SOFTSERIAL1
125+
#define SOFTSERIAL_1_RX_PIN PA1 // S5 output
126+
#define SOFTSERIAL_1_TX_PIN PA1 // S5 output
127+
128+
#define USE_SOFTSERIAL2
129+
#define SOFTSERIAL_2_RX_PIN PA8 // S6 output
130+
#define SOFTSERIAL_2_TX_PIN PA8 // S6 output
131+
132+
#define SERIAL_PORT_COUNT 6 // VCP, USART1, USART3, USART6, SOFTSERIAL1, SOFTSERIAL2
133+
134+
#else // One softserial on versions other than OMNIBUSF4V3
135+
#define USE_SOFTSERIAL1
136+
#define SOFTSERIAL_1_RX_PIN PC8 // pad labelled CH5 on OMNIBUSF4PRO
137+
#define SOFTSERIAL_1_TX_PIN PC9 // pad labelled CH6 on OMNIBUSF4PRO
138+
139+
#define SERIAL_PORT_COUNT 5 // VCP, USART1, USART3, USART6, SOFTSERIAL1
140+
#endif
141+
142+
#define DEFAULT_RX_TYPE RX_TYPE_SERIAL
143+
#define SERIALRX_PROVIDER SERIALRX_SBUS
144+
#define SERIALRX_UART SERIAL_PORT_USART1
145+
146+
#define USE_SPI
147+
148+
#define USE_SPI_DEVICE_1
149+
150+
#define USE_SPI_DEVICE_2
151+
#define SPI2_NSS_PIN PB12
152+
#define SPI2_SCK_PIN PB13
153+
#define SPI2_MISO_PIN PB14
154+
#define SPI2_MOSI_PIN PB15
155+
156+
#define USE_SPI_DEVICE_3
157+
#define SPI3_NSS_PIN PA15
158+
#define SPI3_SCK_PIN PC10
159+
#define SPI3_MISO_PIN PC11
160+
#define SPI3_MOSI_PIN PC12
161+
162+
#define USE_MAX7456
163+
#define MAX7456_SPI_BUS BUS_SPI3
164+
#define MAX7456_CS_PIN PA15
165+
166+
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
167+
#define USE_SDCARD
168+
#define USE_SDCARD_SPI
169+
170+
#define SDCARD_SPI_BUS BUS_SPI2
171+
#define SDCARD_CS_PIN SPI2_NSS_PIN
172+
173+
#define SDCARD_DETECT_PIN PB7
174+
#define SDCARD_DETECT_INVERTED
175+
176+
#define USE_ADC
177+
#define ADC_CHANNEL_1_PIN PC1
178+
#define ADC_CHANNEL_2_PIN PC2
179+
180+
#define ADC_CHANNEL_3_PIN PA0
181+
182+
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_1
183+
#define VBAT_ADC_CHANNEL ADC_CHN_2
184+
#define RSSI_ADC_CHANNEL ADC_CHN_3
185+
186+
#define SENSORS_SET (SENSOR_ACC|SENSOR_MAG|SENSOR_BARO)
187+
188+
#define USE_LED_STRIP
189+
#define WS2811_PIN PB6
190+
191+
#define DISABLE_RX_PWM_FEATURE
192+
#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_BLACKBOX | FEATURE_VBAT | FEATURE_OSD)
193+
194+
#define USE_SPEKTRUM_BIND
195+
#define BIND_PIN PB11 // USART3 RX
196+
197+
#define USE_SERIAL_4WAY_BLHELI_INTERFACE
198+
199+
// Number of available PWM outputs
200+
#define MAX_PWM_OUTPUT_PORTS 6
201+
#define TARGET_MOTOR_COUNT 6
202+
#define USE_DSHOT
203+
#define USE_ESC_SENSOR
204+
205+
#define TARGET_IO_PORTA 0xffff
206+
#define TARGET_IO_PORTB 0xffff
207+
#define TARGET_IO_PORTC 0xffff
208+
#define TARGET_IO_PORTD 0xffff
209+

0 commit comments

Comments
 (0)