Browse Source

extmod/machine_i2c: Make i2c.write[to] methods return num of ACKs recvd.

pull/2652/head
Damien George 8 years ago
parent
commit
0bc99b4836
  1. 6
      extmod/machine_i2c.c

6
extmod/machine_i2c.c

@ -387,7 +387,8 @@ STATIC mp_obj_t machine_i2c_write(mp_obj_t self_in, mp_obj_t buf_in) {
mp_raise_OSError(-ret);
}
return mp_const_none;
// return number of acks received
return MP_OBJ_NEW_SMALL_INT(ret);
}
MP_DEFINE_CONST_FUN_OBJ_2(machine_i2c_write_obj, machine_i2c_write);
@ -426,7 +427,8 @@ STATIC mp_obj_t machine_i2c_writeto(mp_obj_t self_in, mp_obj_t addr_in, mp_obj_t
if (ret < 0) {
mp_raise_OSError(-ret);
}
return mp_const_none;
// return number of acks received
return MP_OBJ_NEW_SMALL_INT(ret);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(machine_i2c_writeto_obj, machine_i2c_writeto);

Loading…
Cancel
Save