Move all serial internal module functions into proper drivers

This commit is contained in:
Raphael Coeffic
2022-03-20 16:22:12 +01:00
parent f733810c79
commit 803b472c85
15 changed files with 216 additions and 81 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ enum ChannelsProtocols {
PROTOCOL_CHANNELS_GHOST
};
struct etx_hal_module_driver_t {
struct etx_module_driver_t {
// Protocol implemented by this module driver
ChannelsProtocols protocol;
+7 -2
View File
@@ -251,11 +251,14 @@ void FrskyDeviceFirmwareUpdate::sendFrame()
switch (module) {
#if defined(INTERNAL_MODULE_PXX2)
case INTERNAL_MODULE:
return intmoduleSendBuffer(outputTelemetryBuffer.data, ptr - outputTelemetryBuffer.data);
IntmoduleSerialDriver.sendBuffer(outputTelemetryBuffer.data,
ptr - outputTelemetryBuffer.data);
return;
#endif
default:
return sportSendBuffer(outputTelemetryBuffer.data, ptr - outputTelemetryBuffer.data);
sportSendBuffer(outputTelemetryBuffer.data, ptr - outputTelemetryBuffer.data);
return;
}
}
@@ -306,6 +309,7 @@ const char * FrskyDeviceFirmwareUpdate::sendReqVersion()
// X9D / X9D+ / X9E / XLite IXJT = use S.PORT @ 57600 bauds
// XLite PRO / X9Lite / X9D+ 2019 ISRM = use TX + RX @ 57600 bauds
#if defined(INTMODULE_USART)
static const etx_serial_init serialInitParams = {
.baudrate = 0,
.parity = ETX_Parity_None,
@@ -315,6 +319,7 @@ static const etx_serial_init serialInitParams = {
.on_receive = intmoduleFifoReceive,
.on_error = intmoduleFifoError,
};
#endif
const char * FrskyDeviceFirmwareUpdate::doFlashFirmware(const char * filename, ProgressHandler progressHandler)
{
+10 -7
View File
@@ -127,7 +127,6 @@ static void intmoduleCRSF_rx(uint8_t data)
}
#endif
}
#endif
static const etx_serial_init intmoduleCrossfireInitParams = {
.baudrate = 0,
@@ -138,6 +137,7 @@ static const etx_serial_init intmoduleCrossfireInitParams = {
.on_receive = intmoduleCRSF_rx,
.on_error = nullptr,
};
#endif
static void* crossfireInit(uint8_t module)
{
@@ -156,16 +156,17 @@ static void* crossfireInit(uint8_t module)
} else {
// TODO: setup S.PORT
// - for now, the init is still done via telemetryWakeup()....
telemetryInit(PROTOCOL_TELEMETRY_CROSSFIRE);
}
// mixer setup
mixerSchedulerSetPeriod(INTERNAL_MODULE, CROSSFIRE_PERIOD);
return (void*)(uint32_t)module;
mixerSchedulerSetPeriod(module, CROSSFIRE_PERIOD);
return (void*)(ulong)module;
}
static void crossfireDeInit(void* context)
{
uint32_t module = (uint32_t)context;
ulong module = (ulong)context;
if (module == INTERNAL_MODULE) {
#if defined(INTERNAL_MODULE_CRSF)
@@ -180,7 +181,7 @@ static void crossfireDeInit(void* context)
static void crossfireSetupPulses(void* context, int16_t* channels, uint8_t nChannels)
{
uint32_t module = (uint32_t)context;
ulong module = (ulong)context;
ModuleSyncStatus& status = getModuleSyncStatus(module);
if (status.isValid()) {
@@ -194,11 +195,13 @@ static void crossfireSetupPulses(void* context, int16_t* channels, uint8_t nChan
static void crossfireSendPulses(void* context)
{
uint32_t module = (uint32_t)context;
ulong module = (ulong)context;
if (module == INTERNAL_MODULE) {
#if defined(INTERNAL_MODULE_CRSF)
IntmoduleSerialDriver.sendBuffer(intmodulePulsesData.crossfire.pulses,
intmodulePulsesData.crossfire.length);
#endif
} else {
sportSendBuffer(extmodulePulsesData.crossfire.pulses,
extmodulePulsesData.crossfire.length);
@@ -207,7 +210,7 @@ static void crossfireSendPulses(void* context)
#include "hal/module_driver.h"
etx_hal_module_driver_t CrossfireModuleDriver = {
etx_module_driver_t CrossfireModuleDriver = {
.protocol = PROTOCOL_CHANNELS_CROSSFIRE,
.init = crossfireInit,
.deinit = crossfireDeInit,
+1 -1
View File
@@ -23,4 +23,4 @@
#include "hal/module_driver.h"
extern etx_hal_module_driver_t CrossfireModuleDriver;
extern etx_module_driver_t CrossfireModuleDriver;
+18 -31
View File
@@ -21,6 +21,7 @@
#include "opentx.h"
#include "mixer_scheduler.h"
#include "heartbeat_driver.h"
#include "io/frsky_pxx2.h"
#include "io/multi_protolist.h"
@@ -322,13 +323,11 @@ void enablePulsesExternalModule(uint8_t protocol)
#if defined(PXX2) && defined(EXTMODULE_USART)
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
extmoduleInvertedSerialStart(PXX2_HIGHSPEED_BAUDRATE);
mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
Pxx2ModuleDriver.init(EXTERNAL_MODULE);
break;
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
extmoduleInvertedSerialStart(PXX2_LOWSPEED_BAUDRATE);
mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
Pxx2LowSpeedModuleDriver.init(EXTERNAL_MODULE);
break;
#endif
@@ -375,6 +374,10 @@ void enablePulsesExternalModule(uint8_t protocol)
bool setupPulsesExternalModule(uint8_t protocol)
{
int16_t* channels =
&channelOutputs[g_model.moduleData[EXTERNAL_MODULE].channelsStart];
uint8_t nChannels = 16; // TODO: MAX_CHANNELS - channelsStart
switch (protocol) {
#if defined(PXX1)
@@ -392,7 +395,7 @@ bool setupPulsesExternalModule(uint8_t protocol)
#if defined(PXX2)
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE);
Pxx2ModuleDriver.setupPulses((void*)EXTERNAL_MODULE, channels, nChannels);
return true;
#endif
@@ -415,9 +418,6 @@ bool setupPulsesExternalModule(uint8_t protocol)
#if defined(CROSSFIRE)
case PROTOCOL_CHANNELS_CROSSFIRE:
if (CrossfireModuleDriver.setupPulses) {
int16_t* channels =
&channelOutputs[g_model.moduleData[EXTERNAL_MODULE].channelsStart];
uint8_t nChannels = 16; // TODO: MAX_CHANNELS - channelsStart
CrossfireModuleDriver.setupPulses((void*)EXTERNAL_MODULE, channels,
nChannels);
}
@@ -496,17 +496,9 @@ static void enablePulsesInternalModule(uint8_t protocol)
#endif
#if defined(PXX2)
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED: {
intmoduleFifo.clear();
IntmoduleSerialDriver.init(&pxx2SerialInitParams)
resetAccessAuthenticationCount();
#if defined(INTMODULE_HEARTBEAT)
// use backup trigger (1 ms later)
init_intmodule_heartbeat();
#endif
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD);
} break;
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
Pxx2ModuleDriver.init(INTERNAL_MODULE);
break;
#endif
#if defined(INTERNAL_MODULE_MULTI)
@@ -568,6 +560,10 @@ static void enablePulsesInternalModule(uint8_t protocol)
bool setupPulsesInternalModule(uint8_t protocol)
{
int16_t* channels =
&channelOutputs[g_model.moduleData[INTERNAL_MODULE].channelsStart];
uint8_t nChannels = 16; // TODO: MAX_CHANNELS - channelsStart
switch (protocol) {
#if defined(HARDWARE_INTERNAL_MODULE) && defined(PXX1) && !defined(INTMODULE_USART)
case PROTOCOL_CHANNELS_PXX1_PULSES:
@@ -583,16 +579,8 @@ bool setupPulsesInternalModule(uint8_t protocol)
#if defined(PXX2)
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
{
bool result = intmodulePulsesData.pxx2.setupFrame(INTERNAL_MODULE);
if (moduleState[INTERNAL_MODULE].mode == MODULE_MODE_SPECTRUM_ANALYSER || moduleState[INTERNAL_MODULE].mode == MODULE_MODE_POWER_METER) {
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_TOOLS_PERIOD);
}
else {
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD);
}
return result;
}
Pxx2ModuleDriver.setupPulses((void*)INTERNAL_MODULE, channels, nChannels);
return true;
#endif
#if defined(PCBTARANIS) && defined(INTERNAL_MODULE_PPM)
@@ -652,8 +640,7 @@ void intmoduleSendNextFrame()
switch (moduleState[INTERNAL_MODULE].protocol) {
#if defined(PXX2)
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
intmoduleSendBuffer(intmodulePulsesData.pxx2.getData(),
intmodulePulsesData.pxx2.getSize());
Pxx2ModuleDriver.sendPulses((void*)INTERNAL_MODULE);
break;
#endif
+126 -16
View File
@@ -24,6 +24,8 @@
#include "pulses/pxx2.h"
#include "io/frsky_firmware_update.h"
#include "libopenui/src/libopenui_file.h"
#include "mixer_scheduler.h"
#include "heartbeat_driver.h"
#if defined(INTMODULE_USART)
#include "intmodule_serial_driver.h"
@@ -124,7 +126,7 @@ void Pxx2Pulses::addPulsesValues(uint16_t low, uint16_t high)
Pxx2Transport::addByte(high >> 4u); // High byte of channel
}
void Pxx2Pulses::addChannels(uint8_t module)
void Pxx2Pulses::addChannels(uint8_t module, int16_t* channels, uint8_t nChannels)
{
uint16_t pulseValue = 0;
uint16_t pulseValueLow = 0;
@@ -133,7 +135,7 @@ void Pxx2Pulses::addChannels(uint8_t module)
uint8_t count = sentModuleChannels(module);
for (int8_t i = 0; i < count; i++, channel++) {
int value = channelOutputs[channel] + 2*PPM_CH_CENTER(channel) - 2*PPM_CENTER;
int value = channels[i] + 2*PPM_CH_CENTER(channel) - 2*PPM_CENTER;
pulseValue = limit(1, (value * 512 / 682) + 1024, 2046);
#if defined(DEBUG_LATENCY_RF_ONLY)
if (latencyToggleSwitch)
@@ -183,7 +185,7 @@ void Pxx2Pulses::addFailsafe(uint8_t module)
}
}
void Pxx2Pulses::setupChannelsFrame(uint8_t module)
void Pxx2Pulses::setupChannelsFrame(uint8_t module, int16_t* channels, uint8_t nChannels)
{
addFrameType(PXX2_TYPE_C_MODULE, PXX2_TYPE_ID_CHANNELS);
@@ -197,7 +199,7 @@ void Pxx2Pulses::setupChannelsFrame(uint8_t module)
if (flag0 & PXX2_CHANNELS_FLAG0_FAILSAFE)
addFailsafe(module);
else
addChannels(module);
addChannels(module, channels, nChannels);
}
void Pxx2Pulses::setupTelemetryFrame(uint8_t module)
@@ -209,7 +211,7 @@ void Pxx2Pulses::setupTelemetryFrame(uint8_t module)
}
}
void Pxx2Pulses::setupHardwareInfoFrame(uint8_t module)
void Pxx2Pulses::setupHardwareInfoFrame(uint8_t module, int16_t* channels, uint8_t nChannels)
{
ModuleInformation * destination = moduleState[module].moduleInformation;
@@ -222,12 +224,12 @@ void Pxx2Pulses::setupHardwareInfoFrame(uint8_t module)
}
else {
moduleState[module].mode = MODULE_MODE_NORMAL;
setupChannelsFrame(module);
setupChannelsFrame(module, channels, nChannels);
}
}
else {
destination->timeout--;
setupChannelsFrame(module);
setupChannelsFrame(module, channels, nChannels);
}
}
@@ -250,7 +252,7 @@ void Pxx2Pulses::setupRegisterFrame(uint8_t module)
}
}
void Pxx2Pulses::setupModuleSettingsFrame(uint8_t module)
void Pxx2Pulses::setupModuleSettingsFrame(uint8_t module, int16_t* channels, uint8_t nChannels)
{
ModuleSettings * destination = moduleState[module].moduleSettings;
@@ -270,11 +272,11 @@ void Pxx2Pulses::setupModuleSettingsFrame(uint8_t module)
destination->timeout = get_tmr10ms() + 200/*next try in 2s*/;
}
else {
setupChannelsFrame(module);
setupChannelsFrame(module, channels, nChannels);
}
}
void Pxx2Pulses::setupReceiverSettingsFrame(uint8_t module)
void Pxx2Pulses::setupReceiverSettingsFrame(uint8_t module, int16_t* channels, uint8_t nChannels)
{
if (get_tmr10ms() > reusableBuffer.hardwareAndSettings.receiverSettings.timeout) {
addFrameType(PXX2_TYPE_C_MODULE, PXX2_TYPE_ID_RX_SETTINGS);
@@ -305,7 +307,7 @@ void Pxx2Pulses::setupReceiverSettingsFrame(uint8_t module)
reusableBuffer.hardwareAndSettings.receiverSettings.timeout = get_tmr10ms() + 200/*next try in 2s*/;
}
else {
setupChannelsFrame(module);
setupChannelsFrame(module, channels, nChannels);
}
}
@@ -456,7 +458,7 @@ void Pxx2Pulses::setupAuthenticationFrame(uint8_t module, uint8_t mode, const ui
endFrame();
}
bool Pxx2Pulses::setupFrame(uint8_t module)
bool Pxx2Pulses::setupFrame(uint8_t module, int16_t* channels, uint8_t nChannels)
{
if (moduleState[module].mode == MODULE_MODE_OTA_UPDATE)
return false;
@@ -470,13 +472,13 @@ bool Pxx2Pulses::setupFrame(uint8_t module)
switch (moduleState[module].mode) {
case MODULE_MODE_GET_HARDWARE_INFO:
setupHardwareInfoFrame(module);
setupHardwareInfoFrame(module, channels, nChannels);
break;
case MODULE_MODE_MODULE_SETTINGS:
setupModuleSettingsFrame(module);
setupModuleSettingsFrame(module, channels, nChannels);
break;
case MODULE_MODE_RECEIVER_SETTINGS:
setupReceiverSettingsFrame(module);
setupReceiverSettingsFrame(module, channels, nChannels);
break;
case MODULE_MODE_REGISTER:
setupRegisterFrame(module);
@@ -509,7 +511,7 @@ bool Pxx2Pulses::setupFrame(uint8_t module)
outputTelemetryBuffer.reset();
}
else {
setupChannelsFrame(module);
setupChannelsFrame(module, channels, nChannels);
}
break;
}
@@ -644,3 +646,111 @@ void Pxx2OtaUpdate::flashFirmware(const char * filename, ProgressHandler progres
resumePulses();
}
static void* pxx2Init(uint8_t module)
{
if (module == INTERNAL_MODULE) {
intmoduleFifo.clear();
IntmoduleSerialDriver.init(&pxx2SerialInitParams);
resetAccessAuthenticationCount();
#if defined(INTMODULE_HEARTBEAT)
// use backup trigger (1 ms later)
init_intmodule_heartbeat();
#endif
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD);
} else {
#if defined(EXTMODULE_USART)
extmoduleInvertedSerialStart(PXX2_HIGHSPEED_BAUDRATE);
mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
#else
return nullptr;
#endif
}
return (void*)(uint32_t)module;
}
static void pxx2DeInit(void* context)
{
uint32_t module = (uint32_t)context;
if (module == INTERNAL_MODULE) {
IntmoduleSerialDriver.deinit();
#if defined(INTMODULE_HEARTBEAT)
stop_intmodule_heartbeat();
#endif
mixerSchedulerSetPeriod(INTERNAL_MODULE, 0);
} else {
mixerSchedulerSetPeriod(EXTERNAL_MODULE, 0);
extmoduleStop();
}
}
static void* pxx2InitLowSpeed(uint8_t module)
{
if (module == EXTERNAL_MODULE) {
extmoduleInvertedSerialStart(PXX2_LOWSPEED_BAUDRATE);
mixerSchedulerSetPeriod(EXTERNAL_MODULE, PXX2_NO_HEARTBEAT_PERIOD);
return (void*)EXTERNAL_MODULE;
}
return nullptr;
}
static bool pxx2InternalSendNextFrame = true;
static void pxx2SetupPulses(void* context, int16_t* channels, uint8_t nChannels)
{
uint32_t module = (uint32_t)context;
if (module == INTERNAL_MODULE) {
pxx2InternalSendNextFrame = intmodulePulsesData.pxx2.setupFrame(
INTERNAL_MODULE, channels, nChannels);
if (moduleState[INTERNAL_MODULE].mode == MODULE_MODE_SPECTRUM_ANALYSER ||
moduleState[INTERNAL_MODULE].mode == MODULE_MODE_POWER_METER) {
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_TOOLS_PERIOD);
} else {
mixerSchedulerSetPeriod(INTERNAL_MODULE, PXX2_PERIOD);
}
} else {
extmodulePulsesData.pxx2.setupFrame(EXTERNAL_MODULE, channels, nChannels);
}
}
static void pxx2SendPulses(void* context)
{
uint32_t module = (uint32_t)context;
if (module == INTERNAL_MODULE) {
if (pxx2InternalSendNextFrame) {
IntmoduleSerialDriver.sendBuffer(intmodulePulsesData.pxx2.getData(),
intmodulePulsesData.pxx2.getSize());
}
} else {
#if defined(EXTMODULE_USART)
extmoduleSendBuffer(extmodulePulsesData.pxx2.getData(),
extmodulePulsesData.pxx2.getSize());
#endif
}
}
#include "hal/module_driver.h"
const etx_module_driver_t Pxx2ModuleDriver = {
.protocol = PROTOCOL_CHANNELS_PXX2_HIGHSPEED,
.init = pxx2Init,
.deinit = pxx2DeInit,
.setupPulses = pxx2SetupPulses,
.sendPulses = pxx2SendPulses,
};
const etx_module_driver_t Pxx2LowSpeedModuleDriver = {
.protocol = PROTOCOL_CHANNELS_PXX2_LOWSPEED,
.init = pxx2InitLowSpeed,
.deinit = pxx2DeInit,
.setupPulses = pxx2SetupPulses,
.sendPulses = pxx2SendPulses,
};
+10 -6
View File
@@ -26,7 +26,9 @@
#include "io/frsky_pxx2.h"
#include "popups.h"
#include "./pxx.h"
#include "hal/serial_driver.h"
#include "hal/module_driver.h"
#define PXX2_TYPE_C_MODULE 0x01
#define PXX2_TYPE_ID_REGISTER 0x01
@@ -466,11 +468,11 @@ class Pxx2Pulses: public Pxx2Transport {
friend class Pxx2OtaUpdate;
public:
bool setupFrame(uint8_t module);
bool setupFrame(uint8_t module, int16_t* channels, uint8_t nChannels);
void setupAuthenticationFrame(uint8_t module, uint8_t mode, const uint8_t * outputMessage);
protected:
void setupHardwareInfoFrame(uint8_t module);
void setupHardwareInfoFrame(uint8_t module, int16_t* channels, uint8_t nChannels);
void setupRegisterFrame(uint8_t module);
@@ -482,11 +484,11 @@ class Pxx2Pulses: public Pxx2Transport {
void setupShareMode(uint8_t module);
void setupModuleSettingsFrame(uint8_t module);
void setupModuleSettingsFrame(uint8_t module, int16_t* channels, uint8_t nChannels);
void setupReceiverSettingsFrame(uint8_t module);
void setupReceiverSettingsFrame(uint8_t module, int16_t* channels, uint8_t nChannels);
void setupChannelsFrame(uint8_t module);
void setupChannelsFrame(uint8_t module, int16_t* channels, uint8_t nChannels);
void setupTelemetryFrame(uint8_t module);
@@ -518,7 +520,7 @@ class Pxx2Pulses: public Pxx2Transport {
void addPulsesValues(uint16_t low, uint16_t high);
void addChannels(uint8_t module);
void addChannels(uint8_t module, int16_t* channels, uint8_t nChannels);
void addFailsafe(uint8_t module);
@@ -577,5 +579,7 @@ class Pxx2OtaUpdate {
};
extern const etx_serial_init pxx2SerialInitParams;
extern const etx_module_driver_t Pxx2ModuleDriver;
extern const etx_module_driver_t Pxx2LowSpeedModuleDriver;
#endif
@@ -0,0 +1,27 @@
/*
* Copyright (C) EdgeTX
*
* Based on code named
* opentx - https://github.com/opentx/opentx
* 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.
*/
#pragma once
void init_intmodule_heartbeat();
void check_intmodule_heartbeat();
void stop_intmodule_heartbeat();
@@ -20,6 +20,7 @@
*/
#include "opentx.h"
#include "heartbeat_driver.h"
uint8_t rotencPosition;
-3
View File
@@ -194,9 +194,6 @@ void SDRAM_Init();
#define IS_PXX1_INTERNAL_ENABLED() (true)
#endif
void init_intmodule_heartbeat();
void check_intmodule_heartbeat();
void extmoduleSerialStart();
void extmoduleInvertedSerialStart(uint32_t baudrate);
void extmoduleSendBuffer(const uint8_t * data, uint8_t size);
+1 -1
View File
@@ -345,7 +345,7 @@ void extmoduleSendNextFrame()
#if defined(PXX2) && defined(EXTMODULE_USART)
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
extmoduleSendBuffer(extmodulePulsesData.pxx2.getData(), extmodulePulsesData.pxx2.getSize());
Pxx2ModuleDriver.sendPulses((void*)EXTERNAL_MODULE);
break;
#endif
-10
View File
@@ -192,16 +192,6 @@ void extmoduleSendInvertedByte(uint8_t byte);
#define stop_trainer_module_sbus()
#endif
#if defined(INTMODULE_HEARTBEAT_GPIO)
void init_intmodule_heartbeat();
void stop_intmodule_heartbeat();
void check_intmodule_heartbeat();
#else
#define init_intmodule_heartbeat()
#define stop_intmodule_heartbeat()
#define check_intmodule_heartbeat()
#endif
void check_telemetry_exti();
// SBUS
@@ -21,6 +21,10 @@
#include "opentx.h"
#if defined(CROSSFIRE)
#include "pulses/crossfire.h"
#endif
void extmoduleStop()
{
NVIC_DisableIRQ(EXTMODULE_TIMER_DMA_STREAM_IRQn);
@@ -286,7 +290,7 @@ void extmoduleSendNextFrame()
#if defined(PXX2)
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
extmoduleSendBuffer(extmodulePulsesData.pxx2.getData(), extmodulePulsesData.pxx2.getSize());
Pxx2ModuleDriver.sendPulses((void*)EXTERNAL_MODULE);
break;
#endif
#endif
@@ -295,7 +299,8 @@ void extmoduleSendNextFrame()
case PROTOCOL_CHANNELS_AFHDS3:
{
#if defined(EXTMODULE_USART) && defined(EXTMODULE_TX_INVERT_GPIO)
extmoduleSendBuffer(extmodulePulsesData.afhds3.getData(), extmodulePulsesData.afhds3.getSize());
extmoduleSendBuffer(extmodulePulsesData.afhds3.getData(),
extmodulePulsesData.afhds3.getSize());
#else
if (EXTMODULE_TIMER_DMA_STREAM->CR & DMA_SxCR_EN)
return;
+6 -1
View File
@@ -25,6 +25,10 @@
#include "libopenui.h"
#endif
#if defined(INTMODULE_USART)
#include "intmodule_serial_driver.h"
#endif
void processGetHardwareInfoFrame(uint8_t module, const uint8_t * frame)
{
if (moduleState[module].mode != MODULE_MODE_GET_HARDWARE_INFO) {
@@ -247,7 +251,8 @@ void processAuthenticationFrame(uint8_t module, const uint8_t * frame)
Pxx2Pulses &pxx2 = intmodulePulsesData.pxx2;
pxx2.setupAuthenticationFrame(module, cryptoType,
(const uint8_t *)messageDigest);
intmoduleSendBuffer(pxx2.getData(), pxx2.getSize());
IntmoduleSerialDriver.sendBuffer(pxx2.getData(), pxx2.getSize());
// we remain in AUTHENTICATION mode to avoid a CHANNELS frame is sent at the
// end of the mixing process
authenticateFrames++;
+1
View File
@@ -20,6 +20,7 @@
*/
#include "opentx.h"
#include "heartbeat_driver.h"
int16_t ppmInput[MAX_TRAINER_CHANNELS];
uint8_t ppmInputValidityTimer;