Use USB VCP as a normal serial driver as well
This commit is contained in:
+92
-26
@@ -19,8 +19,12 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <stream_buffer.h>
|
||||
|
||||
#include "opentx.h"
|
||||
#include "diskio.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <malloc.h>
|
||||
#include <new>
|
||||
@@ -55,6 +59,13 @@ void (*cliReceiveCallBack)(uint8_t* buf, uint32_t len) = nullptr;
|
||||
static void (*cliSendCb)(void*, uint8_t) = nullptr;
|
||||
static void* cliSendCtx = nullptr;
|
||||
|
||||
static const etx_serial_driver_t* cliSerialDriver = nullptr;
|
||||
static void* cliSerialDriverCtx = nullptr;
|
||||
|
||||
static uint8_t cliTracesEnabled = false;
|
||||
static void (*cliTracesOldCb)(void*, uint8_t);
|
||||
static void* cliTracesOldCbCtx;
|
||||
|
||||
void cliSetSendCb(void* ctx, void (*cb)(void*, uint8_t))
|
||||
{
|
||||
cliSendCb = nullptr;
|
||||
@@ -62,6 +73,57 @@ void cliSetSendCb(void* ctx, void (*cb)(void*, uint8_t))
|
||||
cliSendCb = cb;
|
||||
}
|
||||
|
||||
// Called from receive ISR (either USB or UART)
|
||||
static void cliReceiveData(uint8_t* buf, uint32_t len)
|
||||
{
|
||||
if (cliReceiveCallBack)
|
||||
cliReceiveCallBack(buf, len);
|
||||
}
|
||||
|
||||
// Assumes it is called from ISR...
|
||||
static void cliDefaultRx(uint8_t *buf, uint32_t len)
|
||||
{
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
xStreamBufferSendFromISR(cliRxBuffer, buf, len, &xHigherPriorityTaskWoken);
|
||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
static void cliEnableDbg()
|
||||
{
|
||||
if (dbgSerialGetSendCb() != cliSendCb) {
|
||||
cliTracesOldCb = dbgSerialGetSendCb();
|
||||
cliTracesOldCbCtx = dbgSerialGetSendCbCtx();
|
||||
dbgSerialSetSendCb(nullptr, nullptr);
|
||||
dbgSerialSetSendCb(cliSendCtx, cliSendCb);
|
||||
}
|
||||
}
|
||||
|
||||
static void cliDisableDbg()
|
||||
{
|
||||
if (dbgSerialGetSendCb() == cliSendCb) {
|
||||
dbgSerialSetSendCb(nullptr, nullptr);
|
||||
dbgSerialSetSendCb(cliTracesOldCbCtx, cliTracesOldCb);
|
||||
}
|
||||
}
|
||||
|
||||
void cliSetSerialDriver(void* ctx, const etx_serial_driver_t* drv)
|
||||
{
|
||||
cliSerialDriver = nullptr;
|
||||
cliSerialDriverCtx = ctx;
|
||||
cliSerialDriver = drv;
|
||||
|
||||
if (drv) {
|
||||
if (drv->setReceiveCb) drv->setReceiveCb(ctx, cliReceiveData);
|
||||
cliSetSendCb(ctx, drv->sendByte);
|
||||
if (cliTracesEnabled) {
|
||||
cliEnableDbg();
|
||||
}
|
||||
} else {
|
||||
cliSetSendCb(nullptr, nullptr);
|
||||
cliDisableDbg();
|
||||
}
|
||||
}
|
||||
|
||||
static void cliSerialPrintf(const char * format, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
@@ -95,7 +157,28 @@ static void cliSerialCrlf()
|
||||
cliSerialPutc('\n');
|
||||
}
|
||||
|
||||
uint8_t cliTracesEnabled = true;
|
||||
static uint32_t cliGetBaudRate()
|
||||
{
|
||||
auto drv = cliSerialDriver;
|
||||
auto ctx = cliSerialDriverCtx;
|
||||
|
||||
if (drv && drv->getBaudrate) {
|
||||
return drv->getBaudrate(ctx);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cliSetBaudRateCb(void (*cb)(uint32_t))
|
||||
{
|
||||
auto drv = cliSerialDriver;
|
||||
auto ctx = cliSerialDriverCtx;
|
||||
|
||||
if (drv && drv->setBaudrateCb) {
|
||||
return drv->setBaudrateCb(ctx, cb);
|
||||
}
|
||||
}
|
||||
|
||||
char cliLastLine[CLI_COMMAND_MAX_LEN+1];
|
||||
|
||||
typedef int (* CliFunction) (const char ** args);
|
||||
@@ -753,10 +836,12 @@ int cliTest(const char ** argv)
|
||||
int cliTrace(const char ** argv)
|
||||
{
|
||||
if (!strcmp(argv[1], "on")) {
|
||||
cliEnableDbg();
|
||||
cliTracesEnabled = true;
|
||||
}
|
||||
else if (!strcmp(argv[1], "off")) {
|
||||
cliTracesEnabled = false;
|
||||
cliDisableDbg();
|
||||
}
|
||||
else {
|
||||
cliSerialPrint("%s: Invalid argument \"%s\"", argv[0], argv[1]);
|
||||
@@ -1012,12 +1097,12 @@ int cliSerialPassthrough(const char **argv)
|
||||
int baudrate = 0;
|
||||
err = toInt(argv, 3, &baudrate);
|
||||
if (err <= 0) {
|
||||
// use current USB CDC baudrate
|
||||
baudrate = usbSerialBaudRate();
|
||||
// use current baudrate
|
||||
baudrate = cliGetBaudRate();
|
||||
if (!baudrate) {
|
||||
// default to 115200
|
||||
baudrate = 115200;
|
||||
cliSerialPrint("%s: USB baudrate is 0, default to 115200", argv[0]);
|
||||
cliSerialPrint("%s: baudrate is 0, default to 115200", argv[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1053,7 +1138,7 @@ int cliSerialPassthrough(const char **argv)
|
||||
cliReceiveCallBack = spInternalModuleTx;
|
||||
|
||||
// setup CDC baudrate callback
|
||||
usbSerialSetBaudRateCb(spInternalModuleSetBaudRate);
|
||||
cliSetBaudRateCb(spInternalModuleSetBaudRate);
|
||||
|
||||
// loop until cable disconnected
|
||||
while (cdcConnected) {
|
||||
@@ -1067,7 +1152,7 @@ int cliSerialPassthrough(const char **argv)
|
||||
timeout--;
|
||||
}
|
||||
|
||||
usbSerialPutc(nullptr, data);
|
||||
cliSerialPutc(data);
|
||||
}
|
||||
|
||||
// keep us up & running
|
||||
@@ -1075,7 +1160,7 @@ int cliSerialPassthrough(const char **argv)
|
||||
}
|
||||
|
||||
// restore callsbacks
|
||||
usbSerialSetBaudRateCb(nullptr);
|
||||
cliSetBaudRateCb(nullptr);
|
||||
cliReceiveCallBack = backupCB;
|
||||
|
||||
// and stop module
|
||||
@@ -1643,20 +1728,6 @@ void cliTask(void * pdata)
|
||||
}
|
||||
}
|
||||
|
||||
// Called from receive ISR (either USB or UART)
|
||||
void cliReceiveData(uint8_t* buf, uint32_t len)
|
||||
{
|
||||
if (cliReceiveCallBack)
|
||||
cliReceiveCallBack(buf, len);
|
||||
}
|
||||
|
||||
static void cliDefaultRx(uint8_t *buf, uint32_t len)
|
||||
{
|
||||
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||
xStreamBufferSendFromISR(cliRxBuffer, buf, len, &xHigherPriorityTaskWoken);
|
||||
portYIELD_FROM_ISR(xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
void cliStart()
|
||||
{
|
||||
// Init stream buffer
|
||||
@@ -1668,11 +1739,6 @@ void cliStart()
|
||||
// Setup consumer callback
|
||||
cliReceiveCallBack = cliDefaultRx;
|
||||
|
||||
// Setup USB callbacks
|
||||
usbSerialSetReceiveDataCb(cliReceiveData);
|
||||
// usbSerialSetBaudRateCb(...);
|
||||
// usbSerialSetCtrlLineStateCb(...);
|
||||
|
||||
RTOS_CREATE_TASK(cliTaskId, cliTask, "CLI", cliStack, CLI_STACK_SIZE,
|
||||
CLI_TASK_PRIO);
|
||||
}
|
||||
|
||||
+3
-11
@@ -22,20 +22,12 @@
|
||||
#ifndef _CLI_H_
|
||||
#define _CLI_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <FreeRTOS.h>
|
||||
#include <stream_buffer.h>
|
||||
|
||||
#include "cli_traces.h"
|
||||
#include "hal/serial_driver.h"
|
||||
|
||||
// CLI task function
|
||||
void cliStart();
|
||||
|
||||
// Called from receive ISR (either USB or UART)
|
||||
void cliReceiveData(uint8_t* buf, uint32_t len);
|
||||
|
||||
// Set callbacks for sending data back to serial port
|
||||
void cliSetSendCb(void* ctx, void (*cb)(void*, uint8_t));
|
||||
// Connect serial driver to CLI
|
||||
void cliSetSerialDriver(void* ctx, const etx_serial_driver_t* drv);
|
||||
|
||||
#endif // _CLI_H_
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Allows for switchable debug prints via CLI
|
||||
extern uint8_t cliTracesEnabled;
|
||||
@@ -203,6 +203,15 @@ enum TrainerMode {
|
||||
};
|
||||
#endif
|
||||
|
||||
enum SerialPort {
|
||||
SP_AUX1=0,
|
||||
SP_AUX2,
|
||||
SP_VCP,
|
||||
MAX_SERIAL_PORTS SKIP,
|
||||
};
|
||||
|
||||
#define MAX_AUX_SERIAL (SP_AUX2 + 1)
|
||||
|
||||
#define TRAINER_MODE_MIN() TRAINER_MODE_MASTER_TRAINER_JACK
|
||||
|
||||
#if !defined(HARDWARE_EXTERNAL_MODULE)
|
||||
@@ -245,6 +254,7 @@ enum UartModes {
|
||||
UART_MODE_TELEMETRY,
|
||||
UART_MODE_SBUS_TRAINER,
|
||||
UART_MODE_LUA,
|
||||
UART_MODE_CLI,
|
||||
UART_MODE_COUNT SKIP,
|
||||
UART_MODE_MAX SKIP = UART_MODE_COUNT-1
|
||||
};
|
||||
|
||||
@@ -40,9 +40,6 @@ extern volatile uint32_t g_tmr10ms;
|
||||
#elif defined(SEMIHOSTING)
|
||||
#include <stdio.h>
|
||||
#define debugPrintf(...) printf(__VA_ARGS__)
|
||||
#elif defined(DEBUG) && defined(CLI)
|
||||
#include "cli_traces.h"
|
||||
#define debugPrintf(...) do { if (cliTracesEnabled) dbgSerialPrintf(__VA_ARGS__); } while(0)
|
||||
#elif defined(DEBUG)
|
||||
#define debugPrintf(...) do { dbgSerialPrintf(__VA_ARGS__); } while(0)
|
||||
#else
|
||||
|
||||
@@ -380,7 +380,7 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
UART_MODE_MAX, GET_DEFAULT(g_eeGeneral.auxSerialMode),
|
||||
[](int value) {
|
||||
g_eeGeneral.auxSerialMode = value;
|
||||
serialInit(0, value);
|
||||
serialInit(SP_AUX1, value);
|
||||
SET_DIRTY();
|
||||
});
|
||||
aux->setAvailableHandler(isAuxModeAvailable);
|
||||
@@ -394,7 +394,7 @@ void RadioHardwarePage::build(FormWindow * window)
|
||||
UART_MODE_MAX, GET_DEFAULT(g_eeGeneral.aux2SerialMode),
|
||||
[](int value) {
|
||||
g_eeGeneral.aux2SerialMode = value;
|
||||
serialInit(1, value);
|
||||
serialInit(SP_AUX2, value);
|
||||
SET_DIRTY();
|
||||
});
|
||||
aux2->setAvailableHandler(isAux2ModeAvailable);
|
||||
|
||||
@@ -600,7 +600,7 @@ void menuRadioHardware(event_t event)
|
||||
case ITEM_RADIO_HARDWARE_AUX_SERIAL_MODE:
|
||||
g_eeGeneral.auxSerialMode = editChoice(HW_SETTINGS_COLUMN2, y, STR_AUX_SERIAL_MODE, STR_AUX_SERIAL_MODES, g_eeGeneral.auxSerialMode, 0, UART_MODE_MAX, attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
serialInit(0, g_eeGeneral.auxSerialMode);
|
||||
serialInit(SP_AUX1, g_eeGeneral.auxSerialMode);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -45,14 +45,14 @@ typedef struct {
|
||||
uint8_t parity; // = ETX_Parity_None;
|
||||
uint8_t stop_bits; // = ETX_StopBits_One;
|
||||
uint8_t word_length; // = ETX_WordLength_8;
|
||||
bool rx_enable; // = false;
|
||||
uint8_t rx_enable; // = false;
|
||||
|
||||
void (*on_receive)(uint8_t data); // = nullptr;
|
||||
void (*on_error)(); // = nullptr;
|
||||
} etx_serial_init;
|
||||
|
||||
struct etx_serial_callbacks_t {
|
||||
bool (*on_send)(uint8_t* data);
|
||||
uint8_t (*on_send)(uint8_t* data);
|
||||
void (*on_receive)(uint8_t data);
|
||||
void (*on_error)();
|
||||
};
|
||||
@@ -76,9 +76,12 @@ typedef struct {
|
||||
|
||||
// Fetch byte from internal buffer
|
||||
int (*getByte)(void* ctx, uint8_t* data);
|
||||
|
||||
// Get current baudrate
|
||||
uint32_t (*getBaudrate)(void*);
|
||||
|
||||
// Callbacks
|
||||
void (*setReceiveCb)(void* ctx, void (*on_receive)(uint8_t data));
|
||||
void (*setOnErrorCb)(void* ctx, void (*on_error)());
|
||||
void (*setReceiveCb)(void* ctx, void (*on_receive)(uint8_t*, uint32_t));
|
||||
void (*setBaudrateCb)(void* ctx, void (*on_set_baudrate)(uint32_t));
|
||||
|
||||
} etx_serial_driver_t;
|
||||
|
||||
+5
-6
@@ -162,14 +162,11 @@ void handleUsbConnection()
|
||||
// TODO: query USB serial mode
|
||||
// -> for now, only CLI / DEBUG / LUA
|
||||
#if defined(CLI)
|
||||
cliSetSendCb(nullptr, usbSerialPutc);
|
||||
usbSerialSetReceiveDataCb(cliReceiveData);
|
||||
serialInit(SP_VCP, UART_MODE_CLI);
|
||||
#elif defined(DEBUG)
|
||||
dbgSerialSetSendCb(nullptr, usbSerialPutc);
|
||||
usbSerialSetReceiveDataCb(nullptr);
|
||||
serialInit(SP_VCP, UART_MODE_DEBUG);
|
||||
#elif defined(LUA)
|
||||
luaSetSendCb(nullptr, usbSerialPutc);
|
||||
usbSerialSetReceiveDataCb(luaReceiveData);
|
||||
serialInit(SP_VCP, UART_MODE_LUA);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -185,6 +182,8 @@ void handleUsbConnection()
|
||||
if (getSelectedUsbMode() == USB_MASS_STORAGE_MODE) {
|
||||
opentxResume();
|
||||
pushEvent(EVT_ENTRY);
|
||||
} else if (getSelectedUsbMode() == USB_SERIAL_MODE) {
|
||||
serialStop(SP_VCP);
|
||||
}
|
||||
TRACE("reset selected USB mode");
|
||||
setSelectedUsbMode(USB_UNSELECTED_MODE);
|
||||
|
||||
+15
-8
@@ -96,12 +96,16 @@ void processSbusFrame(uint8_t * sbus, int16_t * pulses, uint32_t size)
|
||||
|
||||
void processSbusInput()
|
||||
{
|
||||
uint8_t rxchar;
|
||||
uint32_t active = 0;
|
||||
|
||||
// TODO: place this outside of the function
|
||||
static uint8_t SbusIndex = 0;
|
||||
static uint16_t SbusTimer;
|
||||
static uint8_t SbusFrame[SBUS_FRAME_SIZE];
|
||||
|
||||
uint32_t active = 0;
|
||||
|
||||
// Drain input first (if existing)
|
||||
uint8_t rxchar;
|
||||
auto _getByte = sbusGetByte;
|
||||
while (_getByte && (_getByte(&rxchar) > 0)) {
|
||||
active = 1;
|
||||
@@ -110,15 +114,18 @@ void processSbusInput()
|
||||
}
|
||||
SbusFrame[SbusIndex++] = rxchar;
|
||||
}
|
||||
|
||||
// Data has been received
|
||||
if (active) {
|
||||
SbusTimer = getTmr2MHz();
|
||||
return;
|
||||
} else {
|
||||
if (SbusIndex) {
|
||||
if ((uint16_t)(getTmr2MHz() - SbusTimer) > SBUS_FRAME_GAP_DELAY) {
|
||||
processSbusFrame(SbusFrame, ppmInput, SbusIndex);
|
||||
SbusIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if end-of-frame is detected
|
||||
if (SbusIndex) {
|
||||
if ((uint16_t)(getTmr2MHz() - SbusTimer) > SBUS_FRAME_GAP_DELAY) {
|
||||
processSbusFrame(SbusFrame, ppmInput, SbusIndex);
|
||||
SbusIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+79
-26
@@ -25,14 +25,28 @@
|
||||
#include <stdio.h>
|
||||
#include "aux_serial_driver.h"
|
||||
#include "hal/serial_port.h"
|
||||
//#include "cli.h"
|
||||
|
||||
#define PRINTF_BUFFER_SIZE 128
|
||||
|
||||
static void (*dbg_serial_putc)(void*, uint8_t) = nullptr;
|
||||
static void* dbg_serial_ctx = nullptr;
|
||||
|
||||
void (*dbgSerialGetSendCb())(void*, uint8_t)
|
||||
{
|
||||
return dbg_serial_putc;
|
||||
}
|
||||
|
||||
void* dbgSerialGetSendCbCtx()
|
||||
{
|
||||
return dbg_serial_ctx;
|
||||
}
|
||||
|
||||
void dbgSerialSetSendCb(void* ctx, void (*cb)(void*, uint8_t))
|
||||
{
|
||||
// Avoid overwriting debug port config
|
||||
if (cb && dbg_serial_putc) return;
|
||||
|
||||
dbg_serial_putc = nullptr;
|
||||
dbg_serial_ctx = ctx;
|
||||
dbg_serial_putc = cb;
|
||||
@@ -70,7 +84,7 @@ extern "C" void dbgSerialCrlf()
|
||||
dbgSerialPutc('\n');
|
||||
}
|
||||
|
||||
static int getAuxSerialMode(uint8_t port_nr)
|
||||
static int getSerialPortMode(uint8_t port_nr)
|
||||
{
|
||||
#if !defined(BOOT)
|
||||
if (port_nr == 0) {
|
||||
@@ -88,19 +102,19 @@ static int getAuxSerialMode(uint8_t port_nr)
|
||||
return UART_MODE_NONE;
|
||||
}
|
||||
|
||||
struct AuxSerialPortState
|
||||
struct SerialPortState
|
||||
{
|
||||
uint8_t mode;
|
||||
const etx_serial_port_t* port;
|
||||
void* usart_ctx;
|
||||
};
|
||||
|
||||
static AuxSerialPortState auxSerialPortStates[MAX_AUX_SERIAL];
|
||||
static SerialPortState serialPortStates[MAX_SERIAL_PORTS];
|
||||
|
||||
static AuxSerialPortState* auxGetPortState(int port_nr)
|
||||
static SerialPortState* getSerialPortState(int port_nr)
|
||||
{
|
||||
if (port_nr >= MAX_AUX_SERIAL) return nullptr;
|
||||
return &auxSerialPortStates[port_nr];
|
||||
if (port_nr >= MAX_SERIAL_PORTS) return nullptr;
|
||||
return &serialPortStates[port_nr];
|
||||
}
|
||||
|
||||
// TODO: replace serialSetupCallBacks & serialSetupPort
|
||||
@@ -110,18 +124,28 @@ static void serialSetCallBacks(int mode, void* ctx, const etx_serial_port_t* por
|
||||
{
|
||||
void (*sendByte)(void*, uint8_t) = nullptr;
|
||||
int (*getByte)(void*, uint8_t*) = nullptr;
|
||||
void (*setRxCb)(void*, void (*)(uint8_t*, uint32_t)) = nullptr;
|
||||
|
||||
const etx_serial_driver_t* drv = nullptr;
|
||||
if (port) {
|
||||
sendByte = port->uart->sendByte;
|
||||
getByte = port->uart->getByte;
|
||||
}
|
||||
|
||||
drv = port->uart;
|
||||
if (drv) {
|
||||
sendByte = drv->sendByte;
|
||||
getByte = drv->getByte;
|
||||
setRxCb = drv->setReceiveCb;
|
||||
}
|
||||
}
|
||||
|
||||
// prevent compiler warnings
|
||||
(void)sendByte;
|
||||
(void)getByte;
|
||||
(void)setRxCb;
|
||||
|
||||
switch(mode) {
|
||||
#if defined(DEBUG)
|
||||
case UART_MODE_DEBUG:
|
||||
// TODO: should we handle 2 outputs?
|
||||
dbgSerialSetSendCb(ctx, sendByte);
|
||||
(void)getByte;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -129,23 +153,37 @@ static void serialSetCallBacks(int mode, void* ctx, const etx_serial_port_t* por
|
||||
#if defined(LUA)
|
||||
case UART_MODE_LUA:
|
||||
luaSetSendCb(ctx, sendByte);
|
||||
luaSetGetSerialByte(ctx, getByte);
|
||||
if (getByte) {
|
||||
luaSetGetSerialByte(ctx, getByte);
|
||||
} else if (setRxCb) {
|
||||
setRxCb(ctx, luaReceiveData);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(SBUS_TRAINER)
|
||||
case UART_MODE_SBUS_TRAINER:
|
||||
sbusSetAuxGetByte(ctx, getByte);
|
||||
// TODO: setRxCb (see MODE_LUA)
|
||||
break;
|
||||
#endif
|
||||
|
||||
case UART_MODE_TELEMETRY:
|
||||
telemetrySetGetByte(ctx, getByte);
|
||||
// TODO: setRxCb (see MODE_LUA)
|
||||
// de we really need telemetry
|
||||
// input over USB VCP?
|
||||
break;
|
||||
|
||||
case UART_MODE_TELEMETRY_MIRROR:
|
||||
telemetrySetMirrorCb(ctx, sendByte);
|
||||
break;
|
||||
|
||||
#if defined(CLI)
|
||||
case UART_MODE_CLI:
|
||||
cliSetSerialDriver(ctx, drv);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -203,14 +241,20 @@ static void serialSetupPort(int mode, etx_serial_init& params, bool& power_requi
|
||||
|
||||
void serialInit(int port_nr, int mode)
|
||||
{
|
||||
if (port_nr >= MAX_AUX_SERIAL) return;
|
||||
|
||||
auto state = auxGetPortState(port_nr);
|
||||
auto state = getSerialPortState(port_nr);
|
||||
if (!state) return;
|
||||
|
||||
auto port = auxSerialGetPort(port_nr);
|
||||
const etx_serial_port_t* port = nullptr;
|
||||
if (port_nr != SP_VCP) {
|
||||
port = auxSerialGetPort(port_nr);
|
||||
}
|
||||
#if defined(USB_SERIAL)
|
||||
else {
|
||||
port = &UsbSerialPort;
|
||||
}
|
||||
#endif
|
||||
if (!port) return;
|
||||
|
||||
|
||||
if (state->port) {
|
||||
auto drv = state->port->uart;
|
||||
if (drv->deinit) {
|
||||
@@ -218,9 +262,9 @@ void serialInit(int port_nr, int mode)
|
||||
}
|
||||
if (state->mode != 0) {
|
||||
// Clear callbacks
|
||||
serialSetCallBacks(mode, nullptr, nullptr);
|
||||
serialSetCallBacks(state->mode, nullptr, nullptr);
|
||||
}
|
||||
memset(state, 0, sizeof(AuxSerialPortState));
|
||||
memset(state, 0, sizeof(SerialPortState));
|
||||
}
|
||||
|
||||
etx_serial_init params = {
|
||||
@@ -253,17 +297,17 @@ void serialInit(int port_nr, int mode)
|
||||
|
||||
void initSerialPorts()
|
||||
{
|
||||
memset(auxSerialPortStates, 0, sizeof(auxSerialPortStates));
|
||||
memset(serialPortStates, 0, sizeof(serialPortStates));
|
||||
|
||||
for (int port_nr = 0; port_nr < MAX_AUX_SERIAL; port_nr++) {
|
||||
auto mode = getAuxSerialMode(port_nr);
|
||||
auto mode = getSerialPortMode(port_nr);
|
||||
serialInit(port_nr, mode);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t serialGetMode(int port_nr)
|
||||
{
|
||||
auto state = auxGetPortState(port_nr);
|
||||
auto state = getSerialPortState(port_nr);
|
||||
if (!state) return UART_MODE_NONE;
|
||||
return state->mode;
|
||||
}
|
||||
@@ -279,21 +323,30 @@ uint8_t serialTracesEnabled(int port_nr)
|
||||
|
||||
void serialStop(int port_nr)
|
||||
{
|
||||
auto state = auxGetPortState(port_nr);
|
||||
auto state = getSerialPortState(port_nr);
|
||||
if (!state) return;
|
||||
|
||||
if (state->port) {
|
||||
auto drv = state->port->uart;
|
||||
auto port = state->port;
|
||||
auto drv = port->uart;
|
||||
if (drv && drv->deinit) {
|
||||
drv->deinit(state->usart_ctx);
|
||||
}
|
||||
memset(state, 0, sizeof(AuxSerialPortState));
|
||||
if (state->mode != 0) {
|
||||
// Clear callbacks
|
||||
serialSetCallBacks(state->mode, nullptr, nullptr);
|
||||
}
|
||||
if (port->set_pwr) {
|
||||
// Power OFF
|
||||
port->set_pwr(0);
|
||||
}
|
||||
memset(state, 0, sizeof(SerialPortState));
|
||||
}
|
||||
}
|
||||
|
||||
void serialPutc(int port_nr, uint8_t c)
|
||||
{
|
||||
auto state = auxGetPortState(port_nr);
|
||||
auto state = getSerialPortState(port_nr);
|
||||
if (!state) return;
|
||||
|
||||
if (state->port) {
|
||||
|
||||
+4
-18
@@ -24,8 +24,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAX_AUX_SERIAL 2
|
||||
|
||||
void initSerialPorts();
|
||||
uint8_t serialGetMode(int port_nr);
|
||||
uint8_t serialTracesEnabled(int port_nr);
|
||||
@@ -33,22 +31,6 @@ void serialInit(int port_nr, int mode);
|
||||
void serialStop(int port_nr);
|
||||
void serialPutc(int port_nr, uint8_t c);
|
||||
|
||||
#if defined(AUX_SERIAL)
|
||||
#define auxSerialSbusInit() serialInit(0, UART_MODE_SBUS_TRAINER)
|
||||
#define auxSerialGetMode() serialGetMode(0)
|
||||
#define auxSerialTracesEnabled() serialTracesEnabled(0)
|
||||
#define auxSerialStop() serialStop(0)
|
||||
#define auxSerialPutc(c) serialPutc(0, (c))
|
||||
#endif
|
||||
|
||||
#if defined(AUX2_SERIAL)
|
||||
#define aux2SerialSbusInit() serialInit(1, UART_MODE_SBUS_TRAINER)
|
||||
#define aux2SerialGetMode() serialGetMode(1)
|
||||
#define aux2SerialTracesEnabled() serialTracesEnabled(1)
|
||||
#define aux2SerialStop() serialStop(1)
|
||||
#define aux2SerialPutc(c) serialPutc(1, (c))
|
||||
#endif
|
||||
|
||||
//
|
||||
// Functions used by debug.h
|
||||
//
|
||||
@@ -69,5 +51,9 @@ void dbgSerialCrlf();
|
||||
// Debug serial callback
|
||||
void dbgSerialSetSendCb(void* ctx, void (*cb)(void*, uint8_t));
|
||||
|
||||
// Query debug callback
|
||||
void (*dbgSerialGetSendCb())(void*, uint8_t);
|
||||
void* dbgSerialGetSendCbCtx();
|
||||
|
||||
#endif // _SERIAL_H_
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ AuxSerialState auxSerialState = {
|
||||
};
|
||||
|
||||
// TODO: grab context to get buffer
|
||||
static bool auxSerialOnSend(uint8_t* data)
|
||||
static uint8_t auxSerialOnSend(uint8_t* data)
|
||||
{
|
||||
return auxSerialTxFifo.pop(*data);
|
||||
}
|
||||
@@ -153,14 +153,15 @@ static void* auxSerialInit(const etx_serial_init* params)
|
||||
}
|
||||
|
||||
const etx_serial_driver_t AuxSerialDriver = {
|
||||
.init = auxSerialInit,
|
||||
.deinit = aux_serial_deinit,
|
||||
.sendByte = aux_serial_putc,
|
||||
.sendBuffer = aux_serial_send_buffer,
|
||||
.waitForTxCompleted = aux_wait_tx_completed,
|
||||
.getByte = aux_get_byte,
|
||||
.setReceiveCb = nullptr,
|
||||
.setOnErrorCb = nullptr,
|
||||
.init = auxSerialInit,
|
||||
.deinit = aux_serial_deinit,
|
||||
.sendByte = aux_serial_putc,
|
||||
.sendBuffer = aux_serial_send_buffer,
|
||||
.waitForTxCompleted = aux_wait_tx_completed,
|
||||
.getByte = aux_get_byte,
|
||||
.getBaudrate = nullptr,
|
||||
.setReceiveCb = nullptr,
|
||||
.setBaudrateCb = nullptr,
|
||||
};
|
||||
|
||||
extern "C" void AUX_SERIAL_USART_IRQHandler(void)
|
||||
@@ -206,7 +207,7 @@ AuxSerialState aux2SerialState = {
|
||||
.usart = &aux2USART,
|
||||
};
|
||||
|
||||
static bool aux2SerialOnSend(uint8_t* data)
|
||||
static uint8_t aux2SerialOnSend(uint8_t* data)
|
||||
{
|
||||
return aux2SerialTxFifo.pop(*data);
|
||||
}
|
||||
@@ -229,14 +230,15 @@ extern "C" void AUX2_SERIAL_USART_IRQHandler(void)
|
||||
}
|
||||
|
||||
const etx_serial_driver_t Aux2SerialDriver = {
|
||||
.init = aux2SerialInit,
|
||||
.deinit = aux_serial_deinit,
|
||||
.sendByte = aux_serial_putc,
|
||||
.sendBuffer = aux_serial_send_buffer,
|
||||
.waitForTxCompleted = aux_wait_tx_completed,
|
||||
.getByte = aux_get_byte,
|
||||
.setReceiveCb = nullptr,
|
||||
.setOnErrorCb = nullptr,
|
||||
.init = aux2SerialInit,
|
||||
.deinit = aux_serial_deinit,
|
||||
.sendByte = aux_serial_putc,
|
||||
.sendBuffer = aux_serial_send_buffer,
|
||||
.waitForTxCompleted = aux_wait_tx_completed,
|
||||
.getByte = aux_get_byte,
|
||||
.getBaudrate = nullptr,
|
||||
.setReceiveCb = nullptr,
|
||||
.setBaudrateCb = nullptr,
|
||||
};
|
||||
|
||||
#endif // AUX2_SERIAL
|
||||
|
||||
@@ -24,12 +24,10 @@
|
||||
#include "hal/serial_driver.h"
|
||||
|
||||
#if defined(AUX_SERIAL)
|
||||
|
||||
extern const etx_serial_driver_t AuxSerialDriver;
|
||||
#endif
|
||||
|
||||
#if defined(AUX2_SERIAL)
|
||||
|
||||
extern const etx_serial_driver_t Aux2SerialDriver;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -80,26 +80,8 @@
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && !defined(SIMU)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "usb_driver.h"
|
||||
|
||||
#if !defined(SIMU)
|
||||
#include "usbd_cdc_core.h"
|
||||
#include "usbd_msc_core.h"
|
||||
#include "usbd_hid_core.h"
|
||||
#include "usbd_usr.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usb_conf.h"
|
||||
#include "usbd_conf.h"
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && !defined(SIMU)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
#include "../simu/simpgmspace.h"
|
||||
#endif
|
||||
|
||||
@@ -20,8 +20,9 @@
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "definitions.h"
|
||||
|
||||
void getCPUUniqueID(char * s);
|
||||
EXTERN_C(void getCPUUniqueID(char * s));
|
||||
|
||||
#define LEN_CPU_UID (3*8+2)
|
||||
|
||||
@@ -29,4 +30,4 @@ void getCPUUniqueID(char * s);
|
||||
extern const uint32_t cpu_uid[3];
|
||||
#else
|
||||
extern const uint32_t * cpu_uid;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -139,6 +139,10 @@ const etx_serial_driver_t ExtmoduleSerialDriver = {
|
||||
.sendByte = extmoduleSendByte,
|
||||
.sendBuffer = extmoduleSendBuffer,
|
||||
.waitForTxCompleted = extmoduleWaitForTxCompleted,
|
||||
.getByte = nullptr,
|
||||
.getBaudrate = nullptr,
|
||||
.setReceiveCb = nullptr,
|
||||
.setBaudrateCb = nullptr,
|
||||
};
|
||||
|
||||
extern "C" void EXTMODULE_USART_IRQHandler(void)
|
||||
|
||||
@@ -31,7 +31,7 @@ ModuleFifo intmoduleFifo;
|
||||
static uint8_t * intmoduleTxBufferData;
|
||||
static volatile uint8_t intmoduleTxBufferRemaining;
|
||||
|
||||
bool intmoduleTxBufferSend(uint8_t* data)
|
||||
uint8_t intmoduleTxBufferSend(uint8_t* data)
|
||||
{
|
||||
if (intmoduleTxBufferRemaining) {
|
||||
*data = *(intmoduleTxBufferData++);
|
||||
@@ -158,4 +158,8 @@ const etx_serial_driver_t IntmoduleSerialDriver = {
|
||||
.sendByte = intmoduleSendByte,
|
||||
.sendBuffer = intmoduleSendBuffer,
|
||||
.waitForTxCompleted = intmoduleWaitForTxCompleted,
|
||||
.getByte = nullptr,
|
||||
.getBaudrate = nullptr,
|
||||
.setReceiveCb = nullptr,
|
||||
.setBaudrateCb = nullptr,
|
||||
};
|
||||
|
||||
@@ -19,18 +19,24 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "usb_dcd_int.h"
|
||||
#include "usb_bsp.h"
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "opentx.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "usb_driver.h"
|
||||
|
||||
extern "C" {
|
||||
#include "usb_conf.h"
|
||||
#include "usb_dcd_int.h"
|
||||
#include "usb_bsp.h"
|
||||
|
||||
#include "usbd_cdc_core.h"
|
||||
#include "usbd_msc_core.h"
|
||||
#include "usbd_hid_core.h"
|
||||
#include "usbd_usr.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_conf.h"
|
||||
}
|
||||
|
||||
static bool usbDriverStarted = false;
|
||||
#if defined(BOOT)
|
||||
static usbMode selectedUsbMode = USB_MASS_STORAGE_MODE;
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hal/serial_port.h"
|
||||
#include "definitions.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -47,14 +50,9 @@ void usbStart();
|
||||
void usbStop();
|
||||
bool usbStarted();
|
||||
|
||||
int getSelectedUsbMode();
|
||||
EXTERN_C(int getSelectedUsbMode());
|
||||
void setSelectedUsbMode(int mode);
|
||||
|
||||
uint32_t usbSerialFreeSpace();
|
||||
void usbSerialPutc(void*, uint8_t c);
|
||||
EXTERN_C(uint32_t usbSerialFreeSpace());
|
||||
|
||||
uint32_t usbSerialBaudRate(void);
|
||||
|
||||
void usbSerialSetReceiveDataCb(void (*cb)(uint8_t* buf, uint32_t len));
|
||||
void usbSerialSetCtrlLineStateCb(void (*cb)(uint16_t ctrlLineState));
|
||||
void usbSerialSetBaudRateCb(void (*cb)(uint32_t baud));
|
||||
extern const etx_serial_port_t UsbSerialPort;
|
||||
|
||||
@@ -25,11 +25,13 @@
|
||||
|
||||
// include STM32 headers and generic board defs
|
||||
#include "board_common.h"
|
||||
#include "usb_driver.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usb_conf.h"
|
||||
#include "usbd_cdc_core.h"
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
@@ -76,9 +78,13 @@ extern "C" const CDC_IF_Prop_TypeDef VCP_fops =
|
||||
|
||||
} // extern "C"
|
||||
|
||||
static void (*receiveDataCb)(uint8_t* buf, uint32_t len);
|
||||
static void (*ctrlLineStateCb)(uint16_t ctrlLineState);
|
||||
static void (*baudRateCb)(uint32_t baud);
|
||||
static void (*receiveDataCb)(uint8_t*, uint32_t) = nullptr;
|
||||
// static void* receiveDataCbCtx;
|
||||
|
||||
//static void (*ctrlLineStateCb)(uint16_t ctrlLineState);
|
||||
|
||||
static void (*baudRateCb)(uint32_t) = nullptr;
|
||||
// static void* baudRateCbCtx;
|
||||
|
||||
bool cdcConnected = false;
|
||||
|
||||
@@ -92,8 +98,8 @@ bool cdcConnected = false;
|
||||
static uint16_t VCP_Init(void)
|
||||
{
|
||||
cdcConnected = true;
|
||||
ctrlLineStateCb = NULL;
|
||||
baudRateCb = NULL;
|
||||
// receiveDataCb = nullptr;
|
||||
// baudRateCb = nullptr;
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
@@ -107,6 +113,9 @@ static uint16_t VCP_Init(void)
|
||||
static uint16_t VCP_DeInit(void)
|
||||
{
|
||||
cdcConnected = false;
|
||||
receiveDataCb = nullptr;
|
||||
baudRateCb = nullptr;
|
||||
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
@@ -157,8 +166,10 @@ static uint16_t VCP_Ctrl (uint32_t Cmd, uint8_t* Buf, uint32_t Len)
|
||||
case SET_LINE_CODING:
|
||||
if (plc && (Len == sizeof (*plc))) {
|
||||
// If a callback is provided, tell the upper driver of changes in baud rate
|
||||
if (baudRateCb) {
|
||||
baudRateCb(plc->bitrate);
|
||||
auto _cb = baudRateCb;
|
||||
// auto _ctx = baudRateCbCtx;
|
||||
if (_cb) {
|
||||
_cb(/*_ctx,*/ plc->bitrate);
|
||||
}
|
||||
// Copy into structure to save for later
|
||||
ust_cpy(&g_lc, plc);
|
||||
@@ -173,11 +184,11 @@ static uint16_t VCP_Ctrl (uint32_t Cmd, uint8_t* Buf, uint32_t Len)
|
||||
|
||||
case SET_CONTROL_LINE_STATE:
|
||||
// If a callback is provided, tell the upper driver of changes in DTR/RTS state
|
||||
if (plc && (Len == sizeof (uint16_t))) {
|
||||
if (ctrlLineStateCb) {
|
||||
ctrlLineStateCb(*((uint16_t *)Buf));
|
||||
}
|
||||
}
|
||||
// if (plc && (Len == sizeof (uint16_t))) {
|
||||
// if (ctrlLineStateCb) {
|
||||
// ctrlLineStateCb(*((uint16_t *)Buf));
|
||||
// }
|
||||
// }
|
||||
break;
|
||||
|
||||
case SEND_BREAK:
|
||||
@@ -255,28 +266,51 @@ void usbSerialPutc(void*, uint8_t c)
|
||||
static uint16_t VCP_DataRx (uint8_t* Buf, uint32_t Len)
|
||||
{
|
||||
auto _rxCb = receiveDataCb;
|
||||
if (_rxCb) _rxCb(Buf, Len);
|
||||
// auto _ctx = receiveDataCbCtx;
|
||||
|
||||
if (_rxCb) _rxCb(/*_ctx,*/ Buf, Len);
|
||||
return USBD_OK;
|
||||
}
|
||||
|
||||
uint32_t usbSerialBaudRate(void)
|
||||
uint32_t usbSerialBaudRate(void*)
|
||||
{
|
||||
return g_lc.bitrate;
|
||||
}
|
||||
|
||||
void usbSerialSetReceiveDataCb(void (*cb)(uint8_t* buf, uint32_t len))
|
||||
void usbSerialSetReceiveDataCb(void*, void (*cb)(uint8_t*, uint32_t))
|
||||
{
|
||||
// receiveDataCb = nullptr;
|
||||
// receiveDataCbCtx = cb_ctx;
|
||||
receiveDataCb = cb;
|
||||
}
|
||||
|
||||
void usbSerialSetBaudRateCb(void (*cb)(uint32_t baud))
|
||||
void usbSerialSetBaudRateCb(void*, void (*cb)(uint32_t))
|
||||
{
|
||||
// baudRateCb = nullptr;
|
||||
// baudRateCbCtx = cb_ctx;
|
||||
baudRateCb = cb;
|
||||
}
|
||||
|
||||
void usbSerialSetCtrlLineStateCb(void (*cb)(uint16_t ctrlLineState))
|
||||
{
|
||||
ctrlLineStateCb = cb;
|
||||
}
|
||||
// void usbSerialSetCtrlLineStateCb(void (*cb)(uint16_t ctrlLineState))
|
||||
// {
|
||||
// ctrlLineStateCb = cb;
|
||||
// }
|
||||
|
||||
static const etx_serial_driver_t usbSerialDriver = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
usbSerialPutc,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
usbSerialBaudRate,
|
||||
usbSerialSetReceiveDataCb,
|
||||
usbSerialSetBaudRateCb,
|
||||
};
|
||||
|
||||
const etx_serial_port_t UsbSerialPort = {
|
||||
&usbSerialDriver,
|
||||
nullptr,
|
||||
};
|
||||
|
||||
// /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
||||
|
||||
@@ -40,15 +40,6 @@
|
||||
#define ADC_DRIVER x12s_adc_driver
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "usb_dcd_int.h"
|
||||
#include "usb_bsp.h"
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
extern void flysky_hall_stick_check_init(void);
|
||||
extern void flysky_hall_stick_init(void);
|
||||
extern void flysky_hall_stick_loop( void );
|
||||
|
||||
@@ -77,8 +77,9 @@ const etx_serial_driver_t IntmoduleSerialDriver = {
|
||||
.sendBuffer = sendBuffer,
|
||||
.waitForTxCompleted = waitForTxCompleted,
|
||||
.getByte = getByte,
|
||||
.getBaudrate = nullptr,
|
||||
.setReceiveCb = nullptr,
|
||||
.setOnErrorCb = nullptr,
|
||||
.setBaudrateCb = nullptr,
|
||||
};
|
||||
|
||||
const etx_serial_driver_t ExtmoduleSerialDriver = {
|
||||
@@ -88,6 +89,7 @@ const etx_serial_driver_t ExtmoduleSerialDriver = {
|
||||
.sendBuffer = sendBuffer,
|
||||
.waitForTxCompleted = waitForTxCompleted,
|
||||
.getByte = getByte,
|
||||
.getBaudrate = nullptr,
|
||||
.setReceiveCb = nullptr,
|
||||
.setOnErrorCb = nullptr,
|
||||
.setBaudrateCb = nullptr,
|
||||
};
|
||||
|
||||
@@ -747,9 +747,10 @@ void rtcSetTime(const struct gtm * t)
|
||||
}
|
||||
|
||||
#if defined(USB_SERIAL)
|
||||
void usbSerialPutc(uint8_t c)
|
||||
{
|
||||
}
|
||||
const etx_serial_port_t UsbSerialPort = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
};
|
||||
#endif
|
||||
|
||||
const etx_serial_port_t* auxSerialGetPort(int port_nr) { return nullptr; }
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
#define TR_TRNCHN "CH1CH2CH3CH4"
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\010"
|
||||
#define TR_AUX_SERIAL_MODES "调试\0 " "回传镜像" "回传输入" "SBUS教练" "LUA脚本\0"
|
||||
#define TR_AUX_SERIAL_MODES "调试\0 " "回传镜像" "回传输入" "SBUS教练" "LUA脚本\0""CLI\0 "
|
||||
|
||||
#define LEN_SWTYPES "\004"
|
||||
#define TR_SWTYPES "无\0 " "回弹" "2段\0""3段\0"
|
||||
|
||||
@@ -62,9 +62,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\015"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trenér\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trenér\0 ""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "VYP\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trenér\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "VYP\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trenér\0 ""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\013"
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\015"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Eingang\0""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Eingang\0""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "AUS\0 ""Telem Mirror\0""Telemetry In\0""SBUS Eingang\0""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "AUS\0 ""Telem Mirror\0""Telemetry In\0""SBUS Eingang\0""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\006"
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\015"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trainer\0""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trainer\0""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""Telem Mirror\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\006"
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\015"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetría\0 ""Entrenador SBUS""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetría\0 ""Entrenador SBUS""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""Telem Mirror\0""Telemetría\0 ""Entrenador SBUS""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""Telem Mirror\0""Telemetría\0 ""Entrenador SBUS""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\007"
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\015"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""S-Port Pelik\0""Telemetry In\0""SBUS Trainer\0""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""S-Port Pelik\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "POIS\0 ""S-Port Pelik\0""Telemetry In\0""SBUS Trainer\0""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "POIS\0 ""S-Port Pelik\0""Telemetry In\0""SBUS Trainer\0""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\006"
|
||||
|
||||
@@ -66,9 +66,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\016"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Recopie Telem\0""Télémétrie In\0""Ecolage SBUS\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Recopie Telem\0""Télémétrie In\0""Ecolage SBUS\0 ""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""Recopie Telem\0""Télémétrie In\0""Ecolage SBUS\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""Recopie Telem\0""Télémétrie In\0""Ecolage SBUS\0 ""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\006"
|
||||
|
||||
@@ -64,9 +64,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\016"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Replica S-Port""Telemetria\0 ""SBUS Trainer\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Replica S-Port""Telemetria\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""Replica S-Port""Telemetria\0 ""SBUS Trainer\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""Replica S-Port""Telemetria\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\006"
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\015"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Leerling""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Telem Mirror\0""Telemetry In\0""SBUS Leerling""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "UIT\0 ""Telem Mirror\0""Telemetry In\0""SBUS Leerling""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "UIT\0 ""Telem Mirror\0""Telemetry In\0""SBUS Leerling""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\006"
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\015" /*13 decimal*/
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""S-Port Kopia ""Telemetria\0 ""Trener SBUS\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""S-Port Kopia ""Telemetria\0 ""Trener SBUS\0 ""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "Wyłącz\0 ""S-Port Kopia ""Telemetria\0 ""Trener SBUS\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Wyłącz\0 ""S-Port Kopia ""Telemetria\0 ""Trener SBUS\0 ""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\006"
|
||||
|
||||
@@ -63,9 +63,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\017"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""S-Port Mirror\0 ""Telemetry\0 ""SBUS Trainer\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""S-Port Mirror\0 ""Telemetry\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""S-Port Mirror\0 ""Telemetry\0 ""SBUS Trainer\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "OFF\0 ""S-Port Mirror\0 ""Telemetry\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\006"
|
||||
|
||||
@@ -69,9 +69,9 @@
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\022"
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Spegling av S-Port""Telemetri\0 ""SBUS Trainer\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Debug\0 ""Spegling av S-Port""Telemetri\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 "
|
||||
#else
|
||||
#define TR_AUX_SERIAL_MODES "Av\0 ""Spegling av S-Port""Telemetri\0 ""SBUS Trainer\0 ""LUA\0 "
|
||||
#define TR_AUX_SERIAL_MODES "Av\0 ""Spegling av S-Port""Telemetri\0 ""SBUS Trainer\0 ""LUA\0 ""CLI\0 "
|
||||
#endif
|
||||
|
||||
#define LEN_SWTYPES "\006"
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
#define TR_TRNCHN "CH1CH2CH3CH4"
|
||||
|
||||
#define LEN_AUX_SERIAL_MODES "\010"
|
||||
#define TR_AUX_SERIAL_MODES "調試\0 " "回傳鏡像" "回傳輸入" "SBUS教練" "LUA腳本\0"
|
||||
#define TR_AUX_SERIAL_MODES "調試\0 " "回傳鏡像" "回傳輸入" "SBUS教練" "LUA腳本\0""CLI\0 "
|
||||
|
||||
#define LEN_SWTYPES "\004"
|
||||
#define TR_SWTYPES "無\0 " "回彈" "2段\0""3段\0"
|
||||
|
||||
Reference in New Issue
Block a user