Use standard validation function
This commit is contained in:
parent
6be0a425c7
commit
530e5a1df2
|
@ -344,9 +344,7 @@ STATIC mp_obj_t busio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *p
|
|||
int32_t in_start = args[ARG_in_start].u_int;
|
||||
const int32_t in_end = args[ARG_in_end].u_int;
|
||||
normalize_buffer_bounds(&in_start, in_end, &in_length);
|
||||
if (in_length == 0) {
|
||||
mp_raise_ValueError_varg(translate("%q length must be >= %d"), MP_QSTR_out_buffer, 1);
|
||||
}
|
||||
mp_arg_validate_length_min(in_length, 1, MP_QSTR_out_buffer);
|
||||
|
||||
uint8_t status = common_hal_busio_i2c_write_read(self, args[ARG_address].u_int,
|
||||
((uint8_t *)out_bufinfo.buf) + out_start, out_length,((uint8_t *)in_bufinfo.buf) + in_start, in_length);
|
||||
|
|
Loading…
Reference in New Issue