Pulses refactoring (another one!) (#6510)
Pulses refactoring (another one!)
This commit is contained in:
@@ -178,7 +178,7 @@ if(PCB STREQUAL XLITE OR PCB STREQUAL XLITES OR PCB STREQUAL X9LITE)
|
||||
${TARGET_SRC}
|
||||
../common/arm/stm32/intmodule_serial_driver.cpp
|
||||
)
|
||||
else()
|
||||
elseif(NOT (PCB STREQUAL X7 AND PCBREV STREQUAL T12))
|
||||
set(TARGET_SRC
|
||||
${TARGET_SRC}
|
||||
intmodule_pulses_driver.cpp
|
||||
|
||||
@@ -199,29 +199,10 @@ uint32_t isBootloaderStart(const uint8_t * buffer);
|
||||
#define IS_INTERNAL_MODULE_ON() (GPIO_ReadInputDataBit(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN) == Bit_SET)
|
||||
#endif
|
||||
|
||||
void init_ppm(uint8_t module);
|
||||
void disable_ppm(uint8_t module);
|
||||
void init_pxx2(uint8_t module);
|
||||
void disable_pxx2(uint8_t module);
|
||||
void init_pxx1_pulses(uint8_t module);
|
||||
void init_pxx1_serial(uint8_t module);
|
||||
void disable_pxx1_pulses(uint8_t module);
|
||||
void disable_pxx1_serial(uint8_t module);
|
||||
void disable_serial(uint8_t module);
|
||||
void intmoduleStop();
|
||||
void intmodulePxxStart();
|
||||
void intmoduleSerialStart(uint32_t baudrate, uint8_t rxEnable);
|
||||
#if defined(INTERNAL_MODULE_PPM)
|
||||
void intmodulePpmStart(void);
|
||||
#endif
|
||||
void intmoduleSendBuffer(const uint8_t * data, uint8_t size);
|
||||
void intmoduleSendNextFrame();
|
||||
|
||||
void extmoduleStop();
|
||||
void extmodulePpmStart();
|
||||
void extmodulePxxPulsesStart();
|
||||
void extmodulePxxSerialStart();
|
||||
void extmodulePxx2Start();
|
||||
void extmoduleSerialStart(uint32_t baudrate, uint32_t period_half_us, bool inverted);
|
||||
void extmoduleInvertedSerialStart(uint32_t baudrate);
|
||||
void extmoduleSendBuffer(const uint8_t * data, uint8_t size);
|
||||
|
||||
@@ -196,20 +196,10 @@ extern "C" void EXTMODULE_USART_IRQHandler(void)
|
||||
status = EXTMODULE_USART->SR;
|
||||
}
|
||||
}
|
||||
|
||||
void extmodulePxx2Start()
|
||||
{
|
||||
extmoduleInvertedSerialStart(PXX2_EXTERNAL_MODULE_BAUDRATE);
|
||||
}
|
||||
#else
|
||||
void extmodulePxx2Start()
|
||||
{
|
||||
// TODO just enable the S.PORT line (or let telemetry init do it)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PXX1)
|
||||
void extmodulePxxPulsesStart()
|
||||
void extmodulePxx1PulsesStart()
|
||||
{
|
||||
EXTERNAL_MODULE_ON();
|
||||
|
||||
@@ -246,7 +236,7 @@ void extmodulePxxPulsesStart()
|
||||
#endif
|
||||
|
||||
#if defined(PXX1) && defined(EXTMODULE_USART)
|
||||
void extmodulePxxSerialStart()
|
||||
void extmodulePxx1SerialStart()
|
||||
{
|
||||
extmoduleInvertedSerialStart(EXTMODULE_PXX_SERIAL_BAUDRATE);
|
||||
}
|
||||
@@ -340,7 +330,7 @@ extern "C" void EXTMODULE_TIMER_CC_IRQHandler()
|
||||
{
|
||||
EXTMODULE_TIMER->DIER &= ~TIM_DIER_CC2IE; // Stop this interrupt
|
||||
EXTMODULE_TIMER->SR &= ~TIM_SR_CC2IF;
|
||||
if (setupPulses(EXTERNAL_MODULE)) {
|
||||
if (setupPulsesExternalModule()) {
|
||||
extmoduleSendNextFrame();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,12 +83,7 @@ void intmoduleSendNextFrame()
|
||||
}
|
||||
}
|
||||
|
||||
void intmoduleSerialStart(uint32_t baudrate, uint8_t rxEnable)
|
||||
{
|
||||
// nothing, the pulses will be sent through telemetry port
|
||||
}
|
||||
|
||||
void intmodulePxxStart()
|
||||
void intmodulePxx1PulsesStart()
|
||||
{
|
||||
INTERNAL_MODULE_ON();
|
||||
|
||||
@@ -172,7 +167,7 @@ extern "C" void INTMODULE_TIMER_CC_IRQHandler()
|
||||
{
|
||||
INTMODULE_TIMER->DIER &= ~TIM_DIER_CC2IE; // Stop this interrupt
|
||||
INTMODULE_TIMER->SR &= ~TIM_SR_CC2IF;
|
||||
if (setupPulses(INTERNAL_MODULE)) {
|
||||
if (setupPulsesInternalModule()) {
|
||||
intmoduleSendNextFrame();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(PXX1)
|
||||
void init_pxx1_pulses(uint8_t module)
|
||||
{
|
||||
if (module == INTERNAL_MODULE)
|
||||
intmodulePxxStart();
|
||||
else
|
||||
extmodulePxxPulsesStart();
|
||||
}
|
||||
|
||||
void init_pxx1_serial(uint8_t module)
|
||||
{
|
||||
if (module == INTERNAL_MODULE)
|
||||
intmodulePxxStart();
|
||||
#if defined(EXTMODULE_USART)
|
||||
else
|
||||
extmodulePxxSerialStart();
|
||||
#endif
|
||||
}
|
||||
|
||||
void disable_pxx1_pulses(uint8_t module)
|
||||
{
|
||||
if (module == INTERNAL_MODULE)
|
||||
intmoduleStop();
|
||||
else
|
||||
extmoduleStop();
|
||||
}
|
||||
|
||||
void disable_pxx1_serial(uint8_t module)
|
||||
{
|
||||
if (module == INTERNAL_MODULE)
|
||||
intmoduleStop();
|
||||
else
|
||||
extmoduleStop();
|
||||
}
|
||||
#endif
|
||||
|
||||
void init_pxx2(uint8_t module)
|
||||
{
|
||||
if (module == INTERNAL_MODULE)
|
||||
intmoduleSerialStart(INTMODULE_PXX_BAUDRATE, true);
|
||||
else
|
||||
extmodulePxx2Start();
|
||||
}
|
||||
|
||||
void disable_pxx2(uint8_t module)
|
||||
{
|
||||
if (module == INTERNAL_MODULE)
|
||||
intmoduleStop();
|
||||
else
|
||||
extmoduleStop();
|
||||
}
|
||||
|
||||
#if defined(DSM2)
|
||||
void disable_serial(uint8_t module)
|
||||
{
|
||||
if (module == EXTERNAL_MODULE) {
|
||||
extmoduleStop();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void init_ppm(uint8_t module)
|
||||
{
|
||||
if (module == EXTERNAL_MODULE) {
|
||||
extmodulePpmStart();
|
||||
}
|
||||
#if defined(INTERNAL_MODULE_PPM)
|
||||
else {
|
||||
intmodulePpmStart();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void disable_ppm(uint8_t module)
|
||||
{
|
||||
if (module == EXTERNAL_MODULE) {
|
||||
extmoduleStop();
|
||||
}
|
||||
#if defined(INTERNAL_MODULE_PPM)
|
||||
else {
|
||||
intmoduleStop();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user