File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
libraries/mbed/targets/hal/TARGET_Maxim Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -227,6 +227,17 @@ int i2c_byte_write(i2c_t *obj, int data)
227
227
228
228
obj -> i2c -> trans |= MXC_F_I2CM_TRANS_TX_START ;
229
229
230
+ // Wait for the FIFO to be empty
231
+ while (!(obj -> i2c -> intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY )) {}
232
+
233
+ if (obj -> i2c -> intfl & MXC_F_I2CM_INTFL_TX_NACKED ) {
234
+ return 1 ;
235
+ }
236
+
237
+ if (obj -> i2c -> intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR )) {
238
+ return 2 ;
239
+ }
240
+
230
241
return 0 ;
231
242
}
232
243
Original file line number Diff line number Diff line change @@ -227,6 +227,17 @@ int i2c_byte_write(i2c_t *obj, int data)
227
227
228
228
obj -> i2c -> trans |= MXC_F_I2CM_TRANS_TX_START ;
229
229
230
+ // Wait for the FIFO to be empty
231
+ while (!(obj -> i2c -> intfl & MXC_F_I2CM_INTFL_TX_FIFO_EMPTY )) {}
232
+
233
+ if (obj -> i2c -> intfl & MXC_F_I2CM_INTFL_TX_NACKED ) {
234
+ return 1 ;
235
+ }
236
+
237
+ if (obj -> i2c -> intfl & (MXC_F_I2CM_INTFL_TX_TIMEOUT | MXC_F_I2CM_INTFL_TX_LOST_ARBITR )) {
238
+ return 2 ;
239
+ }
240
+
230
241
return 0 ;
231
242
}
232
243
You can’t perform that action at this time.
0 commit comments