mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Fixed SOFTSERIAL when the TX and RX pins are shared.
This commit is contained in:
parent
a05b819b71
commit
63bcfd1801
1 changed files with 4 additions and 2 deletions
|
@ -242,8 +242,8 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb
|
||||||
ioTag_t tagRx = serialPinConfig()->ioTagRx[pinCfgIndex];
|
ioTag_t tagRx = serialPinConfig()->ioTagRx[pinCfgIndex];
|
||||||
ioTag_t tagTx = serialPinConfig()->ioTagTx[pinCfgIndex];
|
ioTag_t tagTx = serialPinConfig()->ioTagTx[pinCfgIndex];
|
||||||
|
|
||||||
const timerHardware_t *timerRx = timerAllocate(tagRx, OWNER_SERIAL_RX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
|
|
||||||
const timerHardware_t *timerTx = timerAllocate(tagTx, OWNER_SERIAL_TX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
|
const timerHardware_t *timerTx = timerAllocate(tagTx, OWNER_SERIAL_TX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
|
||||||
|
const timerHardware_t *timerRx = (tagTx == tagRx) ? timerTx : timerAllocate(tagRx, OWNER_SERIAL_RX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
|
||||||
|
|
||||||
IO_t rxIO = IOGetByTag(tagRx);
|
IO_t rxIO = IOGetByTag(tagRx);
|
||||||
IO_t txIO = IOGetByTag(tagTx);
|
IO_t txIO = IOGetByTag(tagTx);
|
||||||
|
@ -269,7 +269,9 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb
|
||||||
|
|
||||||
softSerial->rxIO = rxIO;
|
softSerial->rxIO = rxIO;
|
||||||
softSerial->timerHardware = timerRx;
|
softSerial->timerHardware = timerRx;
|
||||||
IOInit(rxIO, OWNER_SERIAL_RX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
|
if (!((mode & MODE_TX) && rxIO == txIO)) {
|
||||||
|
IOInit(rxIO, OWNER_SERIAL_RX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode & MODE_TX) {
|
if (mode & MODE_TX) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue