mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Revision:
177:d57c40a064c8
Parent:
104:a6a92e2e5a92
Child:
227:7bd0639b8911
--- a/targets/hal/TARGET_NORDIC/TARGET_NRF51822/i2c_api.c	Tue Apr 29 17:15:06 2014 +0100
+++ b/targets/hal/TARGET_NORDIC/TARGET_NRF51822/i2c_api.c	Thu May 01 13:00:08 2014 +0100
@@ -128,16 +128,17 @@
 
 int i2c_do_read(i2c_t *obj, char * data, int last) {
     int timeOut = 100000;
+
+    if (last){
+        obj->i2c->TASKS_STOP = 1;
+    }
     while(!obj->i2c->EVENTS_RXDREADY){
         timeOut--;
         if(timeOut<0)
             return 1;
     }
     obj->i2c->EVENTS_RXDREADY       = 0;
-
-    if (last){
-        obj->i2c->TASKS_STOP = 1;
-    }
+    
     *data = obj->i2c->RXD;
     
     for(int i=0;i<320;i++){