mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Revision:
15:4892fe388435
Parent:
13:0645d8841f51
Child:
18:692be3d4e4cc
--- a/targets/hal/TARGET_Freescale/TARGET_KL25Z/i2c_api.c	Mon Aug 05 14:54:27 2013 +0000
+++ b/targets/hal/TARGET_Freescale/TARGET_KL25Z/i2c_api.c	Wed Aug 07 16:43:59 2013 +0300
@@ -25,6 +25,9 @@
     {PTE0,  I2C_1, 6},
     {PTB1,  I2C_0, 2},
     {PTB3,  I2C_0, 2},
+    {PTC11, I2C_1, 2},
+    {PTC2,  I2C_1, 2},
+    {PTA4,  I2C_1, 2},
     {NC  ,  NC   , 0}
 };
 
@@ -34,6 +37,8 @@
     {PTE1,  I2C_1, 6},
     {PTB0,  I2C_0, 2},
     {PTB2,  I2C_0, 2},
+    {PTC10, I2C_1, 2},
+    {PTC1,  I2C_1, 2},
     {NC  ,  NC,    0}
 };
 
@@ -84,10 +89,18 @@
 }
 
 int i2c_start(i2c_t *obj) {
+    uint8_t temp;
+    volatile int i;
     // if we are in the middle of a transaction
     // activate the repeat_start flag
     if (obj->i2c->S & I2C_S_BUSY_MASK) {
+        // KL25Z errata sheet: repeat start cannot be generated if the
+        // I2Cx_F[MULT] field is set to a non-zero value
+        temp = obj->i2c->F >> 6;
+        obj->i2c->F &= 0x3F;
         obj->i2c->C1 |= 0x04;
+        for (i = 0; i < 100; i ++) __NOP();
+        obj->i2c->F |= temp << 6;
     } else {
         obj->i2c->C1 |= I2C_C1_MST_MASK;
         obj->i2c->C1 |= I2C_C1_TX_MASK;