Skip to content

Commit 9d65a53

Browse files
committed
Fix SPI buffer read_bytes to use passed in buffer.
1 parent ba60000 commit 9d65a53

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

adafruit_lsm9ds1.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -400,16 +400,16 @@ def _read_u8(self, sensor_type, address):
400400
spi.readinto(self._BUFFER, end=1)
401401
return self._BUFFER[0]
402402

403-
def _read_bytes(self, sensor_type, address, count, buffer):
403+
def _read_bytes(self, sensor_type, address, count, buf):
404404
if sensor_type == _MAGTYPE:
405405
device = self._mag_device
406406
else:
407407
device = self._xg_device
408408
with device as spi:
409409
spi.configure(baudrate=200000, phase=0, polarity=0)
410-
self._BUFFER[0] = (address | 0x80) & 0xFF
411-
spi.write(self._BUFFER, end=1)
412-
spi.readinto(self._BUFFER, end=count)
410+
buf[0] = (address | 0x80) & 0xFF
411+
spi.write(buf, end=1)
412+
spi.readinto(buf, end=count)
413413

414414
def _write_u8(self, sensor_type, address, val):
415415
if sensor_type == _MAGTYPE:

0 commit comments

Comments
 (0)