mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
Use Naze hardware revision when initialising beeper. Cleanup inverted
beeper configuration.
This commit is contained in:
parent
2ed09b0b2f
commit
50391f2c8e
8 changed files with 70 additions and 3808 deletions
|
@ -39,6 +39,10 @@
|
|||
#include "drivers/adc.h"
|
||||
#include "drivers/bus_i2c.h"
|
||||
#include "drivers/bus_spi.h"
|
||||
#include "drivers/gpio.h"
|
||||
#include "drivers/light_led.h"
|
||||
#include "drivers/sound_beeper.h"
|
||||
#include "drivers/inverter.h"
|
||||
|
||||
#include "flight/flight.h"
|
||||
#include "flight/mixer.h"
|
||||
|
@ -169,6 +173,34 @@ void init(void)
|
|||
|
||||
systemInit();
|
||||
|
||||
delay(100);
|
||||
|
||||
ledInit();
|
||||
|
||||
#ifdef BEEPER
|
||||
beeperConfig_t beeperConfig = {
|
||||
.gpioMode = Mode_Out_OD,
|
||||
.gpioPin = BEEP_PIN,
|
||||
.gpioPort = BEEP_GPIO,
|
||||
.gpioPeripheral = BEEP_PERIPHERAL,
|
||||
.isInverted = false
|
||||
};
|
||||
#ifdef NAZE
|
||||
if (hardwareRevision >= NAZE32_REV5) {
|
||||
// naze rev4 and below used opendrain to PNP for buzzer. Rev5 and above use PP to NPN.
|
||||
beeperConfig.gpioMode = Mode_Out_PP;
|
||||
beeperConfig.isInverted = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
beeperInit(&beeperConfig);
|
||||
#endif
|
||||
|
||||
#ifdef INVERTER
|
||||
initInverter();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USE_SPI
|
||||
spiInit(SPI1);
|
||||
spiInit(SPI2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue