From 5f12711c242c6ef0b37b2ff37ecac78d9ed4fff5 Mon Sep 17 00:00:00 2001 From: borisbstyle Date: Fri, 6 Nov 2015 11:31:36 +0100 Subject: [PATCH] Easy compile option for buzzer on PIN6 --- src/main/drivers/pwm_mapping.c | 16 ++++++++++++---- src/main/target/CC3D/target.h | 6 ++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/drivers/pwm_mapping.c b/src/main/drivers/pwm_mapping.c index 88ebaba33..1bbdf7f29 100755 --- a/src/main/drivers/pwm_mapping.c +++ b/src/main/drivers/pwm_mapping.c @@ -152,7 +152,9 @@ static const uint16_t multiPPM[] = { PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), PWM11 | (MAP_TO_MOTOR_OUTPUT << 8), - //PWM12 | (MAP_TO_MOTOR_OUTPUT << 8), +#ifndef BEEPER_PIN6 + PWM12 | (MAP_TO_MOTOR_OUTPUT << 8), +#endif PWM2 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed PWM3 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed PWM4 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed @@ -172,7 +174,9 @@ static const uint16_t multiPWM[] = { PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 or #3 PWM10 | (MAP_TO_MOTOR_OUTPUT << 8), PWM11 | (MAP_TO_MOTOR_OUTPUT << 8), - //PWM12 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #4 or #6 +#ifndef BEEPER_PIN6 + PWM12 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #4 or #6 +#endif 0xFFFF }; @@ -183,7 +187,9 @@ static const uint16_t airPPM[] = { PWM9 | (MAP_TO_SERVO_OUTPUT << 8), PWM10 | (MAP_TO_SERVO_OUTPUT << 8), PWM11 | (MAP_TO_SERVO_OUTPUT << 8), - //PWM12 | (MAP_TO_SERVO_OUTPUT << 8), +#ifndef BEEPER_PIN6 + PWM12 | (MAP_TO_SERVO_OUTPUT << 8), +#endif PWM2 | (MAP_TO_SERVO_OUTPUT << 8), PWM3 | (MAP_TO_SERVO_OUTPUT << 8), PWM4 | (MAP_TO_SERVO_OUTPUT << 8), @@ -204,7 +210,9 @@ static const uint16_t airPWM[] = { PWM9 | (MAP_TO_SERVO_OUTPUT << 8), // servo #1 PWM10 | (MAP_TO_SERVO_OUTPUT << 8), // servo #2 PWM11 | (MAP_TO_SERVO_OUTPUT << 8), // servo #3 - //PWM12 | (MAP_TO_SERVO_OUTPUT << 8), // servo #4 +#ifndef BEEPER_PIN6 + PWM12 | (MAP_TO_SERVO_OUTPUT << 8), // servo #4 +#endif 0xFFFF }; #endif diff --git a/src/main/target/CC3D/target.h b/src/main/target/CC3D/target.h index aff045dd0..e0e9cc79f 100644 --- a/src/main/target/CC3D/target.h +++ b/src/main/target/CC3D/target.h @@ -27,8 +27,14 @@ #define INVERTER_PERIPHERAL RCC_APB2Periph_GPIOB #define INVERTER_USART USART1 +//#define BEEPER_PIN6 // Uncomment this line for hexacopter configurations where PIN6 is needed for motor + #define BEEP_GPIO GPIOA +#ifdef BEEPER_PIN6 #define BEEP_PIN Pin_2 // PA2 (Beeper) +#else +#define BEEP_PIN Pin_15 // PA15 (Beeper) +#endif #define BEEP_PERIPHERAL RCC_APB2Periph_GPIOA #define MPU6000_CS_GPIO GPIOA -- 2.11.4.GIT