mbed library with additional peripherals for ST F401 board

Fork of mbed-src by mbed official

This mbed LIB has additional peripherals for ST F401 board

  • UART2 : PA_3 rx, PA_2 tx
  • UART3 : PC_7 rx, PC_6 tx
  • I2C2 : PB_3 SDA, PB_10 SCL
  • I2C3 : PB_4 SDA, PA_8 SCL

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Tue Mar 04 10:00:07 2014 +0000
Parent:
108:4cb9db2ced35
Child:
110:410346174f7a
Commit message:
Synchronized with git revision e4faeb42a7013bfc4d1dccf0a6d905d10aca5c00

Full URL: https://github.com/mbedmicro/mbed/commit/e4faeb42a7013bfc4d1dccf0a6d905d10aca5c00/

Update of cellular modem

Changed in this revision

targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c	Mon Mar 03 11:15:08 2014 +0000
+++ b/targets/hal/TARGET_NXP/TARGET_LPC176X/serial_api.c	Tue Mar 04 10:00:07 2014 +0000
@@ -76,7 +76,7 @@
 struct serial_global_data_s {
     uint32_t serial_irq_id;
     gpio_t sw_rts, sw_cts;
-    uint8_t rx_irq_set_flow, rx_irq_set_api;
+    uint8_t count, rx_irq_set_flow, rx_irq_set_api;
 };
 
 static struct serial_global_data_s uart_data[UART_NUM];
@@ -357,6 +357,7 @@
 void serial_putc(serial_t *obj, int c) {
     while (!serial_writable(obj));
     obj->uart->THR = c;
+    uart_data[obj->index].count++;    
 }
 
 int serial_readable(serial_t *obj) {
@@ -364,10 +365,16 @@
 }
 
 int serial_writable(serial_t *obj) {
+    int isWritable = 1;
     if (NC != uart_data[obj->index].sw_cts.pin)
-        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
+        isWritable = (gpio_read(&uart_data[obj->index].sw_cts) == 0) && (obj->uart->LSR & 0x40);
+    else {
+        if (obj->uart->LSR & 0x20)
+            uart_data[obj->index].count = 0;
+        else if (uart_data[obj->index].count >= 16)
+            isWritable = 0;
+    }
+    return isWritable;
 }
 
 void serial_clear(serial_t *obj) {