remove beeper dependency in pwm output
This commit is contained in:
parent
d6b9350c74
commit
1f809048df
|
@ -480,9 +480,8 @@ void pwmToggleBeeper(void)
|
|||
pwmWriteBeeper(!beeperPwm.enabled);
|
||||
}
|
||||
|
||||
void beeperPwmInit(const beeperDevConfig_t *beeperConfig)
|
||||
void beeperPwmInit(const ioTag_t tag, uint16_t frequency)
|
||||
{
|
||||
const ioTag_t tag = beeperConfig->ioTag;
|
||||
beeperPwm.io = IOGetByTag(tag);
|
||||
const timerHardware_t *timer = timerGetByTag(tag, TIM_USE_BEEPER);
|
||||
if (beeperPwm.io && timer) {
|
||||
|
@ -492,7 +491,7 @@ void beeperPwmInit(const beeperDevConfig_t *beeperConfig)
|
|||
#else
|
||||
IOConfigGPIO(beeperPwm.io, IOCFG_AF_PP);
|
||||
#endif
|
||||
freqBeep = beeperConfig->frequency;
|
||||
freqBeep = frequency;
|
||||
pwmOutConfig(&beeperPwm, timer, PWM_TIMER_1MHZ, PWM_TIMER_1MHZ / freqBeep, (PWM_TIMER_1MHZ / freqBeep) / 2, 0);
|
||||
}
|
||||
*beeperPwm.ccr = 0;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "drivers/io_types.h"
|
||||
#include "drivers/sound_beeper.h"
|
||||
#include "timer.h"
|
||||
|
||||
#ifndef MAX_SUPPORTED_MOTORS
|
||||
|
@ -180,7 +179,7 @@ void pwmCompleteDshotMotorUpdate(uint8_t motorCount);
|
|||
#ifdef BEEPER
|
||||
void pwmWriteBeeper(bool onoffBeep);
|
||||
void pwmToggleBeeper(void);
|
||||
void beeperPwmInit(const beeperDevConfig_t *beeperConfig);
|
||||
void beeperPwmInit(const ioTag_t tag, uint16_t frequency);
|
||||
#endif
|
||||
|
||||
void pwmWriteMotor(uint8_t index, float value);
|
||||
|
|
|
@ -69,8 +69,8 @@ void beeperInit(const beeperDevConfig_t *config)
|
|||
}
|
||||
systemBeep(false);
|
||||
} else {
|
||||
beeperIO = IOGetByTag(config->ioTag);
|
||||
beeperPwmInit(config);
|
||||
const ioTag_t beeperTag = config->ioTag;
|
||||
beeperPwmInit(beeperTag, beeperFrequency);
|
||||
}
|
||||
#else
|
||||
UNUSED(config);
|
||||
|
|
Loading…
Reference in New Issue