My fork

Dependencies:   BLE_API mbed-dev-bin nRF51822-bluetooth-mdw

Fork of microbit-dal-bluetooth-mdw by Martin Woolley

Revision:
46:c5bb7af0a3f0
Parent:
25:27299423d813
Child:
59:d73a257e9f89
--- a/source/drivers/MicroBitSerial.cpp	Wed Jul 13 12:18:24 2016 +0100
+++ b/source/drivers/MicroBitSerial.cpp	Wed Jul 13 12:18:25 2016 +0100
@@ -489,9 +489,17 @@
             return result;
     }
 
-    int bytesWritten = setTxInterrupt(buffer, bufferLen, mode);
+    bool complete = false;
+    int bytesWritten = 0;
 
-    send(mode);
+    while(!complete)
+    {
+        bytesWritten += setTxInterrupt(buffer + bytesWritten, bufferLen - bytesWritten, mode);
+        send(mode);
+
+        if(mode == ASYNC || bytesWritten >= bufferLen)
+            complete = true;
+    }
 
     unlockTx();