CC3D - Hack to enable a simple quad configuration using PPM input to be

tested.

PPM and motor outputs conflict since they use the same timers so this
just avoids conflicts.
This commit is contained in:
Dominic Clifton 2014-07-17 23:52:49 +01:00
parent 668e8f1298
commit 053a28dc62
2 changed files with 20 additions and 10 deletions

View File

@ -139,6 +139,16 @@ static const uint16_t airPWM[] = {
#endif
#if USABLE_TIMER_CHANNEL_COUNT == 12
#ifdef CC3D // XXX HACK while PPM and MOTOR code conflicts.
static const uint16_t multiPPM[] = {
PWM6 | (TYPE_IP << 8), // PPM input
PWM7 | (TYPE_M << 8), // Swap to servo if needed
PWM8 | (TYPE_M << 8), // Swap to servo if needed
PWM9 | (TYPE_M << 8),
PWM10 | (TYPE_M << 8),
0xFFFF
};
#else
static const uint16_t multiPPM[] = {
PWM1 | (TYPE_IP << 8), // PPM input
PWM7 | (TYPE_M << 8), // Swap to servo if needed
@ -154,7 +164,7 @@ static const uint16_t multiPPM[] = {
PWM6 | (TYPE_M << 8), // Swap to servo if needed
0xFFFF
};
#endif
static const uint16_t multiPWM[] = {
PWM1 | (TYPE_IW << 8), // input #1
PWM2 | (TYPE_IW << 8),
@ -174,8 +184,8 @@ static const uint16_t multiPWM[] = {
static const uint16_t airPPM[] = {
PWM1 | (TYPE_IP << 8), // PPM input
PWM7 | (TYPE_M << 8),
PWM8 | (TYPE_M << 8),
PWM9 | (TYPE_S << 8),
PWM8 | (TYPE_M << 8),
PWM9 | (TYPE_S << 8),
PWM10 | (TYPE_S << 8),
PWM11 | (TYPE_S << 8),
PWM12 | (TYPE_S << 8),
@ -335,9 +345,9 @@ pwmOutputConfiguration_t *pwmInit(drv_pwm_config_t *init)
channelIndex++;
} else if (type == TYPE_M) {
if (init->motorPwmRate > 500) {
pwmBrushedMotorConfig(&timerHardware[timerIndex], pwmOutputConfiguration.motorCount, init->motorPwmRate, init->idlePulse);
pwmBrushedMotorConfig(&timerHardware[timerIndex], pwmOutputConfiguration.motorCount, init->motorPwmRate, init->idlePulse);
} else {
pwmBrushlessMotorConfig(&timerHardware[timerIndex], pwmOutputConfiguration.motorCount, init->motorPwmRate, init->idlePulse);
pwmBrushlessMotorConfig(&timerHardware[timerIndex], pwmOutputConfiguration.motorCount, init->motorPwmRate, init->idlePulse);
}
pwmOutputConfiguration.motorCount++;
} else if (type == TYPE_S) {

View File

@ -104,12 +104,12 @@ const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
{ TIM2, GPIOA, Pin_0, TIM_Channel_1, TIM2_IRQn, 0, Mode_IPD}, // S5_IN
{ TIM2, GPIOA, Pin_1, TIM_Channel_2, TIM2_IRQn, 0, Mode_IPD}, // S6_IN
{ TIM4, GPIOB, Pin_9, TIM_Channel_4, TIM4_IRQn, 0, GPIO_Mode_AF_PP}, // S1_OUT
{ TIM4, GPIOB, Pin_8, TIM_Channel_3, TIM4_IRQn, 0, GPIO_Mode_AF_PP}, // S2_OUT
{ TIM4, GPIOB, Pin_7, TIM_Channel_2, TIM4_IRQn, 0, GPIO_Mode_AF_PP}, // S3_OUT
{ TIM4, GPIOB, Pin_9, TIM_Channel_4, TIM4_IRQn, 1, GPIO_Mode_AF_PP}, // S1_OUT
{ TIM4, GPIOB, Pin_8, TIM_Channel_3, TIM4_IRQn, 1, GPIO_Mode_AF_PP}, // S2_OUT
{ TIM4, GPIOB, Pin_7, TIM_Channel_2, TIM4_IRQn, 1, GPIO_Mode_AF_PP}, // S3_OUT
{ TIM1, GPIOA, Pin_8, TIM_Channel_1, TIM1_CC_IRQn, 1, GPIO_Mode_AF_PP}, // S4_OUT
{ TIM3, GPIOB, Pin_4, TIM_Channel_1, TIM3_IRQn, 0, GPIO_Mode_AF_PP}, // S5_OUT - GPIO_PartialRemap_TIM3
{ TIM2, GPIOA, Pin_2, TIM_Channel_3, TIM2_IRQn, 0, GPIO_Mode_AF_PP}, // S6_OUT
{ TIM3, GPIOB, Pin_4, TIM_Channel_1, TIM3_IRQn, 1, GPIO_Mode_AF_PP}, // S5_OUT - GPIO_PartialRemap_TIM3
{ TIM2, GPIOA, Pin_2, TIM_Channel_3, TIM2_IRQn, 1, GPIO_Mode_AF_PP}, // S6_OUT
};
#define MAX_TIMERS 4 // TIM1..TIM4