-
Notifications
You must be signed in to change notification settings - Fork 1k
Harden Print::printf() method #795
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
Conversation
Can you verify that this can be used on two or more serial ports at the same time? I tested out the version from the Teensy core, but |
|
It's still important that we can use SerialX.printf on more than one serial port at the time. Will this be possible? |
This is possible and tested. |
Example for Nucleo-F411 HardwareSerial Serial1(USART1);
const char * lorem = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
static uint32_t i = 0;
Serial.printf("Iter %i --> %s\n", i++, lorem);
Serial1.printf("Iter %i --> %s\n", i++, lorem);
} |
I did test the Teensy implementation on a F401Rx board. I manually defined Serial1 at the beginning at the sketch and looked at the output in the serial monitor (Serial) and with a logic analyzer (Serial1). Even though it shouldn't, I got the same output in the serial monitor and in the logic analyzer capture window. However, I can test this particular implementation on by Nucle F401RE board tomorrow. |
I just tested it on my Nucleo F401RE. Works perfectly! I do agree that this implementation is better than #780. And getting rid of the buffer is definitely a win! |
based on @PaulStoffregen works for Teensyduino: https://github.com/PaulStoffregen/cores Remove PRINTF_BUFFER usage. Aligned declaration with `printf()` one by returning the number of characters printed (excluding the null byte used to end output to strings). Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
983c223
to
3d3b29b
Compare
Based on @PaulStoffregen works for Teensyduino:
https://github.com/PaulStoffregen/cores
PRINTF_BUFFER
usage.printf()
one by returning the number of characters printed (excluding the null byte used to end output to strings).Tested:
printf
usage on theDEBUG_UART
Harden #780 from @MCUdude.