mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c
- Revision:
- 108:4cb9db2ced35
- Parent:
- 64:7b352733b00a
- Child:
- 109:bc5f94f2a67f
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c Thu Feb 27 09:45:07 2014 +0000 +++ b/targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c Mon Mar 03 11:15:08 2014 +0000 @@ -364,12 +364,10 @@ } int serial_writable(serial_t *obj) { - int isWritable = 1; if (NC != uart_data[obj->index].sw_cts.pin) - isWritable = gpio_read(&uart_data[obj->index].sw_cts) == 0; - if (isWritable) - isWritable = obj->uart->LSR & 0x40; - return isWritable; + return (gpio_read(&uart_data[obj->index].sw_cts) == 0) && (obj->uart->LSR & 0x40); //If flow control: writable if CTS low + UART done + else + return obj->uart->LSR & 0x20; //No flow control: writable if space in holding register } void serial_clear(serial_t *obj) {