mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-11-09 16:41:21 +08:00
HAL_ChibiOS: added half-duplex protection for non-inverted
to prevent output bytes being seen as input bytes we disable half duplex during transmit. This was previously only done for non-inverted UARTs. This patch enables it whether we are inverted or not. This greatly reduces the number of bad input bytes.
This commit is contained in:
1 parent
6b35497129
commit
fc0b2ef920
1 file changed
+8
-12
@@ -929,12 +929,10 @@ void UARTDriver::half_duplex_setup_tx(void)
|
||||
if (!hd_tx_active) {
|
||||
chEvtGetAndClearFlags(&hd_listener);
|
||||
hd_tx_active = true;
|
||||
if (_last_options & (OPTION_RXINV | OPTION_TXINV)) {
|
||||
SerialDriver *sd = (SerialDriver*)(sdef.serial);
|
||||
sdStop(sd);
|
||||
sercfg.cr3 &= ~USART_CR3_HDSEL;
|
||||
sdStart(sd, &sercfg);
|
||||
}
|
||||
SerialDriver *sd = (SerialDriver*)(sdef.serial);
|
||||
sdStop(sd);
|
||||
sercfg.cr3 &= ~USART_CR3_HDSEL;
|
||||
sdStart(sd, &sercfg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -955,12 +953,10 @@ void UARTDriver::_timer_tick(void)
|
||||
half-duplex transmit has finished. We now re-enable the
|
||||
HDSEL bit for receive
|
||||
*/
|
||||
if (_last_options & (OPTION_RXINV | OPTION_TXINV)) {
|
||||
SerialDriver *sd = (SerialDriver*)(sdef.serial);
|
||||
sdStop(sd);
|
||||
sercfg.cr3 |= USART_CR3_HDSEL;
|
||||
sdStart(sd, &sercfg);
|
||||
}
|
||||
SerialDriver *sd = (SerialDriver*)(sdef.serial);
|
||||
sdStop(sd);
|
||||
sercfg.cr3 |= USART_CR3_HDSEL;
|
||||
sdStart(sd, &sercfg);
|
||||
hd_tx_active = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user