@@ -725,8 +725,10 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop) {
725
725
int count = I2C_ERROR_BUS_BUSY , ret = 0 ;
726
726
uint32_t timeout = 0 ;
727
727
728
- if ((obj_s -> XferOperation == I2C_FIRST_AND_LAST_FRAME ) ||
729
- (obj_s -> XferOperation == I2C_LAST_FRAME )) {
728
+ // Trick to remove compiler warning "left and right operands are identical" in some cases
729
+ uint32_t op1 = I2C_FIRST_AND_LAST_FRAME ;
730
+ uint32_t op2 = I2C_LAST_FRAME ;
731
+ if ((obj_s -> XferOperation == op1 ) || (obj_s -> XferOperation == op2 )) {
730
732
if (stop )
731
733
obj_s -> XferOperation = I2C_FIRST_AND_LAST_FRAME ;
732
734
else
@@ -777,8 +779,10 @@ int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop) {
777
779
int count = I2C_ERROR_BUS_BUSY , ret = 0 ;
778
780
uint32_t timeout = 0 ;
779
781
780
- if ((obj_s -> XferOperation == I2C_FIRST_AND_LAST_FRAME ) ||
781
- (obj_s -> XferOperation == I2C_LAST_FRAME )) {
782
+ // Trick to remove compiler warning "left and right operands are identical" in some cases
783
+ uint32_t op1 = I2C_FIRST_AND_LAST_FRAME ;
784
+ uint32_t op2 = I2C_LAST_FRAME ;
785
+ if ((obj_s -> XferOperation == op1 ) || (obj_s -> XferOperation == op2 )) {
782
786
if (stop )
783
787
obj_s -> XferOperation = I2C_FIRST_AND_LAST_FRAME ;
784
788
else
@@ -1065,8 +1069,10 @@ void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx,
1065
1069
1066
1070
/* Set operation step depending if stop sending required or not */
1067
1071
if ((tx_length && !rx_length ) || (!tx_length && rx_length )) {
1068
- if ((obj_s -> XferOperation == I2C_FIRST_AND_LAST_FRAME ) ||
1069
- (obj_s -> XferOperation == I2C_LAST_FRAME )) {
1072
+ // Trick to remove compiler warning "left and right operands are identical" in some cases
1073
+ uint32_t op1 = I2C_FIRST_AND_LAST_FRAME ;
1074
+ uint32_t op2 = I2C_LAST_FRAME ;
1075
+ if ((obj_s -> XferOperation == op1 ) || (obj_s -> XferOperation == op2 )) {
1070
1076
if (stop )
1071
1077
obj_s -> XferOperation = I2C_FIRST_AND_LAST_FRAME ;
1072
1078
else
@@ -1088,8 +1094,10 @@ void i2c_transfer_asynch(i2c_t *obj, const void *tx, size_t tx_length, void *rx,
1088
1094
}
1089
1095
else if (tx_length && rx_length ) {
1090
1096
/* Two steps operation, don't modify XferOperation, keep it for next step */
1091
- if ((obj_s -> XferOperation == I2C_FIRST_AND_LAST_FRAME ) ||
1092
- (obj_s -> XferOperation == I2C_LAST_FRAME )) {
1097
+ // Trick to remove compiler warning "left and right operands are identical" in some cases
1098
+ uint32_t op1 = I2C_FIRST_AND_LAST_FRAME ;
1099
+ uint32_t op2 = I2C_LAST_FRAME ;
1100
+ if ((obj_s -> XferOperation == op1 ) || (obj_s -> XferOperation == op2 )) {
1093
1101
HAL_I2C_Master_Sequential_Transmit_IT (handle , address , (uint8_t * )tx , tx_length , I2C_FIRST_FRAME );
1094
1102
} else if ((obj_s -> XferOperation == I2C_FIRST_FRAME ) ||
1095
1103
(obj_s -> XferOperation == I2C_NEXT_FRAME )) {
0 commit comments