Skip to content

Commit 9d7c537

Browse files
committed
cc3200/mods/pybi2c: Make readfnom_mem_into/writeto_mem return None.
This aligns the I2C class to match the standard machine.I2C API. Note that this is a (small) breaking change to the existing cc3200 API. The original API just returned the size of the input buffer so there's no information lost by this change. To update scripts users should just use the size of the buffer passed to these functions to get the number of bytes that are read/written.
1 parent daa5ba5 commit 9d7c537

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cc3200/mods/pybi2c.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ STATIC mp_obj_t pyb_i2c_readfrom_mem_into(mp_uint_t n_args, const mp_obj_t *pos_
477477
// get the buffer to read into
478478
vstr_t vstr;
479479
pyb_i2c_readmem_into (args, &vstr);
480-
return mp_obj_new_int(vstr.len);
480+
return mp_const_none;
481481
}
482482
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_mem_into_obj, 1, pyb_i2c_readfrom_mem_into);
483483

@@ -501,8 +501,7 @@ STATIC mp_obj_t pyb_i2c_writeto_mem(mp_uint_t n_args, const mp_obj_t *pos_args,
501501

502502
// write the register address to write to.
503503
if (pyb_i2c_mem_write (i2c_addr, (byte *)&mem_addr, mem_addr_size, bufinfo.buf, bufinfo.len)) {
504-
// return the number of bytes written
505-
return mp_obj_new_int(bufinfo.len);
504+
return mp_const_none;
506505
}
507506

508507
mp_raise_OSError(MP_EIO);

0 commit comments

Comments
 (0)