Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions adafruit_mlx90393.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,15 +406,12 @@ def read_reg(self, reg: int) -> int:

:param int reg: The register to read
"""
# Write 'value' to the specified register
# Read register
payload = bytes([_CMD_RR, reg << 2])
with self.i2c_device as i2c:
i2c.write(payload)

# Read the response (+1 to account for the mandatory status byte!)
data = bytearray(3)
with self.i2c_device as i2c:
i2c.readinto(data)
i2c.write_then_readinto(payload, data)

# Unpack data (status byte, big-endian 16-bit register value)
self._status_last, val = struct.unpack(">BH", data)
if self._debug:
Expand Down