adafruit-circuitpython-mlx90393 2.0.16__tar.gz → 2.1.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/workflows/release_gh.yml +1 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.gitignore +1 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.pre-commit-config.yaml +4 -4
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.pylintrc +1 -1
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/PKG-INFO +1 -1
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/PKG-INFO +1 -1
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/SOURCES.txt +2 -1
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_mlx90393.py +33 -1
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/conf.py +1 -0
- adafruit-circuitpython-mlx90393-2.1.1/docs/examples.rst +17 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/requirements.txt +1 -0
- adafruit-circuitpython-mlx90393-2.1.1/examples/mlx90393_temperature.py +21 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/pyproject.toml +1 -1
- adafruit-circuitpython-mlx90393-2.0.16/docs/examples.rst +0 -8
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/workflows/build.yml +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/workflows/failure-help-text.yml +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/workflows/release_pypi.yml +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.readthedocs.yaml +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/CODE_OF_CONDUCT.md +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/LICENSE +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/LICENSES/CC-BY-4.0.txt +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/LICENSES/MIT.txt +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/LICENSES/Unlicense.txt +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/README.rst +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/README.rst.license +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/dependency_links.txt +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/requires.txt +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/top_level.txt +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/_static/favicon.ico +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/_static/favicon.ico.license +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/api.rst +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/api.rst.license +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/examples.rst.license +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/index.rst +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/index.rst.license +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/examples/mlx90393_simpletest.py +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/optional_requirements.txt +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/requirements.txt +0 -0
- {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/setup.cfg +0 -0
@@ -4,21 +4,21 @@
|
|
4
4
|
|
5
5
|
repos:
|
6
6
|
- repo: https://github.com/python/black
|
7
|
-
rev:
|
7
|
+
rev: 23.3.0
|
8
8
|
hooks:
|
9
9
|
- id: black
|
10
10
|
- repo: https://github.com/fsfe/reuse-tool
|
11
|
-
rev:
|
11
|
+
rev: v1.1.2
|
12
12
|
hooks:
|
13
13
|
- id: reuse
|
14
14
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
15
|
-
rev: v4.
|
15
|
+
rev: v4.4.0
|
16
16
|
hooks:
|
17
17
|
- id: check-yaml
|
18
18
|
- id: end-of-file-fixer
|
19
19
|
- id: trailing-whitespace
|
20
20
|
- repo: https://github.com/pycqa/pylint
|
21
|
-
rev: v2.
|
21
|
+
rev: v2.17.4
|
22
22
|
hooks:
|
23
23
|
- id: pylint
|
24
24
|
name: pylint (library code)
|
@@ -41,7 +41,7 @@ try:
|
|
41
41
|
except ImportError:
|
42
42
|
pass
|
43
43
|
|
44
|
-
__version__ = "2.
|
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)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
Simple test
|
2
|
+
------------
|
3
|
+
|
4
|
+
Ensure your device works with this simple test.
|
5
|
+
|
6
|
+
.. literalinclude:: ../examples/mlx90393_simpletest.py
|
7
|
+
:caption: examples/mlx90393_simpletest.py
|
8
|
+
:linenos:
|
9
|
+
|
10
|
+
Temperature test
|
11
|
+
-----------------
|
12
|
+
|
13
|
+
Example showing how to measure temperature with the sensor
|
14
|
+
|
15
|
+
.. literalinclude:: ../examples/mlx90393_temperature.py
|
16
|
+
:caption: examples/mlx90393_temperature.py
|
17
|
+
:linenos:
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# SPDX-FileCopyrightText: 2023 Jose D. Montoya
|
2
|
+
# SPDX-License-Identifier: MIT
|
3
|
+
|
4
|
+
import time
|
5
|
+
import board
|
6
|
+
import adafruit_mlx90393
|
7
|
+
|
8
|
+
i2c = board.I2C() # uses board.SCL and board.SDA
|
9
|
+
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
|
10
|
+
SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X)
|
11
|
+
|
12
|
+
|
13
|
+
while True:
|
14
|
+
temp = SENSOR.temperature
|
15
|
+
|
16
|
+
print("Temperature: {} °C".format(temp))
|
17
|
+
|
18
|
+
# Display the status field if an error occurred, etc.
|
19
|
+
if SENSOR.last_status > adafruit_mlx90393.STATUS_OK:
|
20
|
+
SENSOR.display_status()
|
21
|
+
time.sleep(1.0)
|
{adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/pyproject.toml
RENAMED
@@ -12,7 +12,7 @@ requires = [
|
|
12
12
|
[project]
|
13
13
|
name = "adafruit-circuitpython-mlx90393"
|
14
14
|
description = "CircuitPython driver for the MLX90393 3-axis magnetometer."
|
15
|
-
version = "2.
|
15
|
+
version = "2.1.1"
|
16
16
|
readme = "README.rst"
|
17
17
|
authors = [
|
18
18
|
{name = "Adafruit Industries", email = "circuitpython@adafruit.com"}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.readthedocs.yaml
RENAMED
File without changes
|
{adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/CODE_OF_CONDUCT.md
RENAMED
File without changes
|
File without changes
|
File without changes
|
{adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/LICENSES/MIT.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
{adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/README.rst.license
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/api.rst
RENAMED
File without changes
|
File without changes
|
File without changes
|
{adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/index.rst
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/requirements.txt
RENAMED
File without changes
|
File without changes
|