feat(uart): uart break example improvement (#10525)

prints the HEXA and CHAR in order to allow the user to see why there is 1 extra char (0x00) when BREAK is received.
This commit is contained in:
Rodrigo Garcia 2024-10-25 14:48:35 -03:00 committed by GitHub
parent 07c510e3ad
commit 74e4a744ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,7 +80,11 @@ void onReceiveFunction() {
received_bytes = received_bytes + available;
Serial.printf("onReceive Callback:: There are %d bytes available: {", available);
while (available--) {
Serial.print((char)Serial1.read());
char c = Serial1.read();
Serial.printf("0x%x='%c'", c, c);
if (available) {
Serial.print(" ");
}
}
Serial.println("}");
}