Fix Selectable Buzzer Pin for CC3D
This commit is contained in:
parent
4135c1b9c2
commit
dfcc3eb028
|
@ -33,21 +33,23 @@
|
|||
|
||||
void (*systemBeepPtr)(bool onoff) = NULL;
|
||||
|
||||
static uint16_t beeperPin;
|
||||
|
||||
static void beepNormal(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
digitalLo(BEEP_GPIO, BEEP_PIN);
|
||||
digitalLo(BEEP_GPIO, beeperPin);
|
||||
} else {
|
||||
digitalHi(BEEP_GPIO, BEEP_PIN);
|
||||
digitalHi(BEEP_GPIO, beeperPin);
|
||||
}
|
||||
}
|
||||
|
||||
static void beepInverted(bool onoff)
|
||||
{
|
||||
if (onoff) {
|
||||
digitalHi(BEEP_GPIO, BEEP_PIN);
|
||||
digitalHi(BEEP_GPIO, beeperPin);
|
||||
} else {
|
||||
digitalLo(BEEP_GPIO, BEEP_PIN);
|
||||
digitalLo(BEEP_GPIO, beeperPin);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -61,8 +63,17 @@ void systemBeep(bool onoff)
|
|||
#endif
|
||||
}
|
||||
|
||||
void beeperInit(beeperConfig_t *config)
|
||||
{
|
||||
#ifdef CC3D
|
||||
void beeperInit(beeperConfig_t *config, uint8_t use_buzzer_p6) {
|
||||
if (use_buzzer_p6) {
|
||||
beeperPin = Pin_2;
|
||||
} else {
|
||||
beeperPin = BEEP_PIN;
|
||||
}
|
||||
#else
|
||||
void beeperInit(beeperConfig_t *config) {
|
||||
beeperPin = BEEP_PIN;
|
||||
#endif
|
||||
#ifndef BEEPER
|
||||
UNUSED(config);
|
||||
#else
|
||||
|
|
|
@ -36,6 +36,10 @@ typedef struct beeperConfig_s {
|
|||
} beeperConfig_t;
|
||||
|
||||
void systemBeep(bool onoff);
|
||||
#ifdef CC3D
|
||||
void beeperInit(beeperConfig_t *beeperConfig, uint8_t use_buzzer_p6);
|
||||
#else
|
||||
void beeperInit(beeperConfig_t *beeperConfig);
|
||||
#endif
|
||||
|
||||
void initBeeperHardware(beeperConfig_t *config);
|
||||
|
|
|
@ -303,9 +303,15 @@ void init(void)
|
|||
beeperConfig.isInverted = true;
|
||||
}
|
||||
#endif
|
||||
#ifdef CC3D
|
||||
if (masterConfig.use_buzzer_p6 == 1)
|
||||
beeperConfig.gpioPin = Pin_2;
|
||||
|
||||
beeperInit(&beeperConfig, masterConfig.use_buzzer_p6);
|
||||
#else
|
||||
beeperInit(&beeperConfig);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef INVERTER
|
||||
initInverter();
|
||||
|
|
|
@ -30,11 +30,7 @@
|
|||
//#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
|
||||
|
|
Loading…
Reference in New Issue