Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MODSERIAL by
Diff: GETC.cpp
- Revision:
- 8:775f860e94d3
- Parent:
- 1:b7e435fbfe8e
- Child:
- 22:c11ea36f17f9
--- a/GETC.cpp Mon Nov 22 09:19:50 2010 +0000 +++ b/GETC.cpp Mon Nov 22 09:58:34 2010 +0000 @@ -28,6 +28,14 @@ int MODSERIAL::__getc(bool block) { + // If no buffer is in use fall back to standard RX FIFO usage. + // Note, we must block in this case and ignore bool "block" + // so as to maintain compat with Mbed Serial. + if (buffer_size[RxIrq] == 0 || buffer[RxIrq] == (char *)NULL) { + while(! MODSERIAL_RBR_HAS_DATA ) ; + return (int)(_RBR & 0xFF); + } + if (block) { while ( MODSERIAL_RX_BUFFER_EMPTY ) ; } // Blocks. else if ( MODSERIAL_RX_BUFFER_EMPTY ) return -1;