PXX2 init was not called
This commit is contained in:
@@ -160,13 +160,13 @@ void setupPulses(uint8_t port)
|
||||
|
||||
#if defined(CROSSFIRE)
|
||||
case PROTO_CROSSFIRE:
|
||||
disable_crossfire(port);
|
||||
disable_module_timer(port);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PXX2)
|
||||
case PROTO_PXX2:
|
||||
disable_pxx2(port);
|
||||
disable_module_timer(port);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -277,7 +277,13 @@ void setupPulses(uint8_t port)
|
||||
|
||||
#if defined(CROSSFIRE)
|
||||
case PROTO_CROSSFIRE:
|
||||
init_crossfire(port);
|
||||
init_module_timer(port, CROSSFIRE_PERIOD, true);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PXX2)
|
||||
case PROTO_PXX2:
|
||||
init_module_timer(port, PXX2_PERIOD, true);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -195,9 +195,8 @@ void init_pxx(uint32_t module_index);
|
||||
void disable_pxx(uint32_t module_index);
|
||||
void init_serial(uint32_t module_index, uint32_t baudrate, uint32_t period_half_us);
|
||||
void disable_serial(uint32_t module_index);
|
||||
void init_crossfire(uint32_t module_index);
|
||||
void disable_crossfire(uint32_t module_index);
|
||||
void disable_pxx2(uint32_t module_index);
|
||||
void init_module_timer( uint32_t module_index, uint32_t period, uint8_t state);
|
||||
void disable_module_timer( uint32_t module_index);
|
||||
|
||||
// Trainer driver
|
||||
void init_trainer_ppm(void);
|
||||
|
||||
@@ -34,9 +34,12 @@ void extmoduleStop()
|
||||
EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN;
|
||||
}
|
||||
|
||||
void extmoduleNoneStart()
|
||||
void extmoduleTimerStart(uint32_t period, uint8_t state)
|
||||
{
|
||||
EXTERNAL_MODULE_OFF();
|
||||
if (state)
|
||||
EXTERNAL_MODULE_ON();
|
||||
else
|
||||
EXTERNAL_MODULE_OFF();
|
||||
|
||||
GPIO_PinAFConfig(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PinSource, 0);
|
||||
|
||||
@@ -51,8 +54,8 @@ void extmoduleNoneStart()
|
||||
|
||||
EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN;
|
||||
EXTMODULE_TIMER->PSC = EXTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS (2Mhz)
|
||||
EXTMODULE_TIMER->ARR = 36000; // 18mS
|
||||
EXTMODULE_TIMER->CCR2 = 32000; // Update time
|
||||
EXTMODULE_TIMER->ARR = (2000 * period);
|
||||
EXTMODULE_TIMER->CCR2 = (2000 * period) - 1000;
|
||||
EXTMODULE_TIMER->EGR = 1; // Restart
|
||||
EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF;
|
||||
EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt
|
||||
@@ -62,6 +65,7 @@ void extmoduleNoneStart()
|
||||
NVIC_SetPriority(EXTMODULE_TIMER_IRQn, 7);
|
||||
}
|
||||
|
||||
|
||||
void extmodulePpmStart()
|
||||
{
|
||||
EXTERNAL_MODULE_ON();
|
||||
@@ -209,34 +213,6 @@ void extmoduleSerialStart(uint32_t /*baudrate*/, uint32_t period_half_us)
|
||||
}
|
||||
#endif
|
||||
|
||||
void extmoduleCrossfireStart()
|
||||
{
|
||||
EXTERNAL_MODULE_ON();
|
||||
|
||||
GPIO_PinAFConfig(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PinSource, 0);
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = EXTMODULE_TX_GPIO_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(EXTMODULE_TX_GPIO, &GPIO_InitStructure);
|
||||
GPIO_SetBits(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PIN); // Set high
|
||||
|
||||
EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN;
|
||||
EXTMODULE_TIMER->PSC = EXTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS (2Mhz)
|
||||
EXTMODULE_TIMER->ARR = (2000 * CROSSFIRE_PERIOD);
|
||||
EXTMODULE_TIMER->CCR2 = (2000 * CROSSFIRE_PERIOD) - 1000;
|
||||
EXTMODULE_TIMER->EGR = 1; // Restart
|
||||
EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF;
|
||||
EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt
|
||||
EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN;
|
||||
|
||||
NVIC_EnableIRQ(EXTMODULE_TIMER_IRQn);
|
||||
NVIC_SetPriority(EXTMODULE_TIMER_IRQn, 7);
|
||||
}
|
||||
|
||||
void extmoduleSendNextFrame()
|
||||
{
|
||||
if (s_current_protocol[EXTERNAL_MODULE] == PROTO_PPM) {
|
||||
|
||||
@@ -26,18 +26,17 @@ void extmoduleStop(void);
|
||||
void intmoduleNoneStart(void);
|
||||
void intmodulePxxStart(void);
|
||||
|
||||
void extmoduleNoneStart(void);
|
||||
void extmoduleTimerStart(uint32_t period, uint8_t state);
|
||||
void extmodulePpmStart(void);
|
||||
void extmodulePxxStart(void);
|
||||
void extmoduleSerialStart(uint32_t baudrate, uint32_t period_half_us);
|
||||
void extmoduleCrossfireStart(void);
|
||||
|
||||
void init_no_pulses(uint32_t port)
|
||||
{
|
||||
if (port == INTERNAL_MODULE)
|
||||
intmoduleNoneStart();
|
||||
else
|
||||
extmoduleNoneStart();
|
||||
extmoduleTimerStart(18, false);
|
||||
}
|
||||
|
||||
void disable_no_pulses(uint32_t port)
|
||||
@@ -94,24 +93,17 @@ void disable_serial(uint32_t port)
|
||||
}
|
||||
#endif
|
||||
|
||||
void init_crossfire(uint32_t port)
|
||||
void init_module_timer(uint32_t port, uint32_t period, uint8_t state)
|
||||
{
|
||||
if (port == EXTERNAL_MODULE) {
|
||||
extmoduleCrossfireStart();
|
||||
extmoduleTimerStart(period, state);
|
||||
}
|
||||
}
|
||||
|
||||
void disable_crossfire(uint32_t port)
|
||||
void disable_module_timer(uint32_t port)
|
||||
{
|
||||
if (port == EXTERNAL_MODULE) {
|
||||
extmoduleStop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void disable_pxx2(uint32_t port)
|
||||
{
|
||||
if (port == EXTERNAL_MODULE) {
|
||||
extmoduleStop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,10 +188,8 @@ void init_pxx( uint32_t module_index);
|
||||
void disable_pxx( uint32_t module_index);
|
||||
void init_serial( uint32_t module_index, uint32_t baudrate, uint32_t period);
|
||||
void disable_serial( uint32_t module_index);
|
||||
void init_crossfire( uint32_t module_index);
|
||||
void disable_crossfire( uint32_t module_index);
|
||||
void init_pxx2( uint32_t module_index);
|
||||
void disable_pxx2( uint32_t module_index);
|
||||
void init_module_timer( uint32_t module_index, uint32_t period, uint8_t state);
|
||||
void disable_module_timer( uint32_t module_index);
|
||||
|
||||
// Trainer driver
|
||||
#define SLAVE_MODE() (g_model.trainerMode == TRAINER_MODE_SLAVE)
|
||||
|
||||
@@ -41,11 +41,12 @@ void extmoduleStop()
|
||||
}
|
||||
}
|
||||
|
||||
void extmoduleNoneStart()
|
||||
void extmoduleTimerStart(uint32_t period, uint8_t state)
|
||||
{
|
||||
if (!IS_TRAINER_EXTERNAL_MODULE()) {
|
||||
if (state)
|
||||
EXTERNAL_MODULE_ON();
|
||||
else if (!IS_TRAINER_EXTERNAL_MODULE())
|
||||
EXTERNAL_MODULE_OFF();
|
||||
}
|
||||
|
||||
GPIO_PinAFConfig(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PinSource, 0);
|
||||
|
||||
@@ -60,8 +61,8 @@ void extmoduleNoneStart()
|
||||
|
||||
EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN;
|
||||
EXTMODULE_TIMER->PSC = EXTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS from 30MHz
|
||||
EXTMODULE_TIMER->ARR = 36000; // 18mS
|
||||
EXTMODULE_TIMER->CCR2 = 32000; // Update time
|
||||
EXTMODULE_TIMER->ARR = (2000 * period);
|
||||
EXTMODULE_TIMER->CCR2 = (2000 * period) - 1000;
|
||||
EXTMODULE_TIMER->EGR = 1; // Restart
|
||||
EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF;
|
||||
EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt
|
||||
@@ -235,34 +236,6 @@ void extmodulePxxStart()
|
||||
}
|
||||
#endif
|
||||
|
||||
void extmoduleCrossfireStart()
|
||||
{
|
||||
EXTERNAL_MODULE_ON();
|
||||
|
||||
GPIO_PinAFConfig(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PinSource, 0);
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = EXTMODULE_TX_GPIO_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(EXTMODULE_TX_GPIO, &GPIO_InitStructure);
|
||||
GPIO_SetBits(EXTMODULE_TX_GPIO, EXTMODULE_TX_GPIO_PIN); // Set high
|
||||
|
||||
EXTMODULE_TIMER->CR1 &= ~TIM_CR1_CEN;
|
||||
EXTMODULE_TIMER->PSC = EXTMODULE_TIMER_FREQ / 2000000 - 1; // 0.5uS from 30MHz
|
||||
EXTMODULE_TIMER->ARR = (2000 * CROSSFIRE_PERIOD);
|
||||
EXTMODULE_TIMER->CCR2 = (2000 * CROSSFIRE_PERIOD) - 1000;
|
||||
EXTMODULE_TIMER->EGR = 1; // Restart
|
||||
EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF;
|
||||
EXTMODULE_TIMER->DIER |= TIM_DIER_CC2IE; // Enable this interrupt
|
||||
EXTMODULE_TIMER->CR1 |= TIM_CR1_CEN;
|
||||
|
||||
NVIC_EnableIRQ(EXTMODULE_TIMER_CC_IRQn);
|
||||
NVIC_SetPriority(EXTMODULE_TIMER_CC_IRQn, 7);
|
||||
}
|
||||
|
||||
void extmoduleSendNextFrame()
|
||||
{
|
||||
if (s_current_protocol[EXTERNAL_MODULE] == PROTO_PPM) {
|
||||
|
||||
@@ -29,11 +29,11 @@ void intmodulePxxStart(void);
|
||||
void intmodulePpmStart(void);
|
||||
#endif
|
||||
|
||||
void extmoduleNoneStart(void);
|
||||
void extmoduleTimerStart(uint32_t period, uint8_t state);
|
||||
void extmodulePpmStart(void);
|
||||
void extmodulePxxStart(void);
|
||||
void extmoduleSerialStart(uint32_t baudrate, uint32_t period_half_us);
|
||||
void extmoduleCrossfireStart(void);
|
||||
|
||||
|
||||
void init_pxx(uint32_t port)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ void init_no_pulses(uint32_t port)
|
||||
if (port == INTERNAL_MODULE)
|
||||
intmoduleNoneStart();
|
||||
else
|
||||
extmoduleNoneStart();
|
||||
extmoduleTimerStart(18, false);
|
||||
}
|
||||
|
||||
void disable_no_pulses(uint32_t port)
|
||||
@@ -107,25 +107,16 @@ void disable_no_pulses(uint32_t port)
|
||||
extmoduleStop();
|
||||
}
|
||||
|
||||
void init_crossfire(uint32_t port)
|
||||
void init_module_timer(uint32_t port, uint32_t period, uint8_t state)
|
||||
{
|
||||
if (port == EXTERNAL_MODULE) {
|
||||
extmoduleCrossfireStart();
|
||||
extmoduleTimerStart(period, state);
|
||||
}
|
||||
}
|
||||
|
||||
void disable_crossfire(uint32_t port)
|
||||
void disable_module_timer(uint32_t port)
|
||||
{
|
||||
if (port == EXTERNAL_MODULE) {
|
||||
extmoduleStop();
|
||||
}
|
||||
}
|
||||
|
||||
void disable_pxx2(uint32_t port)
|
||||
{
|
||||
if (port == EXTERNAL_MODULE) {
|
||||
extmoduleStop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user