Skip to content

Commit 301d7f2

Browse files
committed
[MAX326xx] Fixed i2c_byte_write() return value.
1 parent 0e330ef commit 301d7f2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

hal/targets/hal/TARGET_Maxim/TARGET_MAX32600/i2c_api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,19 +228,19 @@ int i2c_byte_write(i2c_t *obj, int data)
228228
obj->i2c->trans |= MXC_F_I2CM_TRANS_TX_START;
229229

230230
// Wait for the FIFO to be empty
231-
while(!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY)) {}
231+
while (!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY));
232232

233233
if (obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_NACKED) {
234234
i2c_reset(obj);
235-
return 1;
235+
return 0;
236236
}
237237

238238
if (obj->i2c->intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR)) {
239239
i2c_reset(obj);
240240
return 2;
241241
}
242242

243-
return 0;
243+
return 1;
244244
}
245245

246246
int i2c_byte_read(i2c_t *obj, int last)

hal/targets/hal/TARGET_Maxim/TARGET_MAX32610/i2c_api.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* ownership rights.
3131
*******************************************************************************
3232
*/
33-
33+
3434
#include "mbed_assert.h"
3535
#include "i2c_api.h"
3636
#include "cmsis.h"
@@ -228,19 +228,19 @@ int i2c_byte_write(i2c_t *obj, int data)
228228
obj->i2c->trans |= MXC_F_I2CM_TRANS_TX_START;
229229

230230
// Wait for the FIFO to be empty
231-
while(!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY)) {}
231+
while (!(obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY));
232232

233233
if (obj->i2c->intfl & MXC_F_I2CM_INTFL_TX_NACKED) {
234234
i2c_reset(obj);
235-
return 1;
235+
return 0;
236236
}
237237

238238
if (obj->i2c->intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR)) {
239239
i2c_reset(obj);
240240
return 2;
241241
}
242242

243-
return 0;
243+
return 1;
244244
}
245245

246246
int i2c_byte_read(i2c_t *obj, int last)

0 commit comments

Comments
 (0)