This line of code was giving me an error
Code: Select all
self._i2c.readfrom_into(self._addr, mvarray[start:end], stop=stop)
Code: Select all
self._i2c.readfrom_into(self._addr, mvarray[start:end]) #, stop=stop)
From https://docs.micropython.org/en/latest/ ... e.I2C.html
I2C.readfrom_into(addr, buf, stop=True, /)
Read into buf from the slave specified by addr. The number of bytes read will be the length of buf. If stop is true then a STOP condition is generated at the end of the transfer.
The method returns None.
code
There is nothing here to deal with the stop=stop keyword parameter.
Code: Select all
STATIC mp_obj_t machine_i2c_readfrom_into(size_t n_args, const mp_obj_t *args) {
mp_obj_base_t *self = (mp_obj_base_t *)MP_OBJ_TO_PTR(args[0]);
mp_int_t addr = mp_obj_get_int(args[1]);
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_WRITE);
bool stop = (n_args == 3) ? true : mp_obj_is_true(args[3]);
int ret = mp_machine_i2c_readfrom(self, addr, bufinfo.buf, bufinfo.len, stop);
if (ret < 0) {
mp_raise_OSError(-ret);
}
return mp_const_none;
}