Skip to content

Commit 102accb

Browse files
committed
iodevices.LWP3Device: return bytes written
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.
1 parent 1641df5 commit 102accb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pybricks/iodevices/pb_type_iodevices_lwp3device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ STATIC mp_obj_t lwp3device_write(mp_obj_t self_in, mp_obj_t buf_in) {
176176
pbdrv_bluetooth_write_remote(&lwp3device->task, &msg.value);
177177
pb_wait_task(&lwp3device->task, -1);
178178

179-
return mp_const_none;
179+
return MP_OBJ_NEW_SMALL_INT(bufinfo.len);
180180
}
181181
STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwp3device_write_obj, lwp3device_write);
182182

0 commit comments

Comments
 (0)