Merge pull request #7731 from kreasteve/statemachine_run_fix

Statemachine run fix
This commit is contained in:
Jeff Epler 2023-03-19 20:47:09 -05:00 committed by GitHub
commit 3ac696e7ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -341,7 +341,10 @@ STATIC mp_obj_t rp2pio_statemachine_run(mp_obj_t self_obj, mp_obj_t instruction_
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(instruction_obj, &bufinfo, MP_BUFFER_READ);
common_hal_rp2pio_statemachine_run(self, bufinfo.buf, bufinfo.len);
if (bufinfo.len % 2 != 0) {
mp_raise_ValueError(translate("Program size invalid"));
}
common_hal_rp2pio_statemachine_run(self, bufinfo.buf, (size_t)bufinfo.len / 2);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(rp2pio_statemachine_run_obj, rp2pio_statemachine_run);