feat(ACCESS): Configure AUX serial port as "External module" (#2562)

* Enable RX DMA on external module USART

* feat(ACCESS): configure AUX serial port as "External module" (#2562)

This allows configuring the external access mod on runtime rather than by compilation option.

* fix: fetch external module driver
This commit is contained in:
Raphael Coeffic
2022-12-14 18:41:32 +10:00
committed by GitHub
parent efe2ddd2b1
commit 06c359f096
22 changed files with 323 additions and 128 deletions
+12 -4
View File
@@ -295,7 +295,10 @@ static const etx_serial_init pxx1ExtSerialInit = {
static void* pxx1InitExternal(uint8_t module)
{
void* uart_ctx = ExtmoduleSerialDriver.init(&pxx1ExtSerialInit);
auto drv = extmoduleGetSerialPort();
if (!drv) return nullptr;
void* uart_ctx = drv->init(&pxx1ExtSerialInit);
mixerSchedulerSetPeriod(EXTERNAL_MODULE, EXTMODULE_PXX1_SERIAL_PERIOD);
EXTERNAL_MODULE_ON();
@@ -307,7 +310,9 @@ static void pxx1DeInitExternal(void* context)
{
EXTERNAL_MODULE_OFF();
mixerSchedulerSetPeriod(EXTERNAL_MODULE, 0);
ExtmoduleSerialDriver.deinit(context);
auto drv = extmoduleGetSerialPort();
if (drv) drv->deinit(context);
}
static void pxx1SetupPulsesExternal(void* context, int16_t* channels, uint8_t nChannels)
@@ -323,8 +328,11 @@ static void pxx1SetupPulsesExternal(void* context, int16_t* channels, uint8_t nC
static void pxx1SendPulsesExternal(void* context)
{
ExtmoduleSerialDriver.sendBuffer(context, extmodulePulsesData.pxx_uart.getData(),
extmodulePulsesData.pxx_uart.getSize());
auto drv = extmoduleGetSerialPort();
if (!drv) return;
drv->sendBuffer(context, extmodulePulsesData.pxx_uart.getData(),
extmodulePulsesData.pxx_uart.getSize());
}
const etx_module_driver_t Pxx1ExternalSerialDriver = {