mbed library sources. Supersedes mbed-src. GR-PEACH runs on RAM.

Fork of mbed-dev by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Thu Feb 25 10:15:11 2016 +0000
Parent:
71:a5b1c83f05dc
Child:
73:5d67568caa8f
Commit message:
Synchronized with git revision fb3928665ae03debffa9c1dd0be6e0dad00de04c

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

[MAX32600MBED MAXWSNENV] Fixing the return for i2c_byte_write.

Changed in this revision

targets/hal/TARGET_Maxim/TARGET_MAX32600/i2c_api.c Show annotated file Show diff for this revision Revisions of this file
targets/hal/TARGET_Maxim/TARGET_MAX32610/i2c_api.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/hal/TARGET_Maxim/TARGET_MAX32600/i2c_api.c	Thu Feb 25 09:45:11 2016 +0000
+++ b/targets/hal/TARGET_Maxim/TARGET_MAX32600/i2c_api.c	Thu Feb 25 10:15:11 2016 +0000
@@ -227,6 +227,17 @@
 
     obj->i2c->trans |= MXC_F_I2CM_TRANS_TX_START;
 
+    // Wait for the FIFO to be empty
+    while(!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY)) {}
+
+    if(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_NACKED) {
+        return 1;
+    }
+
+    if(obj->i2c->intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR)) {
+        return 2;
+    }
+    
     return 0;
 }
 
--- a/targets/hal/TARGET_Maxim/TARGET_MAX32610/i2c_api.c	Thu Feb 25 09:45:11 2016 +0000
+++ b/targets/hal/TARGET_Maxim/TARGET_MAX32610/i2c_api.c	Thu Feb 25 10:15:11 2016 +0000
@@ -227,6 +227,17 @@
 
     obj->i2c->trans |= MXC_F_I2CM_TRANS_TX_START;
 
+    // Wait for the FIFO to be empty
+    while(!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY)) {}
+
+    if(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_NACKED) {
+        return 1;
+    }
+
+    if(obj->i2c->intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR)) {
+        return 2;
+    }
+
     return 0;
 }