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.
Dependencies: mbed
Fork of webserverBlinky by
Diff: main.cpp
- Revision:
- 21:66459cb32ce0
- Parent:
- 20:5db9b77b38a6
- Child:
- 22:00df34cd4d7e
--- a/main.cpp Mon Jan 02 17:32:47 2017 +0000 +++ b/main.cpp Mon Jan 02 17:38:08 2017 +0000 @@ -71,18 +71,15 @@ int pc_readable() // check if buffer has data { - __disable_irq(); // critical section start - int readable = (ppp.rx.head==ppp.rx.tail) ? 0 : 1 ; - __enable_irq(); // critical section end - return readable; + return (ppp.rx.head==ppp.rx.tail) ? 0 : 1 ; } int pc_getBuf() // get one character from the buffer { - if (pc_readable) { + if (ppp.rx.head!=ppp.rx.tail) { int x = ppp.rx.buf[ ppp.rx.tail ]; __disable_irq(); // critical section start - ppp.rx.tail=(ppp.rx.tail+1)&(BUFLEN-1); + ppp.rx.tail=(ppp.rx.tail+1)&(BUFLEN-1); // atomic operation __enable_irq(); // critical section end return x; } else return -1;