@@ -78,8 +78,10 @@ def readinto(self, buf, *, start=0, end=None):
78
78
79
79
:param bytearray buffer: buffer to write into
80
80
:param int start: Index to start writing at
81
- :param int end: Index to write up to but not include
81
+ :param int end: Index to write up to but not include; if None, use ``len(buf)``
82
82
"""
83
+ if end is None :
84
+ end = len (buf )
83
85
self .i2c .readfrom_into (self .device_address , buf , start = start , end = end )
84
86
85
87
def write (self , buf , * , start = 0 , end = None , stop = True ):
@@ -93,9 +95,11 @@ def write(self, buf, *, start=0, end=None, stop=True):
93
95
94
96
:param bytearray buffer: buffer containing the bytes to write
95
97
:param int start: Index to start writing from
96
- :param int end: Index to read up to but not include
98
+ :param int end: Index to read up to but not include; if None, use ``len(buf)``
97
99
:param bool stop: If true, output an I2C stop condition after the buffer is written
98
100
"""
101
+ if end is None :
102
+ end = len (buf )
99
103
self .i2c .writeto (self .device_address , buf , start = start , end = end , stop = stop )
100
104
101
105
#pylint: disable-msg=too-many-arguments
@@ -119,9 +123,9 @@ def write_then_readinto(self, out_buffer, in_buffer, *,
119
123
:param bytearray out_buffer: buffer containing the bytes to write
120
124
:param bytearray in_buffer: buffer containing the bytes to read into
121
125
:param int out_start: Index to start writing from
122
- :param int out_end: Index to read up to but not include
126
+ :param int out_end: Index to read up to but not include; if None, use ``len(out_buffer)``
123
127
:param int in_start: Index to start writing at
124
- :param int in_end: Index to write up to but not include
128
+ :param int in_end: Index to write up to but not include; if None, use ``len(in_buffer)``
125
129
:param bool stop: Deprecated
126
130
"""
127
131
if out_end is None :
0 commit comments