summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-04-18 15:31:08 +1000
committerDamien George <damien.p.george@gmail.com>2017-04-18 15:31:08 +1000
commit9d7c53734c5eee6b4fbcc18be59148bbdaf95a1d (patch)
tree042a19c0b7dda240327078cef153c6e1eee3ddc9
parentdaa5ba5629c8211a3f13e3854acea0bc36071f56 (diff)
downloadmicropython-9d7c53734c5eee6b4fbcc18be59148bbdaf95a1d.tar.gz
micropython-9d7c53734c5eee6b4fbcc18be59148bbdaf95a1d.zip
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.
-rw-r--r--cc3200/mods/pybi2c.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/cc3200/mods/pybi2c.c b/cc3200/mods/pybi2c.c
index b2e536056b..9fc97d9140 100644
--- a/cc3200/mods/pybi2c.c
+++ b/cc3200/mods/pybi2c.c
@@ -477,7 +477,7 @@ STATIC mp_obj_t pyb_i2c_readfrom_mem_into(mp_uint_t n_args, const mp_obj_t *pos_
// get the buffer to read into
vstr_t vstr;
pyb_i2c_readmem_into (args, &vstr);
- return mp_obj_new_int(vstr.len);
+ return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_i2c_readfrom_mem_into_obj, 1, pyb_i2c_readfrom_mem_into);
@@ -501,8 +501,7 @@ STATIC mp_obj_t pyb_i2c_writeto_mem(mp_uint_t n_args, const mp_obj_t *pos_args,
// write the register address to write to.
if (pyb_i2c_mem_write (i2c_addr, (byte *)&mem_addr, mem_addr_size, bufinfo.buf, bufinfo.len)) {
- // return the number of bytes written
- return mp_obj_new_int(bufinfo.len);
+ return mp_const_none;
}
mp_raise_OSError(MP_EIO);