adafruit-circuitpython-mlx90393 2.0.16__py3-none-any.whl → 2.1.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: adafruit-circuitpython-mlx90393
3
- Version: 2.0.16
3
+ Version: 2.1.1
4
4
  Summary: CircuitPython driver for the MLX90393 3-axis magnetometer.
5
5
  Author-email: Adafruit Industries <circuitpython@adafruit.com>
6
6
  License: MIT
@@ -0,0 +1,6 @@
1
+ adafruit_mlx90393.py,sha256=ls4dDN69KTdQ_hZbS-nzRSyGzcPTjVnRMOoAlUdOC0Q,18430
2
+ adafruit_circuitpython_mlx90393-2.1.1.dist-info/LICENSE,sha256=WeIXVkYWpdba3Boxrax8dB0s5qWg9GTxl7c5uTZQDUI,1105
3
+ adafruit_circuitpython_mlx90393-2.1.1.dist-info/METADATA,sha256=cSNROXfcy70NdhQZ3S-n5NTr9QY44rvPqD7aEmSQ78I,4087
4
+ adafruit_circuitpython_mlx90393-2.1.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
5
+ adafruit_circuitpython_mlx90393-2.1.1.dist-info/top_level.txt,sha256=5RT_YbHfXFo2Y6zVvz8MXsZLIHm1OxrjFJrzRaCTdNY,18
6
+ adafruit_circuitpython_mlx90393-2.1.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.38.4)
2
+ Generator: bdist_wheel (0.40.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
adafruit_mlx90393.py CHANGED
@@ -41,7 +41,7 @@ try:
41
41
  except ImportError:
42
42
  pass
43
43
 
44
- __version__ = "2.0.16"
44
+ __version__ = "2.1.1"
45
45
  __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MLX90393.git"
46
46
 
47
47
  _CMD_SB = const(0b00010000) # Start burst mode
@@ -57,6 +57,7 @@ _CMD_RT = const(0b11110000) # Reset
57
57
  _CMD_NOP = const(0x00) # NOP
58
58
 
59
59
  _CMD_AXIS_ALL = const(0xE) # X+Y+Z axis bits for commands
60
+ _CMD_TEMP = const(0x01) # Temperature bit for commands
60
61
 
61
62
  _CMD_REG_CONF1 = const(0x00) # Gain
62
63
  _CMD_REG_CONF2 = const(0x01) # Burst, comm mode
@@ -518,3 +519,34 @@ class MLX90393: # pylint: disable=too-many-instance-attributes
518
519
  z *= _LSB_LOOKUP[hallconf_index][self._gain_current][self._res_z][1]
519
520
 
520
521
  return x, y, z
522
+
523
+ @property
524
+ def temperature(self) -> float:
525
+ """
526
+ Reads a single temperature sample from the magnetometer.
527
+ Temperature value in Celsius
528
+ """
529
+ # Read the temperature reference from register 0x24
530
+ treference = self.read_reg(0x24)
531
+
532
+ # Value taken from maximum time of temperature conversion on the datasheet section 12.
533
+ # maximum time for temperature conversion = 1603 us
534
+ delay = 0.1
535
+
536
+ # Set the device to single measurement mode
537
+ self._transceive(bytes([_CMD_SM | _CMD_TEMP]))
538
+
539
+ time.sleep(delay)
540
+
541
+ # Read the 'temp' data
542
+ data = self._transceive(bytes([_CMD_RM | _CMD_TEMP]), 2)
543
+
544
+ # Unpack status and raw int values
545
+ self._status_last = data[0]
546
+
547
+ # from https://www.melexis.com/-/media/files/documents/
548
+ # application-notes/mlx90393-temperature-compensation-application-note-melexis.pdf
549
+ tvalue = struct.unpack(">H", data[1:3])[0]
550
+ # See previous link for conversion formula
551
+
552
+ return 35 + ((tvalue - treference) / 45.2)
@@ -1,6 +0,0 @@
1
- adafruit_mlx90393.py,sha256=p4A2pgRYbezk62qU-VLQGztbCqQq3ddWqiax3lJPY4o,17299
2
- adafruit_circuitpython_mlx90393-2.0.16.dist-info/LICENSE,sha256=WeIXVkYWpdba3Boxrax8dB0s5qWg9GTxl7c5uTZQDUI,1105
3
- adafruit_circuitpython_mlx90393-2.0.16.dist-info/METADATA,sha256=fGWQcueFmZLd4GU0O5lydsspITSJHiv9zz-JgFlohGo,4088
4
- adafruit_circuitpython_mlx90393-2.0.16.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
5
- adafruit_circuitpython_mlx90393-2.0.16.dist-info/top_level.txt,sha256=5RT_YbHfXFo2Y6zVvz8MXsZLIHm1OxrjFJrzRaCTdNY,18
6
- adafruit_circuitpython_mlx90393-2.0.16.dist-info/RECORD,,