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