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