-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ESP core printf
implementation in AVR core.
#482
Conversation
Memory usage change @ 83c437f
Click for full report table
Click for full report CSV
|
Memory usage change @ 5806b17
Click for full report table
Click for full report CSV
|
Thanks for this PR. However, in the past, adding printf support has been discussed and rejected, see arduino/ArduinoCore-API#32 which tracks this issue and has some additional references, and also talks about better approaches. In any case - if this would be implemented it would need to be supported on all architectures and its implementation would be arch-independent anyway, so the proper place to add (and/or discuss) this would be the ArduinoCore-API repository (which is not used by AVR yet, but should be in the future). In fact, that repo already has some PRs for implementing this (including one that is technically a bit cleaner than this PR, because it prints byte-by-byte without requiring a fixed-size buffer). I'm going to go ahead and close this PR for these reasons, but know that your contributions are very much appreciated! |
Yes, I also thought about implementing something myself using variadic function templates, but since I found this in the ESP core, I figured that this was preferable. Anyway, good to know that a solution is on its way. |
This addition will allow for convenient printing using the
printf
function, as implemented in the ESP core.Example
Consider the following block of code.
This can be replaced by the following line.
Serial.printf("(%i, %i): %i\r\n", i, j, result);
I hope you find this useful.