Remove usage of feature() from rx driver code so that driver code does
not have a dependency on config.c.
This commit is contained in:
parent
7356863939
commit
0b92f74b80
|
@ -365,6 +365,11 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
|
|||
#endif
|
||||
|
||||
if (type == MAP_TO_PPM_INPUT) {
|
||||
#ifdef CC3D
|
||||
if (init->useOneshot) {
|
||||
ppmAvoidPWMTimerClash(timerHardwarePtr, TIM4);
|
||||
}
|
||||
#endif
|
||||
ppmInConfig(timerHardwarePtr);
|
||||
} else if (type == MAP_TO_PWM_INPUT) {
|
||||
pwmInConfig(timerHardwarePtr, channelIndex);
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "build_config.h"
|
||||
|
||||
#include "common/utils.h"
|
||||
#include "config/config.h"
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
@ -317,6 +316,13 @@ void pwmInConfig(const timerHardware_t *timerHardwarePtr, uint8_t channel)
|
|||
#define UNUSED_PPM_TIMER_REFERENCE 0
|
||||
#define FIRST_PWM_PORT 0
|
||||
|
||||
void ppmAvoidPWMTimerClash(const timerHardware_t *timerHardwarePtr, TIM_TypeDef *sharedPwmTimer)
|
||||
{
|
||||
if (timerHardwarePtr->tim == sharedPwmTimer) {
|
||||
ppmCountShift = 3; // Divide by 8 if the timer is running at 8 MHz
|
||||
}
|
||||
}
|
||||
|
||||
void ppmInConfig(const timerHardware_t *timerHardwarePtr)
|
||||
{
|
||||
ppmInit();
|
||||
|
@ -331,11 +337,6 @@ void ppmInConfig(const timerHardware_t *timerHardwarePtr)
|
|||
|
||||
timerConfigure(timerHardwarePtr, (uint16_t)PPM_TIMER_PERIOD, PWM_TIMER_MHZ);
|
||||
|
||||
if((timerHardwarePtr->tim == TIM4) && (feature(FEATURE_ONESHOT125))){
|
||||
ppmCountShift = 3; // Divide by 8 if the timer is running at 8 MHz
|
||||
}
|
||||
|
||||
|
||||
timerChCCHandlerInit(&self->edgeCb, ppmEdgeCallback);
|
||||
timerChOvrHandlerInit(&self->overflowCb, ppmOverflowCallback);
|
||||
timerChConfigCallbacks(timerHardwarePtr, &self->edgeCb, &self->overflowCb);
|
||||
|
|
|
@ -23,8 +23,9 @@ typedef enum {
|
|||
} inputFilteringMode_e;
|
||||
|
||||
void ppmInConfig(const timerHardware_t *timerHardwarePtr);
|
||||
void pwmInConfig(const timerHardware_t *timerHardwarePtr, uint8_t channel);
|
||||
void ppmAvoidPWMTimerClash(const timerHardware_t *timerHardwarePtr, TIM_TypeDef *sharedPwmTimer);
|
||||
|
||||
void pwmInConfig(const timerHardware_t *timerHardwarePtr, uint8_t channel);
|
||||
uint16_t pwmRead(uint8_t channel);
|
||||
|
||||
bool isPPMDataBeingReceived(void);
|
||||
|
|
Loading…
Reference in New Issue