Configurable Beeper PIN6 CC3D // Less CC3D targets
This commit is contained in:
parent
36aee11cd8
commit
8ecd05b911
16
Makefile
16
Makefile
|
@ -40,7 +40,7 @@ FLASH_SIZE ?=
|
|||
|
||||
FORKNAME = betaflight
|
||||
|
||||
CC3D_TARGETS = CC3D CC3D_OPBL CC3D_BP6 CC3D_OPBL_BP6
|
||||
CC3D_TARGETS = CC3D CC3D_OPBL
|
||||
|
||||
VALID_TARGETS = NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3 $(CC3D_TARGETS) CJMCU EUSTM32F103RC SPRACINGF3 PORT103R SPARKY ALIENWIIF1 ALIENWIIF3 COLIBRI_RACE MOTOLAB RMDO IRCFUSIONF3 AFROMINI
|
||||
|
||||
|
@ -48,8 +48,7 @@ VALID_TARGETS = NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3 $(CC3D_TARG
|
|||
VCP_VALID_TARGETS = $(CC3D_TARGETS)
|
||||
|
||||
# Valid targets for OP BootLoader support
|
||||
OPBL_VALID_TARGETS = CC3D_OPBL CC3D_OPBL_BP6
|
||||
BP6_VALID_TARGETS = CC3D_BP6 CC3D_OPBL_BP6
|
||||
OPBL_VALID_TARGETS = CC3D_OPBL
|
||||
|
||||
64K_TARGETS = CJMCU
|
||||
128K_TARGETS = ALIENWIIF1 $(CC3D_TARGETS) NAZE OLIMEXINO RMDO AFROMINI
|
||||
|
@ -247,15 +246,6 @@ $(error OPBL specified with a unsupported target)
|
|||
endif
|
||||
endif
|
||||
|
||||
|
||||
ifneq ($(filter $(TARGET),$(BP6_VALID_TARGETS)),)
|
||||
BP6=yes
|
||||
endif
|
||||
|
||||
ifeq ($(BP6),yes)
|
||||
TARGET_FLAGS := -DBEEPER_PIN6 $(TARGET_FLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET),AFROMINI)
|
||||
# AFROMINI is a VARIANT of NAZE being recognized as rev4, but needs to use rev5 config
|
||||
TARGET_FLAGS := $(TARGET_FLAGS) -DNAZE -DAFROMINI
|
||||
|
@ -748,8 +738,6 @@ $(error Target '$(TARGET)' is not valid, must be one of $(VALID_TARGETS))
|
|||
endif
|
||||
|
||||
CC3D_OPBL_SRC = $(CC3D_SRC)
|
||||
CC3D_OPBL_BP6_SRC = $(CC3D_SRC)
|
||||
CC3D_BP6_SRC = $(CC3D_SRC)
|
||||
|
||||
TARGET_BIN = $(BIN_DIR)/$(FORKNAME)_$(TARGET).bin
|
||||
TARGET_HEX = $(BIN_DIR)/$(FORKNAME)_$(TARGET).hex
|
||||
|
|
|
@ -465,6 +465,9 @@ static void resetConf(void)
|
|||
#endif
|
||||
masterConfig.servo_pwm_rate = 50;
|
||||
masterConfig.use_fast_pwm = 0;
|
||||
#ifdef CC3D
|
||||
masterConfig.use_buzzer_p6 = 0;
|
||||
#endif
|
||||
|
||||
#ifdef GPS
|
||||
// gps/nav stuff
|
||||
|
|
|
@ -38,6 +38,9 @@ typedef struct master_t {
|
|||
uint16_t motor_pwm_rate; // The update rate of motor outputs (50-498Hz)
|
||||
uint16_t servo_pwm_rate; // The update rate of servo outputs (50-498Hz)
|
||||
uint8_t use_fast_pwm; // Use fast PWM implementation when oneshot enabled
|
||||
#ifdef CC3D
|
||||
uint8_t use_buzzer_p6;
|
||||
#endif
|
||||
|
||||
// global sensor-related stuff
|
||||
|
||||
|
|
|
@ -152,9 +152,7 @@ static const uint16_t multiPPM[] = {
|
|||
PWM9 | (MAP_TO_MOTOR_OUTPUT << 8),
|
||||
PWM10 | (MAP_TO_MOTOR_OUTPUT << 8),
|
||||
PWM11 | (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
|
||||
|
@ -162,6 +160,7 @@ static const uint16_t multiPPM[] = {
|
|||
PWM6 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
|
||||
0xFFFF
|
||||
};
|
||||
|
||||
static const uint16_t multiPWM[] = {
|
||||
PWM1 | (MAP_TO_PWM_INPUT << 8), // input #1
|
||||
PWM2 | (MAP_TO_PWM_INPUT << 8),
|
||||
|
@ -174,9 +173,7 @@ 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),
|
||||
#ifndef BEEPER_PIN6
|
||||
PWM12 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #4 or #6
|
||||
#endif
|
||||
0xFFFF
|
||||
};
|
||||
|
||||
|
@ -187,9 +184,7 @@ static const uint16_t airPPM[] = {
|
|||
PWM9 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
PWM10 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
PWM11 | (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),
|
||||
|
@ -210,9 +205,66 @@ 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
|
||||
#ifndef BEEPER_PIN6
|
||||
PWM12 | (MAP_TO_SERVO_OUTPUT << 8), // servo #4
|
||||
#endif
|
||||
0xFFFF
|
||||
};
|
||||
static const uint16_t multiPPM_BP6[] = {
|
||||
PWM1 | (MAP_TO_PPM_INPUT << 8), // PPM input
|
||||
PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
|
||||
PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
|
||||
PWM9 | (MAP_TO_MOTOR_OUTPUT << 8),
|
||||
PWM10 | (MAP_TO_MOTOR_OUTPUT << 8),
|
||||
PWM11 | (MAP_TO_MOTOR_OUTPUT << 8),
|
||||
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
|
||||
PWM5 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
|
||||
PWM6 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
|
||||
0xFFFF
|
||||
};
|
||||
|
||||
static const uint16_t multiPWM_BP6[] = {
|
||||
PWM1 | (MAP_TO_PWM_INPUT << 8), // input #1
|
||||
PWM2 | (MAP_TO_PWM_INPUT << 8),
|
||||
PWM3 | (MAP_TO_PWM_INPUT << 8),
|
||||
PWM4 | (MAP_TO_PWM_INPUT << 8),
|
||||
PWM5 | (MAP_TO_PWM_INPUT << 8),
|
||||
PWM6 | (MAP_TO_PWM_INPUT << 8), // input #6
|
||||
PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 or servo #1 (swap to servo if needed)
|
||||
PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2 or servo #2 (swap to servo if needed)
|
||||
PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1 or #3
|
||||
PWM10 | (MAP_TO_MOTOR_OUTPUT << 8),
|
||||
PWM11 | (MAP_TO_MOTOR_OUTPUT << 8),
|
||||
0xFFFF
|
||||
};
|
||||
|
||||
static const uint16_t airPPM_BP6[] = {
|
||||
PWM1 | (MAP_TO_PPM_INPUT << 8), // PPM input
|
||||
PWM7 | (MAP_TO_MOTOR_OUTPUT << 8),
|
||||
PWM8 | (MAP_TO_MOTOR_OUTPUT << 8),
|
||||
PWM9 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
PWM10 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
PWM11 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
PWM2 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
PWM3 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
PWM4 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
PWM5 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
PWM6 | (MAP_TO_SERVO_OUTPUT << 8),
|
||||
0xFFFF
|
||||
};
|
||||
|
||||
static const uint16_t airPWM_BP6[] = {
|
||||
PWM1 | (MAP_TO_PWM_INPUT << 8), // input #1
|
||||
PWM2 | (MAP_TO_PWM_INPUT << 8),
|
||||
PWM3 | (MAP_TO_PWM_INPUT << 8),
|
||||
PWM4 | (MAP_TO_PWM_INPUT << 8),
|
||||
PWM5 | (MAP_TO_PWM_INPUT << 8),
|
||||
PWM6 | (MAP_TO_PWM_INPUT << 8), // input #6
|
||||
PWM7 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #1
|
||||
PWM8 | (MAP_TO_MOTOR_OUTPUT << 8), // motor #2
|
||||
PWM9 | (MAP_TO_SERVO_OUTPUT << 8), // servo #1
|
||||
PWM10 | (MAP_TO_SERVO_OUTPUT << 8), // servo #2
|
||||
PWM11 | (MAP_TO_SERVO_OUTPUT << 8), // servo #3
|
||||
0xFFFF
|
||||
};
|
||||
#endif
|
||||
|
@ -476,6 +528,15 @@ static const uint16_t * const hardwareMaps[] = {
|
|||
airPPM,
|
||||
};
|
||||
|
||||
#ifdef CC3D
|
||||
static const uint16_t * const hardwareMapsBP6[] = {
|
||||
multiPWM_BP6,
|
||||
multiPPM_BP6,
|
||||
airPWM_BP6,
|
||||
airPPM_BP6,
|
||||
};
|
||||
#endif
|
||||
|
||||
static pwmOutputConfiguration_t pwmOutputConfiguration;
|
||||
|
||||
pwmOutputConfiguration_t *pwmGetOutputConfiguration(void){
|
||||
|
@ -497,7 +558,15 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
|
|||
if (init->usePPM || init->useSerialRx)
|
||||
i++; // next index is for PPM
|
||||
|
||||
#ifdef CC3D
|
||||
if (init->useBuzzerP6) {
|
||||
setup = hardwareMapsBP6[i];
|
||||
} else {
|
||||
setup = hardwareMaps[i];
|
||||
}
|
||||
#else
|
||||
setup = hardwareMaps[i];
|
||||
#endif
|
||||
|
||||
for (i = 0; i < USABLE_TIMER_CHANNEL_COUNT && setup[i] != 0xFFFF; i++) {
|
||||
uint8_t timerIndex = setup[i] & 0x00FF;
|
||||
|
|
|
@ -69,6 +69,9 @@ typedef struct drv_pwm_config_s {
|
|||
#ifdef USE_SERVOS
|
||||
bool useServos;
|
||||
bool useChannelForwarding; // configure additional channels as servos
|
||||
#ifdef CC3D
|
||||
bool useBuzzerP6;
|
||||
#endif
|
||||
uint16_t servoPwmRate;
|
||||
uint16_t servoCenterPulse;
|
||||
#endif
|
||||
|
|
|
@ -464,7 +464,10 @@ const clivalue_t valueTable[] = {
|
|||
{ "3d_neutral", VAR_UINT16 | MASTER_VALUE, &masterConfig.flight3DConfig.neutral3d, .config.minmax = { PWM_RANGE_ZERO, PWM_RANGE_MAX } },
|
||||
{ "3d_deadband_throttle", VAR_UINT16 | MASTER_VALUE, &masterConfig.flight3DConfig.deadband3d_throttle, .config.minmax = { PWM_RANGE_ZERO, PWM_RANGE_MAX } },
|
||||
|
||||
{ "enable_fast_pwm", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.use_fast_pwm, .config.lookup = { TABLE_OFF_ON } },
|
||||
{ "enable_fast_pwm", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.use_fast_pwm, .config.lookup = { TABLE_OFF_ON } },
|
||||
#ifdef CC3D
|
||||
{ "enable_buzzer_p6", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.use_buzzer_p6, .config.lookup = { TABLE_OFF_ON } },
|
||||
#endif
|
||||
{ "motor_pwm_rate", VAR_UINT16 | MASTER_VALUE, &masterConfig.motor_pwm_rate, .config.minmax = { 50, 32000 } },
|
||||
{ "servo_pwm_rate", VAR_UINT16 | MASTER_VALUE, &masterConfig.servo_pwm_rate, .config.minmax = { 50, 498 } },
|
||||
|
||||
|
|
|
@ -264,7 +264,9 @@ void init(void)
|
|||
pwm_params.idlePulse = masterConfig.flight3DConfig.neutral3d;
|
||||
if (pwm_params.motorPwmRate > 500 && !masterConfig.use_fast_pwm)
|
||||
pwm_params.idlePulse = 0; // brushed motors
|
||||
|
||||
#ifdef CC3D
|
||||
pwm_params.useBuzzerP6 = masterConfig.use_buzzer_p6 ? true : false;
|
||||
#endif
|
||||
pwmRxInit(masterConfig.inputFilteringMode);
|
||||
|
||||
pwmOutputConfiguration_t *pwmOutputConfiguration = pwmInit(&pwm_params);
|
||||
|
|
Loading…
Reference in New Issue