Changed example to use peeking

This commit is contained in:
BlackMark 2019-08-02 18:22:38 +02:00
parent 408ab83afb
commit 5047b661af
2 changed files with 14 additions and 2 deletions

View File

@ -21,8 +21,20 @@ void newUartUsage()
while (true) { while (true) {
uint8_t received = 0; uint8_t received = 0;
if (serial1.rxByte(received)) while (!serial1.peek(received))
;
{
serial1 << F("Peeked: ");
serial1.txByte(received); serial1.txByte(received);
serial1 << F("\r\n");
}
if (serial1.rxByte(received)) {
serial1 << F("Received: ");
serial1.txByte(received);
serial1 << F("\r\n");
}
} }
_delay_ms(1000); _delay_ms(1000);

@ -1 +1 @@
Subproject commit 0bfd303a26a8aad77607e9cefb1039997952af09 Subproject commit a3d76a138ddb9e5c0e7607aae38248ef0b33959b