Internal and external module buffers are now private

This commit is contained in:
Raphael Coeffic
2022-08-11 12:15:46 +02:00
committed by Raphael Coeffic
parent ab6033e4d5
commit f952c5f7c7
24 changed files with 280 additions and 216 deletions
+12 -9
View File
@@ -19,16 +19,15 @@
* GNU General Public License for more details.
*/
#include "opentx.h"
#include "afhds2.h"
#include "flysky.h"
#include "intmodule_serial_driver.h"
#include "mixer_scheduler.h"
// solely for 'intmoduleFifo'
// TODO: remove this non-sense
#include "opentx.h"
#include "pulses/pxx2.h"
#include "pulses/pulses.h"
#include "telemetry/telemetry.h"
afhds2::afhds2() {
// TODO Auto-generated constructor stub
@@ -53,20 +52,18 @@ static void* afhds2Init(uint8_t module)
// serial port setup
resetPulsesAFHDS2();
intmoduleFifo.clear();
IntmoduleSerialDriver.init(&afhds2SerialInitParams);
void* ctx = IntmoduleSerialDriver.init(&afhds2SerialInitParams);
// mixer setup
mixerSchedulerSetPeriod(INTERNAL_MODULE, AFHDS2_PERIOD);
INTERNAL_MODULE_ON();
return nullptr;
return ctx;
}
static void afhds2DeInit(void* context)
{
INTERNAL_MODULE_OFF();
intmoduleFifo.clear();
IntmoduleSerialDriver.deinit(context);
// mixer setup
@@ -96,10 +93,16 @@ static void afhds2SendPulses(void* context)
IntmoduleSerialDriver.sendBuffer(context, data, size);
}
static int afhds2GetByte(void* context, uint8_t* data)
{
return IntmoduleSerialDriver.getByte(context, data);
}
const etx_module_driver_t Afhds2InternalDriver = {
.protocol = PROTOCOL_CHANNELS_AFHDS2A,
.init = afhds2Init,
.deinit = afhds2DeInit,
.setupPulses = afhds2SetupPulses,
.sendPulses = afhds2SendPulses,
.sendPulses = afhds2SendPulses,
.getByte = afhds2GetByte,
};