From a40fb10c3e45cf0cd930bdeb55b522140a92b700 Mon Sep 17 00:00:00 2001 From: jflyper Date: Wed, 26 Jul 2017 21:30:41 +0900 Subject: [PATCH] OMNIBUSF7 Assign UART2_RX to designated RC(SBUS/PPM) pin Also define software serials, add backdoor timers and hmc5883 mag. --- src/main/target/OMNIBUSF7/target.c | 10 ++++++++-- src/main/target/OMNIBUSF7/target.h | 24 +++++++++++++++--------- src/main/target/OMNIBUSF7/target.mk | 1 + 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/main/target/OMNIBUSF7/target.c b/src/main/target/OMNIBUSF7/target.c index 4939ce112d..5f9245a651 100644 --- a/src/main/target/OMNIBUSF7/target.c +++ b/src/main/target/OMNIBUSF7/target.c @@ -23,12 +23,18 @@ #include "drivers/timer_def.h" const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { - DEF_TIM(TIM1, CH3, PE13, TIM_USE_PPM, 0, 1), // RC1 / PPM + DEF_TIM(TIM1, CH3, PE13, TIM_USE_NONE, 0, 1), // RC1 / PPM, unusable DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 1, 0), // M1 DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 1, 0), // M2 DEF_TIM(TIM1, CH1, PE9, TIM_USE_MOTOR, 1, 2), // M3 DEF_TIM(TIM1, CH2, PE11, TIM_USE_MOTOR, 1, 1), // M4 - DEF_TIM(TIM4, CH1, PD12, TIM_USE_LED, 1, 0 ), // LED + DEF_TIM(TIM4, CH1, PD12, TIM_USE_LED, 1, 0 ), // LED + + // Backdoor timers + DEF_TIM(TIM2, CH3, PB10, TIM_USE_NONE, 1, 0 ), // UART3_TX, I2C2_SCL + DEF_TIM(TIM2, CH4, PB11, TIM_USE_NONE, 1, 0 ), // UART3_RX, I2C2_SDA + DEF_TIM(TIM8, CH1, PC6, TIM_USE_NONE, 1, 0 ), // UART6_TX + DEF_TIM(TIM8, CH2, PC7, TIM_USE_NONE, 1, 0 ), // UART6_RX }; diff --git a/src/main/target/OMNIBUSF7/target.h b/src/main/target/OMNIBUSF7/target.h index d969b8238a..df0fd93ad2 100644 --- a/src/main/target/OMNIBUSF7/target.h +++ b/src/main/target/OMNIBUSF7/target.h @@ -53,8 +53,6 @@ //#define USE_MPU_DATA_READY_SIGNAL //#define USE_EXTI -#define USABLE_TIMER_CHANNEL_COUNT 16 - #define USE_VCP #define VBUS_SENSING_PIN PC4 @@ -62,10 +60,10 @@ #define UART1_RX_PIN PA10 #define UART1_TX_PIN PA9 -//#define AVOID_UART2_FOR_PWM_PPM -//#define USE_UART2 -//#define UART2_TX_PIN PA2 //not wired -//#define UART2_RX_PIN PA3 +//#define AVOID_UART2_FOR_PWM_PPM // PPM is not working on RC pin anyway +#define USE_UART2 +#define UART2_TX_PIN NONE +#define UART2_RX_PIN PA3 // Assigned to shared output I2C2 #define USE_UART3 @@ -76,7 +74,10 @@ #define UART6_RX_PIN PC7 #define UART6_TX_PIN PC6 -#define SERIAL_PORT_COUNT 4 +#define USE_SOFTSERIAL1 +#define USE_SOFTSERIAL2 + +#define SERIAL_PORT_COUNT 7 #define USE_ESCSERIAL #define ESCSERIAL_TIMER_TX_PIN PE13 // (Hardware=0, PPM) @@ -143,6 +144,9 @@ #define BMP280_SPI_INSTANCE SPI1 #define BMP280_CS_PIN PA1 +#define MAG +#define USE_MAG_HMC5883 + #define SENSORS_SET (SENSOR_ACC | SENSOR_BARO) #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC @@ -159,8 +163,8 @@ #define DEFAULT_FEATURES (FEATURE_OSD) #define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL +#define SERIALRX_UART SERIAL_PORT_USART2 #define SERIALRX_PROVIDER SERIALRX_SBUS -#define SERIALRX_UART SERIAL_PORT_USART1 #define USE_SERIAL_4WAY_BLHELI_INTERFACE @@ -170,4 +174,6 @@ #define TARGET_IO_PORTD 0xffff #define TARGET_IO_PORTE 0xffff -#define USED_TIMERS ( TIM_N(1) | TIM_N(3) | TIM_N(4) ) +#define USABLE_TIMER_CHANNEL_COUNT 10 + +#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(8) ) diff --git a/src/main/target/OMNIBUSF7/target.mk b/src/main/target/OMNIBUSF7/target.mk index 6cd3e4aee7..1f41520c50 100644 --- a/src/main/target/OMNIBUSF7/target.mk +++ b/src/main/target/OMNIBUSF7/target.mk @@ -7,6 +7,7 @@ TARGET_SRC = \ drivers/accgyro/accgyro_spi_mpu6500.c \ drivers/accgyro/accgyro_spi_mpu6000.c \ drivers/barometer/barometer_bmp280.c \ + drivers/compass/compass_hmc5883l.c \ drivers/light_ws2811strip.c \ drivers/light_ws2811strip_hal.c \ drivers/max7456.c