Skip to content

Commit 3778bfe

Browse files
force reading into temp register; bump version
1 parent e9fb6de commit 3778bfe

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

TMP1075/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ class TMP1075:
99
See datasheet: http://www.ti.com/lit/ds/symlink/tmp1075.pdf
1010
1111
"""
12+
TEMP_REGISTER = bytearray([0x00])
13+
CONFIG_REGISTER = bytearray([0x01])
14+
1215

1316
def __init__(self, address: int=0x4f):
14-
# Could check that addr is one of the valid values...
1517
comm_port = busio.I2C(board.SCL, board.SDA)
1618
self.i2c = I2CDevice(comm_port, address)
1719

1820
def get_temperature(self) -> float:
1921
b = bytearray(2)
20-
self.i2c.readinto(b)
21-
return ((b[0] << 4) + (b[1] >> 4)) * 0.0625
22+
self.i2c.write_then_readinto(self.TEMP_REGISTER, b)
23+
return ((b[0] << 4) + (b[1] >> 4)) * 0.0625

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
setup(name='TMP1075',
10-
version='0.2.0',
10+
version='0.2.1',
1111
description='A python wrapper for interacting with the TMP1075',
1212
author='Cam Davidson-Pilon',
1313
author_email='[email protected]',

0 commit comments

Comments
 (0)