1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Avoid using N-Channel for RX function

This commit is contained in:
jflyper 2017-08-31 03:44:49 +09:00
parent 5cbe75a603
commit 652d9adba8

View file

@ -254,8 +254,8 @@ 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;
@ -264,8 +264,8 @@ 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;