Skip to content

Add hardware flow control pin definitions#15

Open
puddly wants to merge 1 commit intomasterfrom
puddly/flow-control
Open

Add hardware flow control pin definitions#15
puddly wants to merge 1 commit intomasterfrom
puddly/flow-control

Conversation

@puddly
Copy link
Copy Markdown
Collaborator

@puddly puddly commented Aug 8, 2025

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.

@puddly puddly requested a review from Copilot August 8, 2025 18:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants