mbed library sources

Fork of mbed-src by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Wed Oct 15 10:15:06 2014 +0100
Parent:
349:c3cf33937977
Child:
351:1b8acea4af63
Commit message:
Synchronized with git revision dd973760c17d8a426faa44eaed5cc5247a1d5787

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

HAL : [LPC824] Fix I2C return value

Changed in this revision

targets/hal/TARGET_NXP/TARGET_LPC82X/i2c_api.c Show annotated file Show diff for this revision Revisions of this file
--- a/targets/hal/TARGET_NXP/TARGET_LPC82X/i2c_api.c	Wed Oct 15 07:15:06 2014 +0100
+++ b/targets/hal/TARGET_NXP/TARGET_LPC82X/i2c_api.c	Wed Oct 15 10:15:06 2014 +0100
@@ -228,7 +228,7 @@
     memcpy(data, buf + 1, i2c_result.n_bytes_recd);
     free(buf);
     if (err == 0)
-        return i2c_result.n_bytes_recd;
+        return i2c_result.n_bytes_recd - 1;
     else
         return -1;
 }
@@ -248,7 +248,7 @@
     err = LPC_I2CD_API->i2c_master_transmit_poll(obj->handler, &i2c_param, &i2c_result);
     free(buf);
     if (err == 0)
-        return i2c_result.n_bytes_sent;
+        return i2c_result.n_bytes_sent - 1;
     else
         return -1;
 }
@@ -282,7 +282,7 @@
 
 #if DEVICE_I2CSLAVE
 
-	void i2c_slave_mode(i2c_t *obj, int enable_slave)
+void i2c_slave_mode(i2c_t *obj, int enable_slave)
 {
     obj->handler = LPC_I2CD_API->i2c_setup((uint32_t)(obj->i2c), i2c_buffer);
     if (enable_slave != 0) {