Skip to content

Commit 4be562b

Browse files
authored
Merge pull request #27 from adafruit/spi_mag_auto_incr
fixing spi mag reads
2 parents 4b49fd4 + 8303bc4 commit 4be562b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

adafruit_lsm9ds1.py

+2
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
_MAGTYPE = True
122122
_XGTYPE = False
123123
_SENSORS_GRAVITY_STANDARD = 9.80665
124+
_SPI_AUTO_INCR = 0x40
124125

125126
# User facing constants/module globals.
126127
ACCELRANGE_2G = 0b00 << 3
@@ -465,6 +466,7 @@ def _read_u8(self, sensor_type, address):
465466
def _read_bytes(self, sensor_type, address, count, buf):
466467
if sensor_type == _MAGTYPE:
467468
device = self._mag_device
469+
address |= _SPI_AUTO_INCR
468470
else:
469471
device = self._xg_device
470472
with device as spi:

0 commit comments

Comments
 (0)