Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

machine.UART refactor #3832

Merged
merged 8 commits into from Jul 15, 2023
Merged

machine.UART refactor #3832

merged 8 commits into from Jul 15, 2023

Conversation

soypat
Copy link
Contributor

@soypat soypat commented Jul 13, 2023

Resolves #3537, closes #3538.

Adds:

  • UART.flush: method implemented by UARTs that blocks until all data has finished being transmitted
  • uart.writeByte: method implemented by UARTs that writes over the UART pin without blocking.
  • Comments to WriteBytes shared by all implementations.

Semantic changes:

  • UART.WriteByte and UART.Write: Methods now expected to block until all data has been finished being transmitted over wire.

@soypat soypat requested review from kenbell and aykevl July 13, 2023 02:07
@soypat soypat linked an issue Jul 13, 2023 that may be closed by this pull request
Copy link
Member

@aykevl aykevl left a comment

Choose a reason for hiding this comment

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

Looks good to me.

This may break some application that assumed the previous incorrect behavior, but it is certainly an improvement over what we had previously.

We might want to do something similar for ReadByte: at the moment it does not block while the vast majority of applications need a blocking interface.

Copy link
Member

@sago35 sago35 left a comment

Choose a reason for hiding this comment

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

LGTM

src/machine/uart.go Outdated Show resolved Hide resolved
@soypat
Copy link
Contributor Author

soypat commented Jul 14, 2023

@soypat soypat merged commit a7b205c into tinygo-org:dev Jul 15, 2023
13 checks passed
@soypat
Copy link
Contributor Author

soypat commented Jul 15, 2023

OK, the flaky test passed. Merging now. Thank you everyone for the great feedback!

deadprogram pushed a commit that referenced this pull request Jul 18, 2023
* add gosched calls to UART

* add UART.flush() stubs for all supported architectures

* add comment un uart.go on flush functionality

* uart.writeByte as base of UART usage

* fix NXP having duplicate WriteByte

* fix writeByte not returning error on some platforms

* add flush method for fe310 device

* check for error in WriteByte call to writeByte
deadprogram pushed a commit that referenced this pull request Sep 17, 2023
* add gosched calls to UART

* add UART.flush() stubs for all supported architectures

* add comment un uart.go on flush functionality

* uart.writeByte as base of UART usage

* fix NXP having duplicate WriteByte

* fix writeByte not returning error on some platforms

* add flush method for fe310 device

* check for error in WriteByte call to writeByte
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.

Need UART "Flush" method on RP2040
4 participants