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

Complete KISSCC and fix simplex TX case

This commit is contained in:
jflyper 2017-02-10 22:07:29 +09:00
parent b2ed74cd1e
commit d7f79bc3ca
2 changed files with 15 additions and 8 deletions

View file

@ -260,7 +260,16 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb
return NULL;
softSerial->txIO = txIO;
softSerial->exTimerHardware = timerTx;
if (!(mode & MODE_RX)) {
// TX Simplex, must have a timer
if (!timerTx)
return NULL;
softSerial->timerHardware = timerTx;
} else {
// Duplex
softSerial->exTimerHardware = timerTx;
}
IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(portIndex) + RESOURCE_SOFT_OFFSET);
}
}
@ -449,7 +458,6 @@ void processRxState(softSerial_t *softSerial)
void onSerialTimerOverflow(timerOvrHandlerRec_t *cbRec, captureCompare_t capture)
{
UNUSED(capture);
softSerial_t *self = container_of(cbRec, softSerial_t, overCb);
if (self->port.mode & MODE_TX)