File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 77
88
99setup (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
You can’t perform that action at this time.
0 commit comments