mbed library sources
Dependents: Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more
Superseded
This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.
Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.
If you are looking for a stable and tested release, please import one of the official mbed library releases:
Import librarymbed
The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Diff: targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c
- Revision:
- 40:5fa4b7c54c1d
- Parent:
- 20:4263a77256ae
- Child:
- 51:7838415c99e7
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c Fri Oct 25 13:30:04 2013 +0100 +++ b/targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c Fri Oct 25 13:45:04 2013 +0100 @@ -106,6 +106,7 @@ case UART_2: obj->index = 2; break; case UART_3: obj->index = 3; break; } + obj->count = 0; is_stdio_uart = (uart == STDIO_UART) ? (1) : (0); @@ -283,6 +284,7 @@ void serial_putc(serial_t *obj, int c) { while (!serial_writable(obj)); obj->uart->THR = c; + obj->count++; } int serial_readable(serial_t *obj) { @@ -290,7 +292,13 @@ } int serial_writable(serial_t *obj) { - return obj->uart->LSR & 0x20; + int isWritable = 1; + if (obj->uart->LSR & 0x20) + obj->count = 0; + else if (obj->count >= 16) + isWritable = 0; + + return isWritable; } void serial_clear(serial_t *obj) {