Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(uart): Add function to invert hardware UART Tx line#11428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
me-no-dev merged 31 commits intoespressif:masterfromasund:uart_tx_invert
Nov 5, 2025

Conversation

@asund
Copy link
Contributor

@asundasund commentedJun 4, 2025
edited by SuGlider
Loading

Description of Change

Adds a setTxInvert(), setRtsInvert() and setCtsInvert() to HardwareSerial and corresponding uartSetTxInvert to the HAL.
Using IDF Calls instead of poking registers.

Tests scenarios

I have tested my Pull Request on Arduino-esp32 core v3.2.0 with ESP32 and ESP32-S2 Board.
I added an untested implementation for the ESP32C6, ESP32H2, ESP32P4 platform in the HAL to reflect the different register name.

Tested with CIuart.ino and using a data analizer.

Related links

N/A

Simply clone existing Rx functionality for Tx.Allow granular control over both lines.Avoid overloading HardwareSerial::begin() to change the bool invert parameter to a bitmask type.Add an untested implementation for ESP32C6, ESP32H2, ESP32P4 that references the different registernaming on those chips.
@github-actions
Copy link
Contributor

github-actionsbot commentedJun 4, 2025
edited
Loading

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message"Refactor UART inversion functions to use new method":
    • summary looks empty
    • type/action looks empty
  • the commit message"feat(uart) : Refactor serial inversion methods to return bool":
    • summary looks empty
    • type/action looks empty
  • the commit message"feat(uart): Refactor UART signal inversion handling":
    • body's lines must not be longer than 100 characters

Please fix these commit messages - here are some basic tips:

  • followConventional Commits style
  • correct format of commit message should be:<type/action>(<scope/component>): <summary>, for examplefix(esp32): Fixed startup timeout issue
  • allowed types are:change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 10 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses theConventional Precommit Linter).

👋Hello asund, we appreciate your contribution to this project!


📘 Please review the project'sContributions Guide for key guidelines on code, documentation, testing, and more.

🖊️ Please also make sure you haveread and signed theContributor License Agreement for this project.

Click to see more instructions ...


This automated output is generated by thePR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with eachpush event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger isnot a substitute for human code reviews; it's still important to request a code review from your colleagues.
-Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manuallyretry these Danger checks, please navigate to theActions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫dangerJS against484b42d

@P-R-O-C-H-YP-R-O-C-H-Y added Peripheral: UARTRelated to the UART peripheral or its functionality. Status: Review neededIssue or PR is awaiting review labelsJun 4, 2025
@github-actions
Copy link
Contributor

github-actionsbot commentedJun 4, 2025
edited
Loading

Test Results

 76 files   76 suites   16m 50s ⏱️
 38 tests  38 ✅ 0 💤 0 ❌
241 runs  241 ✅ 0 💤 0 ❌

Results for commit484b42d.

♻️ This comment has been updated with latest results.

@SuGliderSuGlider self-assigned thisJun 5, 2025
@SuGlider
Copy link
Collaborator

This PR may need a few improvements based on how IDF 5.4.1 has changed UART driver.
@asund - do you mind if I commit changes over your PR?

asund reacted with thumbs up emoji

@asund
Copy link
ContributorAuthor

This PR may need a few improvements based on how IDF 5.4.1 has changed UART driver.@asund - do you mind if I commit changes over your PR?

No problem at all. Let me know if there's anything I can do if you want.

@SuGlider
Copy link
Collaborator

SuGlider commentedJun 21, 2025
edited
Loading

Waiting on changes from#11499 to be merged.
The code shall be changed to add IDF calls instead which shall work for all SoC with no need to test which SoC is used in order to use the right UART Structure Names.

Possible API for inverting any signal, including CTS/RTS and LP UART signals.

@SuGliderSuGlider moved this fromTodo toUnder investigation inArduino ESP32 Core Project RoadmapJun 21, 2025
@SuGliderSuGlider added this to the3.2.1 milestoneJun 21, 2025
@SuGliderSuGlider added Status: In Progress ⚠️Issue is in progress and removed Status: Review neededIssue or PR is awaiting review labelsJun 21, 2025
@asund
Copy link
ContributorAuthor

