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.
Files changed (40) hide show
  1. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/workflows/release_gh.yml +1 -0
  2. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.gitignore +1 -0
  3. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.pre-commit-config.yaml +4 -4
  4. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.pylintrc +1 -1
  5. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/PKG-INFO +1 -1
  6. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/PKG-INFO +1 -1
  7. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/SOURCES.txt +2 -1
  8. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_mlx90393.py +33 -1
  9. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/conf.py +1 -0
  10. adafruit-circuitpython-mlx90393-2.1.1/docs/examples.rst +17 -0
  11. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/requirements.txt +1 -0
  12. adafruit-circuitpython-mlx90393-2.1.1/examples/mlx90393_temperature.py +21 -0
  13. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/pyproject.toml +1 -1
  14. adafruit-circuitpython-mlx90393-2.0.16/docs/examples.rst +0 -8
  15. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/PULL_REQUEST_TEMPLATE/adafruit_circuitpython_pr.md +0 -0
  16. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/workflows/build.yml +0 -0
  17. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/workflows/failure-help-text.yml +0 -0
  18. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.github/workflows/release_pypi.yml +0 -0
  19. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/.readthedocs.yaml +0 -0
  20. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/CODE_OF_CONDUCT.md +0 -0
  21. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/LICENSE +0 -0
  22. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/LICENSES/CC-BY-4.0.txt +0 -0
  23. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/LICENSES/MIT.txt +0 -0
  24. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/LICENSES/Unlicense.txt +0 -0
  25. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/README.rst +0 -0
  26. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/README.rst.license +0 -0
  27. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/dependency_links.txt +0 -0
  28. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/requires.txt +0 -0
  29. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/adafruit_circuitpython_mlx90393.egg-info/top_level.txt +0 -0
  30. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/_static/favicon.ico +0 -0
  31. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/_static/favicon.ico.license +0 -0
  32. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/api.rst +0 -0
  33. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/api.rst.license +0 -0
  34. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/examples.rst.license +0 -0
  35. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/index.rst +0 -0
  36. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/docs/index.rst.license +0 -0
  37. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/examples/mlx90393_simpletest.py +0 -0
  38. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/optional_requirements.txt +0 -0
  39. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/requirements.txt +0 -0
  40. {adafruit-circuitpython-mlx90393-2.0.16 → adafruit-circuitpython-mlx90393-2.1.1}/setup.cfg +0 -0
@@ -16,3 +16,4 @@ jobs:
16
16
  uses: adafruit/workflows-circuitpython-libs/release-gh@main
17
17
  with:
18
18
  github-token: ${{ secrets.GITHUB_TOKEN }}
19
+ upload-url: ${{ github.event.release.upload_url }}
@@ -37,6 +37,7 @@ _build
37
37
 
38
38
  # Virtual environment-specific files
39
39
  .env
40
+ .venv
40
41
 
41
42
  # MacOS-specific files
42
43
  *.DS_Store
@@ -4,21 +4,21 @@
4
4
 
5
5
  repos:
6
6
  - repo: https://github.com/python/black
7
- rev: 22.3.0
7
+ rev: 23.3.0
8
8
  hooks:
9
9
  - id: black
10
10
  - repo: https://github.com/fsfe/reuse-tool
11
- rev: v0.14.0
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.2.0
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.15.5
21
+ rev: v2.17.4
22
22
  hooks:
23
23
  - id: pylint
24
24
  name: pylint (library code)
@@ -396,4 +396,4 @@ min-public-methods=1
396
396
 
397
397
  # Exceptions that will emit a warning when being caught. Defaults to
398
398
  # "Exception"
399
- overgeneral-exceptions=Exception
399
+ overgeneral-exceptions=builtins.Exception
@@ -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
@@ -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
@@ -33,4 +33,5 @@ docs/index.rst.license
33
33
  docs/requirements.txt
34
34
  docs/_static/favicon.ico
35
35
  docs/_static/favicon.ico.license
36
- examples/mlx90393_simpletest.py
36
+ examples/mlx90393_simpletest.py
37
+ examples/mlx90393_temperature.py
@@ -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)
@@ -17,6 +17,7 @@ sys.path.insert(0, os.path.abspath(".."))
17
17
  # ones.
18
18
  extensions = [
19
19
  "sphinx.ext.autodoc",
20
+ "sphinxcontrib.jquery",
20
21
  "sphinx.ext.intersphinx",
21
22
  "sphinx.ext.napoleon",
22
23
  "sphinx.ext.todo",
@@ -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:
@@ -3,3 +3,4 @@
3
3
  # SPDX-License-Identifier: Unlicense
4
4
 
5
5
  sphinx>=4.0.0
6
+ sphinxcontrib-jquery
@@ -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)
@@ -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.0.16"
15
+ version = "2.1.1"
16
16
  readme = "README.rst"
17
17
  authors = [
18
18
  {name = "Adafruit Industries", email = "circuitpython@adafruit.com"}
@@ -1,8 +0,0 @@
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: