@@ -86,7 +86,7 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_make_new(const mp_obj_type_t *type
8686 return (mp_obj_t )self ;
8787}
8888
89- //| def __enter__(self) -> I2C :
89+ //| def __enter__(self) -> I2CDevice :
9090//| """Context manager entry to lock bus."""
9191//| ...
9292//|
@@ -107,14 +107,13 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_obj___exit__(size_t n_args, const
107107}
108108STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (adafruit_bus_device_i2cdevice___exit___obj , 4 , 4 , adafruit_bus_device_i2cdevice_obj___exit__ );
109109
110- //| def readinto(self, buf, *, start=0, end=None) -> None:
111- //| """
112- //| Read into ``buf`` from the device. The number of bytes read will be the
110+ //| def readinto(self, buf: WriteableBuffer, *, start: int = 0, end: int = 0) -> None:
111+ //| """Read into ``buf`` from the device. The number of bytes read will be the
113112//| length of ``buf``.
114113//| If ``start`` or ``end`` is provided, then the buffer will be sliced
115114//| as if ``buf[start:end]``. This will not cause an allocation like
116115//| ``buf[start:end]`` will so it saves memory.
117- //| :param bytearray buffer : buffer to write into
116+ //| :param bytearray buf : buffer to write into
118117//| :param int start: Index to start writing at
119118//| :param int end: Index to write up to but not include; if None, use ``len(buf)``"""
120119//| ...
@@ -153,17 +152,16 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_readinto(size_t n_args, const mp_o
153152}
154153STATIC MP_DEFINE_CONST_FUN_OBJ_KW (adafruit_bus_device_i2cdevice_readinto_obj , 2 , adafruit_bus_device_i2cdevice_readinto );
155154
156- //| def write(self, buf, *, start=0, end=None) -> None:
157- //| """
158- //| Write the bytes from ``buffer`` to the device, then transmit a stop bit.
159- //| If ``start`` or ``end`` is provided, then the buffer will be sliced
160- //| as if ``buffer[start:end]``. This will not cause an allocation like
161- //| ``buffer[start:end]`` will so it saves memory.
162- //| :param bytearray buffer: buffer containing the bytes to write
163- //| :param int start: Index to start writing from
164- //| :param int end: Index to read up to but not include; if None, use ``len(buf)``
165- //| """
166- //| ...
155+ //| def write(self, buf: ReadableBuffer, *, start: int = 0, end: int = 0) -> None:
156+ //| """Write the bytes from ``buffer`` to the device, then transmit a stop bit.
157+ //| If ``start`` or ``end`` is provided, then the buffer will be sliced
158+ //| as if ``buffer[start:end]``. This will not cause an allocation like
159+ //| ``buffer[start:end]`` will so it saves memory.
160+ //| :param bytearray buf: buffer containing the bytes to write
161+ //| :param int start: Index to start writing from
162+ //| :param int end: Index to read up to but not include; if None, use ``len(buf)``
163+ //| """
164+ //| ...
167165//|
168166STATIC void write (adafruit_bus_device_i2cdevice_obj_t * self , mp_obj_t buffer , int32_t start , mp_int_t end ) {
169167 mp_buffer_info_t bufinfo ;
@@ -199,9 +197,8 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_
199197MP_DEFINE_CONST_FUN_OBJ_KW (adafruit_bus_device_i2cdevice_write_obj , 2 , adafruit_bus_device_i2cdevice_write );
200198
201199
202- //| def write_then_readinto(self, out_buffer, in_buffer, *, out_start=0, out_end=None, in_start=0, in_end=None) -> None:
203- //| """
204- //| Write the bytes from ``out_buffer`` to the device, then immediately
200+ //| def write_then_readinto(self, out_buffer: WriteableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: int = 0, in_start: int = 0, in_end: int = 0) -> None:
201+ //| """Write the bytes from ``out_buffer`` to the device, then immediately
205202//| reads into ``in_buffer`` from the device. The number of bytes read
206203//| will be the length of ``in_buffer``.
207204//| If ``out_start`` or ``out_end`` is provided, then the output buffer
0 commit comments