mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
PPM and PWM now have their own ___ReadRawRC functions.
Because a required change for PWM disturbed the PPM mode.
This commit is contained in:
parent
95840ae512
commit
d2c40076db
3 changed files with 16 additions and 4 deletions
|
@ -339,6 +339,11 @@ void ppmInConfig(const timerHardware_t *timerHardwarePtr)
|
|||
timerChConfigCallbacks(timerHardwarePtr, &self->edgeCb, &self->overflowCb);
|
||||
}
|
||||
|
||||
uint16_t ppmRead(uint8_t channel)
|
||||
{
|
||||
return captures[channel];
|
||||
}
|
||||
|
||||
uint16_t pwmRead(uint8_t channel)
|
||||
{
|
||||
uint16_t capture = captures[channel];
|
||||
|
|
|
@ -30,6 +30,7 @@ void ppmAvoidPWMTimerClash(const timerHardware_t *timerHardwarePtr, TIM_TypeDef
|
|||
|
||||
void pwmInConfig(const timerHardware_t *timerHardwarePtr, uint8_t channel);
|
||||
uint16_t pwmRead(uint8_t channel);
|
||||
uint16_t ppmRead(uint8_t channel);
|
||||
|
||||
bool isPPMDataBeingReceived(void);
|
||||
void resetPPMDataReceivedState(void);
|
||||
|
|
|
@ -34,23 +34,29 @@
|
|||
#include "rx/rx.h"
|
||||
#include "rx/pwm.h"
|
||||
|
||||
static uint16_t pwmReadRawRC(rxRuntimeConfig_t *rxRuntimeConfigPtr, uint8_t chan)
|
||||
static uint16_t pwmReadRawRC(rxRuntimeConfig_t *rxRuntimeConfigPtr, uint8_t channel)
|
||||
{
|
||||
UNUSED(rxRuntimeConfigPtr);
|
||||
return pwmRead(chan);
|
||||
return pwmRead(channel);
|
||||
}
|
||||
|
||||
static uint16_t ppmReadRawRC(rxRuntimeConfig_t *rxRuntimeConfigPtr, uint8_t channel)
|
||||
{
|
||||
UNUSED(rxRuntimeConfigPtr);
|
||||
return ppmRead(channel);
|
||||
}
|
||||
|
||||
void rxPwmInit(rxRuntimeConfig_t *rxRuntimeConfigPtr, rcReadRawDataPtr *callback)
|
||||
{
|
||||
UNUSED(rxRuntimeConfigPtr);
|
||||
// configure PWM/CPPM read function and max number of channels. serial rx below will override both of these, if enabled
|
||||
*callback = pwmReadRawRC;
|
||||
|
||||
if (feature(FEATURE_RX_PARALLEL_PWM)) {
|
||||
rxRuntimeConfigPtr->channelCount = MAX_SUPPORTED_RC_PARALLEL_PWM_CHANNEL_COUNT;
|
||||
*callback = pwmReadRawRC;
|
||||
}
|
||||
if (feature(FEATURE_RX_PPM)) {
|
||||
rxRuntimeConfigPtr->channelCount = MAX_SUPPORTED_RC_PPM_CHANNEL_COUNT;
|
||||
*callback = ppmReadRawRC;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue