Code cleanup on Sky9x pulses

This commit is contained in:
bsongis
2014-06-17 15:41:27 +02:00
parent 9e64801384
commit 39118453da
5 changed files with 136 additions and 62 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ void setupPulsesPPM(unsigned int port) // Don't enable interru
#if defined(PCBSKY9X)
register Pwm *pwmptr = PWM;
uint32_t pwmCh = (port == 0 ? 3 : 1);
uint32_t pwmCh = (port == EXTERNAL_MODULE ? 3 : 1);
pwmptr->PWM_CH_NUM[pwmCh].PWM_CDTYUPD = (g_model.moduleData[port].ppmDelay * 50 + 300) * 2; //Stoplen *2
if (g_model.moduleData[port].ppmPulsePol)
pwmptr->PWM_CH_NUM[pwmCh].PWM_CMR |= 0x00000200 ; // CPOL
@@ -81,7 +81,7 @@ void setupPulsesPPM(unsigned int port) // Don't enable interru
if (port == TRAINER_MODULE) {
TIM3->CCR2 = rest - 1000 ; // Update time
TIM3->CCR4 = (g_model.moduleData[port].ppmDelay*50+300)*2;
if(!g_model.moduleData[TRAINER_MODULE].ppmPulsePol)
if (!g_model.moduleData[TRAINER_MODULE].ppmPulsePol)
TIM3->CCER |= TIM_CCER_CC4P;
else
TIM3->CCER &= ~TIM_CCER_CC4P;