mbed library sources. Supersedes mbed-src.

Dependents:   BREAK_SENSOR_LED

Fork of mbed-dev by mbed official

Revision:
177:d650f5d4c87a
Parent:
170:19eb464bc2be
--- a/targets/TARGET_STM/i2c_api.c	Wed Oct 25 14:53:38 2017 +0100
+++ b/targets/TARGET_STM/i2c_api.c	Wed Nov 08 13:50:44 2017 +0000
@@ -743,8 +743,10 @@
     int count = I2C_ERROR_BUS_BUSY, ret = 0;
     uint32_t timeout = 0;
 
-    if ((obj_s->XferOperation == I2C_FIRST_AND_LAST_FRAME) ||
-        (obj_s->XferOperation == I2C_LAST_FRAME)) {
+    // Trick to remove compiler warning "left and right operands are identical" in some cases
+    uint32_t op1 = I2C_FIRST_AND_LAST_FRAME;
+    uint32_t op2 = I2C_LAST_FRAME;
+    if ((obj_s->XferOperation == op1) || (obj_s->XferOperation == op2)) {
         if (stop)
             obj_s->XferOperation = I2C_FIRST_AND_LAST_FRAME;
         else
@@ -795,8 +797,10 @@
     int count = I2C_ERROR_BUS_BUSY, ret = 0;
     uint32_t timeout = 0;
 
-    if ((obj_s->XferOperation == I2C_FIRST_AND_LAST_FRAME) ||
-        (obj_s->XferOperation == I2C_LAST_FRAME)) {
+    // Trick to remove compiler warning "left and right operands are identical" in some cases
+    uint32_t op1 = I2C_FIRST_AND_LAST_FRAME;
+    uint32_t op2 = I2C_LAST_FRAME;
+    if ((obj_s->XferOperation == op1) || (obj_s->XferOperation == op2)) {
         if (stop)
             obj_s->XferOperation = I2C_FIRST_AND_LAST_FRAME;
         else
@@ -1083,8 +1087,10 @@
 
     /* Set operation step depending if stop sending required or not */
     if ((tx_length && !rx_length) || (!tx_length && rx_length)) {
-        if ((obj_s->XferOperation == I2C_FIRST_AND_LAST_FRAME) ||
-            (obj_s->XferOperation == I2C_LAST_FRAME)) {
+        // Trick to remove compiler warning "left and right operands are identical" in some cases
+        uint32_t op1 = I2C_FIRST_AND_LAST_FRAME;
+        uint32_t op2 = I2C_LAST_FRAME;
+        if ((obj_s->XferOperation == op1) || (obj_s->XferOperation == op2)) {
             if (stop)
                 obj_s->XferOperation = I2C_FIRST_AND_LAST_FRAME;
             else
@@ -1106,8 +1112,10 @@
     }
     else if (tx_length && rx_length) {
         /* Two steps operation, don't modify XferOperation, keep it for next step */
-        if ((obj_s->XferOperation == I2C_FIRST_AND_LAST_FRAME) ||
-            (obj_s->XferOperation == I2C_LAST_FRAME)) {
+        // Trick to remove compiler warning "left and right operands are identical" in some cases
+        uint32_t op1 = I2C_FIRST_AND_LAST_FRAME;
+        uint32_t op2 = I2C_LAST_FRAME;
+        if ((obj_s->XferOperation == op1) || (obj_s->XferOperation == op2)) {
                 HAL_I2C_Master_Sequential_Transmit_IT(handle, address, (uint8_t*)tx, tx_length, I2C_FIRST_FRAME);
         } else if ((obj_s->XferOperation == I2C_FIRST_FRAME) ||
             (obj_s->XferOperation == I2C_NEXT_FRAME)) {