fix: Internal PXX exclusive S.PORT (#3822)
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "hal/serial_driver.h"
|
||||
#include "hal/module_port.h"
|
||||
#include "dataconstants.h"
|
||||
#include "debug.h"
|
||||
|
||||
void intmoduleStop() {}
|
||||
void intmoduleFifoError() {}
|
||||
@@ -60,8 +61,32 @@ void stop_trainer_module_sbus() {}
|
||||
void init_intmodule_heartbeat() {}
|
||||
void stop_intmodule_heartbeat() {}
|
||||
|
||||
static void* init(void*, const etx_serial_init*) { return (void*)1; }
|
||||
static void deinit(void*) {}
|
||||
static bool _sport_used = false;
|
||||
|
||||
static void* init(void* ctx, const etx_serial_init*)
|
||||
{
|
||||
if (ctx == nullptr) {
|
||||
return (void*)1;
|
||||
}
|
||||
|
||||
if (ctx == (void*)&_sport_used) {
|
||||
if (_sport_used) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
_sport_used = true;
|
||||
return &_sport_used;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void deinit(void* ctx)
|
||||
{
|
||||
if (ctx != (void*)&_sport_used) return;
|
||||
_sport_used = false;
|
||||
}
|
||||
|
||||
static void sendByte(void*, uint8_t) {}
|
||||
static void sendBuffer(void*, const uint8_t*, uint32_t) {}
|
||||
static void waitForTxCompleted(void*) {}
|
||||
@@ -127,7 +152,7 @@ const etx_module_port_t _internal_ports[] = {
|
||||
.type = ETX_MOD_TYPE_SERIAL,
|
||||
.dir_flags = ETX_MOD_DIR_TX | ETX_MOD_DIR_RX,
|
||||
.drv = { .serial = &_fakeSerialDriver },
|
||||
.hw_def = nullptr,
|
||||
.hw_def = &_sport_used,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
@@ -170,7 +195,7 @@ const etx_module_port_t _external_ports[] = {
|
||||
.drv = { .timer = &_fakeTimerDriver },
|
||||
.hw_def = nullptr,
|
||||
},
|
||||
// TX inverted DMA pulse train on S.PORT
|
||||
// TX inverted DMA pulse train on PPM
|
||||
{
|
||||
.port = ETX_MOD_PORT_SOFT_INV,
|
||||
.type = ETX_MOD_TYPE_SERIAL,
|
||||
@@ -184,7 +209,7 @@ const etx_module_port_t _external_ports[] = {
|
||||
.type = ETX_MOD_TYPE_SERIAL,
|
||||
.dir_flags = ETX_MOD_DIR_TX | ETX_MOD_DIR_RX,
|
||||
.drv = { .serial = &_fakeSerialDriver },
|
||||
.hw_def = nullptr,
|
||||
.hw_def = &_sport_used,
|
||||
},
|
||||
#if defined(TELEMETRY_TIMER)
|
||||
// RX soft-serial sampled bit-by-bit via timer IRQ on S.PORT
|
||||
|
||||
Reference in New Issue
Block a user