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): support UART Tx, Rx and Data invert function#2701

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
fpistm merged 1 commit intostm32duino:mainfromndoo:uart-invert
Mar 31, 2025

Conversation

@ndoo
Copy link
Contributor

@ndoondoo commentedMar 27, 2025
edited by fpistm
Loading

Fixes:
See also:#1418

Summary

This enables UART Tx, Rx and data invert function on STM32 families that support it.

In order to enable Tx, Rx and/or data invert, call respectively:

Serial1.setTxInvert();Serial1.setRxInvert();Serial1.setDataInvert();

This PR fixes/implements the followingbugs/features

This adds a feature exposed by the native STM32 HAL & (some) hardware.

Validation

  • Ensure CI build is passed.
  • Tested a sketch with following lines of code:
    HardwareSerial sdiSerial = HardwareSerial(PA2);sdiSerial.setTxInvert();sdiSerial.begin(1200, SERIAL_7E1);

Closing issues

Closes#1160#2669

@ndoondoo marked this pull request as ready for reviewMarch 27, 2025 15:14
@ndoo
Copy link
ContributorAuthor

@ndoondoo marked this pull request as draftMarch 28, 2025 02:07
@ndoo
Copy link
ContributorAuthor

Not sure if it actually works, marking as Draft again.

Squashed in a fixup for missing

    huart->AdvancedInit.RxPinLevelInvert = UART_ADVFEATURE_RXINV_ENABLE;    huart->AdvancedInit.TxPinLevelInvert = UART_ADVFEATURE_TXINV_ENABLE;

@ndoo
Copy link
ContributorAuthor

Please let me know if the code flow makes sense in uart.c. Thank you.

@fpistm
Copy link
Member

Hi@ndoo
Thanks for the PR.
Will review it soon.

@fpistmfpistm added the enhancementNew feature or request labelMar 28, 2025
@fpistmfpistm added this to the2.11.0 milestoneMar 28, 2025
Copy link
Member

@fpistmfpistm left a comment

Choose a reason for hiding this comment

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

Hi@ndoo
Thanks for this PR (well made 😉)
Some comments to address (open to discussion).
In addition, it would be fine to add new methods in the keywords.txt.
Could you also write doc about its usage to be added in the Wiki ?

@github-project-automationgithub-project-automationbot moved this fromIn progress toNeeds review inSTM32 core based on ST HALMar 28, 2025
@ndoo
Copy link
ContributorAuthor

Thanks for the review. Since I seem to be headed in the right direction, I will extend this to invert data as well, for completeness.

FWIW, I had my sketch freeze trying to read from serial, but let me debug over SWD after everything is done.

@ndoo
Copy link
ContributorAuthor

Force-pushed with the requested code changes. Workflows are still running.

I have to go to bed, but I will take a look at keywords.txt (which?) and updating the Wiki tomorrow.

This enables UART Tx, Rx and data invert function on STM32 families that support it.In order to enable Tx, Rx and/or data invert, call respectively:```c++Serial1.setTxInvert();Serial1.setRxInvert();Serial1.setDataInvert();```Fixes:stm32duino#1160stm32duino#2669See also:stm32duino#1418Signed-off-by: Andrew Yong <me@ndoo.sg>
@ndoo
Copy link
ContributorAuthor

Done updating keywords.txt - now having a look at writing for the Wiki.

ndoo added a commit to ndoo/stm32duino_wiki_contrib that referenced this pull requestMar 29, 2025
@ndoondoo marked this pull request as ready for reviewMarch 29, 2025 06:33
@ndoo
Copy link
ContributorAuthor

Wiki PR:stm32duino/wiki_contrib#2

Taking PR out of draft. Do let me know if anything was missed. Cheers!

fpistm reacted with thumbs up emoji

ndoo added a commit to ndoo/stm32duino_wiki_contrib that referenced this pull requestMar 29, 2025
@ndoondoo changed the titlefeat(uart): support UART Tx Rx invert functionfeat(uart): support UART Tx, Rx & Data invert functionMar 30, 2025
@ndoondoo changed the titlefeat(uart): support UART Tx, Rx & Data invert functionfeat(uart): support UART Tx, Rx and Data invert functionMar 30, 2025
Copy link
Member

@fpistmfpistm left a comment

Choose a reason for hiding this comment

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

Thanks@ndoo

ndoo reacted with thumbs up emoji
@github-project-automationgithub-project-automationbot moved this fromNeeds review toReviewer approved inSTM32 core based on ST HALMar 31, 2025
@fpistmfpistm linked an issueMar 31, 2025 that may beclosed by this pull request
@fpistmfpistm merged commit3a60776 intostm32duino:mainMar 31, 2025
24 checks passed
@github-project-automationgithub-project-automationbot moved this fromReviewer approved toDone inSTM32 core based on ST HALMar 31, 2025
@fpistmfpistm mentioned this pull requestMar 4, 2025
4 tasks
fpistm pushed a commit to stm32duino/wiki_contrib that referenced this pull requestMar 31, 2025
@fpistmfpistm mentioned this pull requestApr 25, 2025
@ndoondoo deleted the uart-invert branchJuly 18, 2025 03:11
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fpistmfpistmfpistm approved these changes

Assignees

No one assigned

Labels

enhancementNew feature or request

Projects

Milestone

2.11.0

Development

Successfully merging this pull request may close these issues.

Support U[S]ART Inversion on STM32U0 Support for UART RX/TX level inversion on F3/F7 platforms

2 participants

@ndoo@fpistm

[8]ページ先頭

©2009-2025 Movatter.jp