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

An interrupt-based implementation of HardwareSerial #93

Open
michpro opened this issue May 13, 2024 · 1 comment
Open

An interrupt-based implementation of HardwareSerial #93

michpro opened this issue May 13, 2024 · 1 comment

Comments

@michpro
Copy link
Contributor

michpro commented May 13, 2024

The currently available implementation of HardwareSerial is very primitive and is based on polling.
Especially when sending data, this causes unnecessary blocking of the program's execution of other tasks.
A DMA-based implementation, although it would relieve the CPU, will not be optimal for the variable amount of data transferred, hence I propose a traditional interrupt-based implementation.

@maxint-rd
Copy link
Contributor

The current implementation is not just primitive polling, it's also also missing some Arduino core functionality such as available() and peek().

For my own projects I made up a polling routine to fill the buffer used to implement available() and peek().

@tanakamasayuki proposed PR #79 as a simple improvement to implement available() and also suggested using interrupts, illustrated with some code.

+1 for a nice interrupt based implementation. I'm in favor of anything better, but currently prefer small code size, since I found use of the limited flash on the CH32V003 the most prevalent issue in my projects...

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

No branches or pull requests

2 participants