Skip to content

machine.UART refactor#3832

Merged
soypat merged 8 commits into
tinygo-org:devfrom
soypat:rp2040-uartsched
Jul 15, 2023
Merged

machine.UART refactor#3832
soypat merged 8 commits into
tinygo-org:devfrom
soypat:rp2040-uartsched

Conversation

@soypat

@soypat soypat commented Jul 13, 2023

Copy link
Copy Markdown
Contributor

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 aykevl and kenbell July 13, 2023 02:07
@soypat soypat linked an issue Jul 13, 2023 that may be closed by this pull request

@aykevl aykevl left a comment

Copy link
Copy Markdown
Member

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.

@sago35 sago35 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread src/machine/uart.go Outdated
@soypat

soypat commented Jul 14, 2023

Copy link
Copy Markdown
Contributor Author

@soypat soypat merged commit a7b205c into tinygo-org:dev Jul 15, 2023
@soypat

soypat commented Jul 15, 2023

Copy link
Copy Markdown
Contributor Author

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