Sounds great! No problem closing this issue when that lands.

@SuGliderSuGlider marked this pull request as draftJuly 15, 2025 13:48
Refactor UART inversion functions to use a helper for signal inversion. Update UART bus array structure to include inversion mask.
Added functions for UART signal inversion and updated existing function signatures.
Changed setRxInvert, setTxInvert to return bool. Added setCtsInvert and setRtsInvert methods.
Added functions for UART pins signal inversion.
@SuGliderSuGlider added Status: Review neededIssue or PR is awaiting review and removed Status: In Progress ⚠️Issue is in progress labelsNov 4, 2025
@SuGliderSuGlider moved this fromUnder investigation toIn Review inArduino ESP32 Core Project RoadmapNov 4, 2025
@SuGliderSuGlider modified the milestones:3.2.1,3.4.0Nov 4, 2025
Copy link
Contributor

CopilotAI 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 enhances UART signal inversion functionality by extending support beyond RX inversion to include TX, CTS, and RTS signal inversion. The implementation introduces a generic helper function to manage signal inversion state and exposes new APIs through the HardwareSerial class.

  • Adds TX, CTS, and RTS signal inversion functions alongside the existing RX inversion
  • Introduces aninv_mask field to track combined inversion states across all UART pins
  • Refactors signal inversion to use a centralized helper function that properly maintains inversion state
  • Updates return types fromvoid tobool to indicate operation success

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 12 comments.

Show a summary per file
FileDescription
cores/esp32/esp32-hal-uart.hDeclares new signal inversion functions and helper, updatesuartSetRxInvert return type tobool
cores/esp32/esp32-hal-uart.cImplements generic inversion helper and individual TX/CTS/RTS inversion functions, addsinv_mask field to uart_struct_t, updates initialization arrays
cores/esp32/HardwareSerial.hDeclares new signal inversion methods withbool return types
cores/esp32/HardwareSerial.cppImplements wrapper methods for new signal inversion functions
tests/validation/uart/uart.inoAdds test cases for TX signal inversion in both enabled and disabled UART states

💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.

@SuGliderSuGlider self-requested a reviewNovember 4, 2025 03:07
SuGliderand others added9 commitsNovember 4, 2025 00:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

CopilotAI 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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

cores/esp32/esp32-hal-uart.c:1619

  • Theuart_send_break function does not preserve the existing inversion mask when toggling the TX inversion. This will clear any previously set signal inversions (RX, CTS, RTS). The function should use the uart structure'sinv_mask to preserve other signal inversions. Consider using_uart_bus_array[uartNum].inv_mask to get the current mask, toggle only the TX bit, and restore the original mask after the break.
  uart_set_line_inverse(uartNum, UART_SIGNAL_TXD_INV);  esp_rom_delay_us(breakTime);  uart_set_line_inverse(uartNum, UART_SIGNAL_INV_DISABLE);

💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.

@SuGliderSuGlider added Status: Pending MergePull Request is ready to be merged and removed Status: Review neededIssue or PR is awaiting review labelsNov 5, 2025
@SuGliderSuGlider modified the milestones:3.4.0,3.3.0Nov 5, 2025
@me-no-devme-no-dev merged commita8c74c4 intoespressif:masterNov 5, 2025
79 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@me-no-devme-no-devme-no-dev approved these changes

@lucasssvazlucasssvazlucasssvaz approved these changes

@SuGliderSuGliderSuGlider approved these changes

@P-R-O-C-H-YP-R-O-C-H-YAwaiting requested review from P-R-O-C-H-YP-R-O-C-H-Y is a code owner

Assignees

@SuGliderSuGlider

Labels

Peripheral: UARTRelated to the UART peripheral or its functionality.Status: Pending MergePull Request is ready to be merged

Projects

Milestone

3.3.0

Development

Successfully merging this pull request may close these issues.

5 participants

@asund@SuGlider@me-no-dev@lucasssvaz@P-R-O-C-H-Y

[8]ページ先頭

©2009-2025 Movatter.jp