1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 21:05:35 +03:00

Merge pull request #7272 from jflyper/bfdev-escserial-simonk-separation

[F3, ESCSERIAL] Conditionalize SimonK handling from escserial and drop it from F3
This commit is contained in:
Michael Keller 2018-12-24 23:31:48 +13:00 committed by GitHub
commit ec64c89ae7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -50,6 +50,7 @@
typedef enum { typedef enum {
BAUDRATE_NORMAL = 19200, BAUDRATE_NORMAL = 19200,
BAUDRATE_SIMONK = 28800, // = 9600 * 3
BAUDRATE_KISS = 38400, BAUDRATE_KISS = 38400,
BAUDRATE_CASTLE = 18880 BAUDRATE_CASTLE = 18880
} escBaudRate_e; } escBaudRate_e;
@ -432,6 +433,7 @@ static void serialTimerRxConfigBL(const timerHardware_t *timerHardwarePtr, uint8
timerChConfigCallbacks(timerHardwarePtr, &escSerialPorts[reference].edgeCb, NULL); timerChConfigCallbacks(timerHardwarePtr, &escSerialPorts[reference].edgeCb, NULL);
} }
#ifdef USE_ESCSERIAL_SIMONK
static void processTxStateEsc(escSerial_t *escSerial) static void processTxStateEsc(escSerial_t *escSerial)
{ {
uint8_t mask; uint8_t mask;
@ -643,6 +645,7 @@ static void escSerialTimerRxConfig(const timerHardware_t *timerHardwarePtr, uint
timerChCCHandlerInit(&escSerialPorts[reference].edgeCb, onSerialRxPinChangeEsc); timerChCCHandlerInit(&escSerialPorts[reference].edgeCb, onSerialRxPinChangeEsc);
timerChConfigCallbacks(timerHardwarePtr, &escSerialPorts[reference].edgeCb, NULL); timerChConfigCallbacks(timerHardwarePtr, &escSerialPorts[reference].edgeCb, NULL);
} }
#endif
static void resetBuffers(escSerial_t *escSerial) static void resetBuffers(escSerial_t *escSerial)
{ {
@ -706,11 +709,14 @@ static serialPort_t *openEscSerial(escSerialPortIndex_e portIndex, serialReceive
} }
delay(50); delay(50);
#ifdef USE_ESCSERIAL_SIMONK
if (mode==PROTOCOL_SIMONK) { if (mode==PROTOCOL_SIMONK) {
escSerialTimerTxConfig(escSerial->txTimerHardware, portIndex); escSerialTimerTxConfig(escSerial->txTimerHardware, portIndex);
escSerialTimerRxConfig(escSerial->rxTimerHardware, portIndex); escSerialTimerRxConfig(escSerial->rxTimerHardware, portIndex);
} }
else if (mode==PROTOCOL_BLHELI) { else
#endif
if (mode==PROTOCOL_BLHELI) {
serialTimerTxConfigBL(escSerial->txTimerHardware, portIndex, baud); serialTimerTxConfigBL(escSerial->txTimerHardware, portIndex, baud);
serialTimerRxConfigBL(escSerial->rxTimerHardware, portIndex, options); serialTimerRxConfigBL(escSerial->rxTimerHardware, portIndex, options);
} }

View file

@ -239,4 +239,5 @@
#define USE_ESC_SENSOR_TELEMETRY #define USE_ESC_SENSOR_TELEMETRY
#define USE_OSD_PROFILES #define USE_OSD_PROFILES
#define USE_OSD_STICK_OVERLAY #define USE_OSD_STICK_OVERLAY
#define USE_ESCSERIAL_SIMONK
#endif #endif