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.
Revision 40:5fa4b7c54c1d, committed 2013-10-25
- Comitter:
- mbed_official
- Date:
- Fri Oct 25 13:45:04 2013 +0100
- Parent:
- 39:6f0d2ff04ac3
- Child:
- 41:e8b66477f5bf
- Commit message:
- Synchronized with git revision 9d881770c95de5efecb420cd223375ebc93153b9
Changed in this revision
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/objects.h Fri Oct 25 13:30:04 2013 +0100 +++ b/targets/hal/TARGET_NXP/TARGET_LPC176X/objects.h Fri Oct 25 13:45:04 2013 +0100 @@ -47,6 +47,7 @@ struct serial_s { LPC_UART_TypeDef *uart; int index; + uint8_t count; }; struct analogin_s {
--- 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) {