@@ -113,12 +113,11 @@ def write(self, buf, **kwargs):
113
113
114
114
#pylint: disable-msg=too-many-arguments
115
115
def write_then_readinto (self , out_buffer , in_buffer , * ,
116
- out_start = 0 , out_end = None , in_start = 0 , in_end = None , stop = True ):
116
+ out_start = 0 , out_end = None , in_start = 0 , in_end = None , stop = False ):
117
117
"""
118
118
Write the bytes from ``out_buffer`` to the device, then immediately
119
119
reads into ``in_buffer`` from the device. The number of bytes read
120
120
will be the length of ``in_buffer``.
121
- Transmits a stop bit after the write, if ``stop`` is set.
122
121
123
122
If ``out_start`` or ``out_end`` is provided, then the output buffer
124
123
will be sliced as if ``out_buffer[out_start:out_end]``. This will
@@ -136,21 +135,23 @@ def write_then_readinto(self, out_buffer, in_buffer, *,
136
135
:param int out_end: Index to read up to but not include
137
136
:param int in_start: Index to start writing at
138
137
:param int in_end: Index to write up to but not include
139
- :param bool stop: If true, output an I2C stop condition after the buffer is written
138
+ :param bool stop: Deprecated
140
139
"""
141
140
if out_end is None :
142
141
out_end = len (out_buffer )
143
142
if in_end is None :
144
143
in_end = len (in_buffer )
144
+ if stop :
145
+ raise ValueError ("Stop must be False. Use writeto instead." )
145
146
if hasattr (self .i2c , 'writeto_then_readfrom' ):
146
147
# In linux, at least, this is a special kernel function call
147
148
self .i2c .writeto_then_readfrom (self .device_address , out_buffer , in_buffer ,
148
149
out_start = out_start , out_end = out_end ,
149
- in_start = in_start , in_end = in_end , stop = stop )
150
+ in_start = in_start , in_end = in_end )
150
151
151
152
else :
152
153
# If we don't have a special implementation, we can fake it with two calls
153
- self .write (out_buffer , start = out_start , end = out_end , stop = stop )
154
+ self .write (out_buffer , start = out_start , end = out_end , stop = False )
154
155
self .readinto (in_buffer , start = in_start , end = in_end )
155
156
156
157
#pylint: enable-msg=too-many-arguments
0 commit comments