Open
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds hardware flow control support to the USB UART bridge by introducing RTS and CTS pin definitions. Hardware flow control is conditionally enabled based on the pin configuration values.
- Added configuration options for UART RTS and CTS pins with default values of -1 (disabled)
- Implemented conditional hardware flow control enabling when both RTS and CTS pins are set to positive values
- Updated UART pin configuration to include the new RTS and CTS pins
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| main/usb_uart_bridge_main.c | Added pin definitions and conditional flow control logic with updated UART configuration |
| main/Kconfig.projbuild | Added configuration options for RTS and CTS pins with default disabled values |
| .parity = CFG_PARITY(s_parity_active), | ||
| .stop_bits = CFG_STOP_BITS(s_stop_bits_active), | ||
| .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, | ||
| #if BOARD_UART_RTS_PIN < 0 || BOARD_UART_CTS_PIN < 0 |
There was a problem hiding this comment.
The condition only checks if either pin is negative, but hardware flow control requires both RTS and CTS pins to be valid. The condition should use && instead of || to ensure both pins are non-negative before enabling flow control.
Suggested change
| #if BOARD_UART_RTS_PIN < 0 || BOARD_UART_CTS_PIN < 0 | |
| #if BOARD_UART_RTS_PIN < 0 && BOARD_UART_CTS_PIN < 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If hardware flow control is enabled by setting the RTS and CTS pins to a positive number, we switch the UART to
UART_HW_FLOWCTRL_CTS_RTS. This is disabled by default.