mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 23:05:19 +03:00
Merge pull request #4018 from jflyper/bdfev-softserial-avoid-n-channel-for-rx
SOFTSERIAL Avoid using N-Channel for RX function
This commit is contained in:
commit
6eb843fa04
1 changed files with 6 additions and 4 deletions
|
@ -254,9 +254,10 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb
|
||||||
if (options & SERIAL_BIDIR) {
|
if (options & SERIAL_BIDIR) {
|
||||||
// If RX and TX pins are both assigned, we CAN use either with a timer.
|
// If RX and TX pins are both assigned, we CAN use either with a timer.
|
||||||
// However, for consistency with hardware UARTs, we only use TX pin,
|
// However, for consistency with hardware UARTs, we only use TX pin,
|
||||||
// and this pin must have a timer.
|
// and this pin must have a timer, and it should not be N-Channel.
|
||||||
if (!timerTx)
|
if (!timerTx || (timerTx->output & TIMER_OUTPUT_N_CHANNEL)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
softSerial->timerHardware = timerTx;
|
softSerial->timerHardware = timerTx;
|
||||||
softSerial->txIO = txIO;
|
softSerial->txIO = txIO;
|
||||||
|
@ -264,9 +265,10 @@ serialPort_t *openSoftSerial(softSerialPortIndex_e portIndex, serialReceiveCallb
|
||||||
IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
|
IOInit(txIO, OWNER_SERIAL_TX, RESOURCE_INDEX(portIndex + RESOURCE_SOFT_OFFSET));
|
||||||
} else {
|
} else {
|
||||||
if (mode & MODE_RX) {
|
if (mode & MODE_RX) {
|
||||||
// Need a pin & a timer on RX
|
// Need a pin & a timer on RX. Channel should not be N-Channel.
|
||||||
if (!(tagRx && timerRx))
|
if (!timerRx || (timerRx->output & TIMER_OUTPUT_N_CHANNEL)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
softSerial->rxIO = rxIO;
|
softSerial->rxIO = rxIO;
|
||||||
softSerial->timerHardware = timerRx;
|
softSerial->timerHardware = timerRx;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue