Skip to content

Commit

Permalink
iodevices.LWP3Device: return bytes written
Browse files Browse the repository at this point in the history
This changes the return value of the LWP3Device.write() method to return
the number of bytes written. This makes it compatible with other Python
write() functions and reserves returning None for a possible future
non-blocking write.
  • Loading branch information
dlech committed Aug 30, 2021
1 parent 1641df5 commit 102accb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pybricks/iodevices/pb_type_iodevices_lwp3device.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ STATIC mp_obj_t lwp3device_write(mp_obj_t self_in, mp_obj_t buf_in) {
pbdrv_bluetooth_write_remote(&lwp3device->task, &msg.value);
pb_wait_task(&lwp3device->task, -1);

return mp_const_none;
return MP_OBJ_NEW_SMALL_INT(bufinfo.len);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwp3device_write_obj, lwp3device_write);

Expand Down

0 comments on commit 102accb

Please sign in to comment.