Multi internal driver

This commit is contained in:
Raphael Coeffic
2022-03-20 16:22:12 +01:00
parent 19a58558e5
commit a176628db6
3 changed files with 71 additions and 33 deletions
+7 -33
View File
@@ -24,7 +24,6 @@
#include "heartbeat_driver.h"
#include "io/frsky_pxx2.h"
#include "io/multi_protolist.h"
#include "pulses/pxx2.h"
#include "pulses/flysky.h"
@@ -40,6 +39,11 @@
#include "pulses/crossfire.h"
#endif
#if defined(MULTIMODULE)
#include "io/multi_protolist.h"
#include "pulses/multi.h"
#endif
uint8_t s_pulses_paused = 0;
ModuleState moduleState[NUM_MODULES];
InternalModulePulsesData intmodulePulsesData __DMA;
@@ -324,24 +328,8 @@ static void enablePulsesInternalModule(uint8_t protocol)
#if defined(INTERNAL_MODULE_MULTI)
case PROTOCOL_CHANNELS_MULTIMODULE:
// TODO: use module interface
// serial port setup
intmodulePulsesData.multi.initFrame();
intmoduleFifo.clear();
IntmoduleSerialDriver.init(&multiSerialInitParams);
// mixer setup
mixerSchedulerSetPeriod(INTERNAL_MODULE, MULTIMODULE_PERIOD);
// reset status
getMultiModuleStatus(INTERNAL_MODULE).failsafeChecked = false;
getMultiModuleStatus(INTERNAL_MODULE).flags = 0;
#if defined(MULTI_PROTOLIST)
TRACE("enablePulsesInternalModule(): trigger scan");
MultiRfProtocols::instance(INTERNAL_MODULE)->triggerScan();
TRACE("counter = %d", moduleState[INTERNAL_MODULE].counter);
#endif
internalModuleContext = MultiInternalDriver.init(INTERNAL_MODULE);
internalModuleDriver = &MultiInternalDriver;
break;
#endif
@@ -409,13 +397,6 @@ bool setupPulsesInternalModule(uint8_t protocol)
return true;
#endif
#if defined(INTERNAL_MODULE_MULTI)
case PROTOCOL_CHANNELS_MULTIMODULE:
setupPulsesMultiInternalModule();
mixerSchedulerSetPeriod(INTERNAL_MODULE, MULTIMODULE_PERIOD);
return true;
#endif
#if defined(AFHDS2)
case PROTOCOL_CHANNELS_AFHDS2A:
{
@@ -480,13 +461,6 @@ void intmoduleSendNextFrame()
#endif
#endif
#if defined(INTERNAL_MODULE_MULTI)
case PROTOCOL_CHANNELS_MULTIMODULE:
IntmoduleSerialDriver.sendBuffer(intmodulePulsesData.multi.getData(),
intmodulePulsesData.multi.getSize());
break;
#endif
#if defined(AFHDS2)
case PROTOCOL_CHANNELS_AFHDS2A: {
uint8_t* data = (uint8_t*)intmodulePulsesData.flysky.pulses;