From 72ace4566ed7475521e8f44825ac29f35d554e9e Mon Sep 17 00:00:00 2001 From: Cheng Lin Date: Thu, 3 Aug 2017 16:33:14 -0400 Subject: [PATCH 1/2] add camera_contro pin define, soft_serial,camera_control enter press key --- src/main/fc/rc_controls.c | 2 ++ src/main/target/CLRACINGF4/target.c | 2 +- src/main/target/CLRACINGF4/target.h | 6 +++++- src/main/target/CLRACINGF7/target.c | 2 +- src/main/target/CLRACINGF7/target.h | 9 +++++++-- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/main/fc/rc_controls.c b/src/main/fc/rc_controls.c index 72f8a6de81..75e1180347 100644 --- a/src/main/fc/rc_controls.c +++ b/src/main/fc/rc_controls.c @@ -325,6 +325,8 @@ void processRcStickPositions(throttleStatus_e throttleStatus) cameraControlKeyPress(CAMERA_CONTROL_KEY_DOWN, 0); } else if (rcSticks == THR_LO + YAW_CE + PIT_HI + ROL_CE) { cameraControlKeyPress(CAMERA_CONTROL_KEY_UP, 2000); + }else if (rcSticks == THR_CE + YAW_HI + PIT_LO + ROL_CE) { //add enter key when it is in the camera osd + cameraControlKeyPress(CAMERA_CONTROL_KEY_ENTER, 0); } #endif } diff --git a/src/main/target/CLRACINGF4/target.c b/src/main/target/CLRACINGF4/target.c index b1fbe76942..8274a0ecc7 100644 --- a/src/main/target/CLRACINGF4/target.c +++ b/src/main/target/CLRACINGF4/target.c @@ -27,7 +27,7 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { - DEF_TIM(TIM11, CH1, PB9, TIM_USE_PPM, TIMER_OUTPUT_NONE , 0), // PPM + DEF_TIM(TIM11, CH1, PB9, TIM_USE_ANY, TIMER_OUTPUT_ENABLED , 0), // CAMERA_CONTROL_PIN DEF_TIM(TIM1, CH2N, PB0, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED, 0), // M1 - D2_ST6 DEF_TIM(TIM8, CH3N, PB1, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED | TIMER_OUTPUT_INVERTED, 0), // M2_OUT D2_ST2 diff --git a/src/main/target/CLRACINGF4/target.h b/src/main/target/CLRACINGF4/target.h index 1facb45f1f..e52b2e3160 100644 --- a/src/main/target/CLRACINGF4/target.h +++ b/src/main/target/CLRACINGF4/target.h @@ -30,6 +30,8 @@ #define INVERTER_PIN_UART1 PC0 // PC0 used as inverter select GPIO +#define CAMERA_CONTROL_PIN PB9 // define dedicated camera_osd_control pin + #define USE_EXTI #define MPU_INT_EXTI PC4 @@ -104,7 +106,9 @@ #define UART4_RX_PIN PA1 #define UART4_TX_PIN PA0 -#define SERIAL_PORT_COUNT 5 //VCP, USART1, USART3,USART4, USART6, +#define USE_SOFTSERIAL1 + +#define SERIAL_PORT_COUNT 6 //VCP, USART1, USART3,USART4, USART6, SOFT_SERIAL1 #define USE_ESCSERIAL #define ESCSERIAL_TIMER_TX_PIN PB9 // (HARDARE=0,PPM) diff --git a/src/main/target/CLRACINGF7/target.c b/src/main/target/CLRACINGF7/target.c index 710a85c900..ebfd54783a 100644 --- a/src/main/target/CLRACINGF7/target.c +++ b/src/main/target/CLRACINGF7/target.c @@ -28,7 +28,7 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { - DEF_TIM(TIM4, CH3, PB8, TIM_USE_PPM, TIMER_INPUT_ENABLED, 0), // PPM -DMA1_ST7 + DEF_TIM(TIM10, CH1, PB8, TIM_USE_ANY, TIMER_OUTPUT_ENABLED, 0 ), // USE FOR CAMERA CONTROL DEF_TIM(TIM2, CH4, PA3, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM1 - DMA1_ST6 D(1, 7, 3),D(1, 6, 3) DEF_TIM(TIM8, CH3, PC8, TIM_USE_MOTOR, TIMER_OUTPUT_ENABLED, 1), // PWM2 - DMA2_ST2 D(2, 4, 7),D(2, 2, 0) diff --git a/src/main/target/CLRACINGF7/target.h b/src/main/target/CLRACINGF7/target.h index e03b430b82..89582f56a0 100644 --- a/src/main/target/CLRACINGF7/target.h +++ b/src/main/target/CLRACINGF7/target.h @@ -24,6 +24,9 @@ #define BEEPER PB4 #define BEEPER_INVERTED +//define camera control +#define CAMERA_CONTROL_PIN PB8 + #define USE_EXTI #define MPU_INT_EXTI PC4 #define USE_MPU_DATA_READY_SIGNAL @@ -100,7 +103,9 @@ #define UART6_RX_PIN PC7 #define UART6_TX_PIN PC6 -#define SERIAL_PORT_COUNT 5 +#define USE_SOFTSERIAL1 + +#define SERIAL_PORT_COUNT 6 //VCP, USART1, USART3,USART4, USART6, SOFT_SERIAL1 #define USE_ESCSERIAL #define ESCSERIAL_TIMER_TX_PIN PB8 // (Hardware=0, PPM) @@ -151,5 +156,5 @@ #define TARGET_IO_PORTD (BIT(2)) #define USABLE_TIMER_CHANNEL_COUNT 9 -#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(8) ) +#define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(8) | TIM_N(10) ) From f614038c3b34802f0e3113f7d5fc17021322d6f3 Mon Sep 17 00:00:00 2001 From: Cheng Lin Date: Fri, 4 Aug 2017 13:29:35 -0400 Subject: [PATCH 2/2] remove enter key from rc_control.c make it target definition only PR --- src/main/fc/rc_controls.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/fc/rc_controls.c b/src/main/fc/rc_controls.c index 75e1180347..3fcf1849ea 100644 --- a/src/main/fc/rc_controls.c +++ b/src/main/fc/rc_controls.c @@ -325,9 +325,7 @@ void processRcStickPositions(throttleStatus_e throttleStatus) cameraControlKeyPress(CAMERA_CONTROL_KEY_DOWN, 0); } else if (rcSticks == THR_LO + YAW_CE + PIT_HI + ROL_CE) { cameraControlKeyPress(CAMERA_CONTROL_KEY_UP, 2000); - }else if (rcSticks == THR_CE + YAW_HI + PIT_LO + ROL_CE) { //add enter key when it is in the camera osd - cameraControlKeyPress(CAMERA_CONTROL_KEY_ENTER, 0); - } + } #endif }