Skip to content

Commit

Permalink
Merge pull request #27 from adafruit/spi_mag_auto_incr
Browse files Browse the repository at this point in the history
fixing spi mag reads
  • Loading branch information
ladyada committed Dec 21, 2020
2 parents 4b49fd4 + 8303bc4 commit 4be562b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions adafruit_lsm9ds1.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
_MAGTYPE = True
_XGTYPE = False
_SENSORS_GRAVITY_STANDARD = 9.80665
_SPI_AUTO_INCR = 0x40

# User facing constants/module globals.
ACCELRANGE_2G = 0b00 << 3
Expand Down Expand Up @@ -465,6 +466,7 @@ def _read_u8(self, sensor_type, address):
def _read_bytes(self, sensor_type, address, count, buf):
if sensor_type == _MAGTYPE:
device = self._mag_device
address |= _SPI_AUTO_INCR
else:
device = self._xg_device
with device as spi:
Expand Down

0 comments on commit 4be562b

Please sign in to comment.