Skip to content

Commit 4b6e029

Browse files
committed
Remove stop kwarg from I2C writeto.
Fixes #2082
1 parent bca89c2 commit 4b6e029

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

shared-bindings/bitbangio/I2C.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 3, bitbangio_i2c_rea
232232
//| :param int address: 7-bit device address
233233
//| :param bytearray buffer: buffer containing the bytes to write
234234
//| :param int start: Index to start writing from
235-
//| :param int end: Index to read up to but not include
236-
//| :param bool stop: If true, output an I2C stop condition after the buffer is written.
237-
//| Deprecated. Will be removed in 6.x and act as stop=True."""
235+
//| :param int end: Index to read up to but not include"""
238236
//| ...
239237
//|
240238
// Shared arg parsing for writeto and writeto_then_readfrom.
@@ -256,13 +254,12 @@ STATIC void writeto(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer
256254
}
257255

258256
STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
259-
enum { ARG_address, ARG_buffer, ARG_start, ARG_end, ARG_stop };
257+
enum { ARG_address, ARG_buffer, ARG_start, ARG_end };
260258
static const mp_arg_t allowed_args[] = {
261259
{ MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
262260
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
263261
{ MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
264262
{ MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} },
265-
{ MP_QSTR_stop, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} },
266263
};
267264
bitbangio_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
268265
check_for_deinit(self);
@@ -271,7 +268,7 @@ STATIC mp_obj_t bitbangio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, m
271268
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
272269

273270
writeto(self, args[ARG_address].u_int, args[ARG_buffer].u_obj, args[ARG_start].u_int,
274-
args[ARG_end].u_int, args[ARG_stop].u_bool);
271+
args[ARG_end].u_int, true);
275272
return mp_const_none;
276273
}
277274
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_writeto);

shared-bindings/busio/I2C.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,8 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args,
229229
MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_into);
230230

231231
//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = None, stop: bool = True) -> None:
232-
//| """Write the bytes from ``buffer`` to the device selected by ``address``.
233-
//| Transmits a stop bit when stop is True. Setting stop=False is deprecated and stop will be
234-
//| removed in CircuitPython 6.x. Use `writeto_then_readfrom` when needing a write, no stop and
235-
//| repeated start before a read.
232+
//| """Write the bytes from ``buffer`` to the device selected by ``address`` and
233+
//| then transmit a stop bit.
236234
//|
237235
//| If ``start`` or ``end`` is provided, then the buffer will be sliced
238236
//| as if ``buffer[start:end]``. This will not cause an allocation like
@@ -244,9 +242,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 3, busio_i2c_readfrom_in
244242
//| :param int address: 7-bit device address
245243
//| :param bytearray buffer: buffer containing the bytes to write
246244
//| :param int start: Index to start writing from
247-
//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``
248-
//| :param bool stop: If true, output an I2C stop condition after the buffer is written.
249-
//| Deprecated. Will be removed in 6.x and act as stop=True."""
245+
//| :param int end: Index to read up to but not include. Defaults to ``len(buffer)``"""
250246
//| ...
251247
//|
252248
// Shared arg parsing for writeto and writeto_then_readfrom.
@@ -267,13 +263,12 @@ STATIC void writeto(busio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, in
267263
}
268264

269265
STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
270-
enum { ARG_address, ARG_buffer, ARG_start, ARG_end, ARG_stop };
266+
enum { ARG_address, ARG_buffer, ARG_start, ARG_end };
271267
static const mp_arg_t allowed_args[] = {
272268
{ MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} },
273269
{ MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
274270
{ MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
275271
{ MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} },
276-
{ MP_QSTR_stop, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} },
277272
};
278273
busio_i2c_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
279274
check_for_deinit(self);
@@ -282,7 +277,7 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma
282277
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
283278

284279
writeto(self, args[ARG_address].u_int, args[ARG_buffer].u_obj, args[ARG_start].u_int,
285-
args[ARG_end].u_int, args[ARG_stop].u_bool);
280+
args[ARG_end].u_int, true);
286281
return mp_const_none;
287282
}
288283
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto);

0 commit comments

Comments
 (0)