Skip to content

Commit def06ca

Browse files
aentingerfacchinm
authored andcommitted
Fix: Only return true for 'uart_is_writeable' if the TX FIFO is empty.
This allows the Arduino_Braccio_plusplus library to work again, since it depends on precisely trimmed timeouts to change data direction on the RS485 lines. This means that when '_serial->flush();' is called, we do wait until the FIFO is empty before turning of DATA ENABLE. Currently if we call _serial->flush(); we are instead only waiting until at least one element has been removed from the transmit FIFO.
1 parent 9964e34 commit def06ca

File tree

2 files changed

+3
-3
lines changed
  • targets/TARGET_RASPBERRYPI/TARGET_RP2040

2 files changed

+3
-3
lines changed

targets/TARGET_RASPBERRYPI/TARGET_RP2040/pico-sdk/rp2_common/hardware_uart/include/hardware/uart.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,14 @@ static inline void uart_set_fifo_enabled(uart_inst_t *uart, bool enabled) {
253253
// ----------------------------------------------------------------------------
254254
// Generic input/output
255255

256-
/*! \brief Determine if space is available in the TX FIFO
256+
/*! \brief Determine if the TX FIFO is empty.
257257
* \ingroup hardware_uart
258258
*
259259
* \param uart UART instance. \ref uart0 or \ref uart1
260260
* \return false if no space available, true otherwise
261261
*/
262262
static inline bool uart_is_writable(uart_inst_t *uart) {
263-
return !(uart_get_hw(uart)->fr & UART_UARTFR_TXFF_BITS);
263+
return (uart_get_hw(uart)->fr & UART_UARTFR_TXFE_BITS);
264264
}
265265

266266
/*! \brief Wait for the UART TX fifo to be drained

targets/TARGET_RASPBERRYPI/TARGET_RP2040/serial_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,4 @@ const PinMap *serial_rts_pinmap(void)
212212
return PinMap_UART_RTS;
213213
}
214214

215-
#endif
215+
#endif

0 commit comments

Comments
 (0)