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