diff --git a/docs/requirements.txt b/docs/requirements.txt
index 88e6733..979f568 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -2,4 +2,6 @@
#
# SPDX-License-Identifier: Unlicense
-sphinx>=4.0.0
+sphinx
+sphinxcontrib-jquery
+sphinx-rtd-theme
diff --git a/examples/bmp280_displayio_simpletest.py b/examples/bmp280_displayio_simpletest.py
new file mode 100644
index 0000000..47afcf4
--- /dev/null
+++ b/examples/bmp280_displayio_simpletest.py
@@ -0,0 +1,55 @@
+# SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries
+# SPDX-FileCopyrightText: 2024 Jose D. Montoya
+#
+# SPDX-License-Identifier: MIT
+
+import time
+
+import board
+from adafruit_display_text.bitmap_label import Label
+from displayio import Group
+from terminalio import FONT
+
+import adafruit_bmp280
+
+# Simple demo of the BMP280 barometric pressure sensor.
+# create a main_group to hold anything we want to show on the display.
+main_group = Group()
+# Initialize I2C bus and sensor.
+i2c = board.I2C() # uses board.SCL and board.SDA
+bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
+
+# change this to match the location's pressure (hPa) at sea level
+bmp280.sea_level_pressure = 1013.25
+
+# Create two Labels to show the readings. If you have a very small
+# display you may need to change to scale=1.
+tempandpress_output_label = Label(FONT, text="", scale=2)
+altitude_output_label = Label(FONT, text="", scale=2)
+
+# place the labels in the middle of the screen with anchored positioning
+tempandpress_output_label.anchor_point = (0, 0)
+tempandpress_output_label.anchored_position = (
+ 4,
+ board.DISPLAY.height // 2 - 40,
+)
+altitude_output_label.anchor_point = (0, 0)
+altitude_output_label.anchored_position = (4, board.DISPLAY.height // 2 + 20)
+
+
+# add the label to the main_group
+main_group.append(tempandpress_output_label)
+main_group.append(altitude_output_label)
+
+# set the main_group as the root_group of the built-in DISPLAY
+board.DISPLAY.root_group = main_group
+
+# begin main loop
+while True:
+ # Update the label.text property to change the text on the display
+ tempandpress_output_label.text = (
+ f"Temperature:{bmp280.temperature:0.1f} C \nPressure:{bmp280.pressure:0.1f} hPa"
+ )
+ altitude_output_label.text = f"Altitude:{bmp280.altitude:0.2f} mts"
+ # wait for a bit
+ time.sleep(2.0)
diff --git a/examples/bmp280_normal_mode.py b/examples/bmp280_normal_mode.py
index b5d87c8..a59eda6 100644
--- a/examples/bmp280_normal_mode.py
+++ b/examples/bmp280_normal_mode.py
@@ -6,17 +6,21 @@
parameters supported by the sensor.
Refer to the BMP280 datasheet to understand what these parameters do
"""
+
import time
+
import board
+
import adafruit_bmp280
# Create sensor object, communicating over the board's default I2C bus
i2c = board.I2C() # uses board.SCL and board.SDA
+# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
# OR Create sensor object, communicating over the board's default SPI bus
# spi = busio.SPI()
-# bmp_cs = digitalio.DigitalInOut(board.D10)
+# bmp_cs = digitalio.DigitalInOut(board.D5)
# bmp280 = adafruit_bmp280.Adafruit_BMP280_SPI(spi, bmp_cs)
# change this to match the location's pressure (hPa) at sea level
diff --git a/examples/bmp280_simpletest.py b/examples/bmp280_simpletest.py
index 004f737..f45682c 100644
--- a/examples/bmp280_simpletest.py
+++ b/examples/bmp280_simpletest.py
@@ -2,8 +2,10 @@
# SPDX-License-Identifier: MIT
"""Simpletest Example that shows how to get temperature,
- pressure, and altitude readings from a BMP280"""
+pressure, and altitude readings from a BMP280"""
+
import time
+
import board
# import digitalio # For use with SPI
@@ -11,11 +13,12 @@
# Create sensor object, communicating over the board's default I2C bus
i2c = board.I2C() # uses board.SCL and board.SDA
+# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
bmp280 = adafruit_bmp280.Adafruit_BMP280_I2C(i2c)
# OR Create sensor object, communicating over the board's default SPI bus
# spi = board.SPI()
-# bmp_cs = digitalio.DigitalInOut(board.D10)
+# bmp_cs = digitalio.DigitalInOut(board.D5)
# bmp280 = adafruit_bmp280.Adafruit_BMP280_SPI(spi, bmp_cs)
# change this to match the location's pressure (hPa) at sea level
diff --git a/optional_requirements.txt b/optional_requirements.txt
new file mode 100644
index 0000000..d4e27c4
--- /dev/null
+++ b/optional_requirements.txt
@@ -0,0 +1,3 @@
+# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
+#
+# SPDX-License-Identifier: Unlicense
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..38995eb
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,48 @@
+# SPDX-FileCopyrightText: 2022 Alec Delaney for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
+
+[build-system]
+requires = [
+ "setuptools",
+ "wheel",
+ "setuptools-scm",
+]
+
+[project]
+name = "adafruit-circuitpython-bmp280"
+description = "CircuitPython driver for the BMP280."
+version = "0.0.0+auto.0"
+readme = "README.rst"
+authors = [
+ {name = "Adafruit Industries", email = "circuitpython@adafruit.com"}
+]
+urls = {Homepage = "https://github.com/adafruit/Adafruit_CircuitPython_BMP280"}
+keywords = [
+ "adafruit",
+ "bmp280",
+ "barometric",
+ "pressure",
+ "temperature",
+ "hardware",
+ "sensor",
+ "micropython",
+ "circuitpython",
+]
+license = {text = "MIT"}
+classifiers = [
+ "Intended Audience :: Developers",
+ "Topic :: Software Development :: Libraries",
+ "Topic :: Software Development :: Embedded Systems",
+ "Topic :: System :: Hardware",
+ "License :: OSI Approved :: MIT License",
+ "Programming Language :: Python :: 3",
+]
+dynamic = ["dependencies", "optional-dependencies"]
+
+[tool.setuptools]
+py-modules = ["adafruit_bmp280"]
+
+[tool.setuptools.dynamic]
+dependencies = {file = ["requirements.txt"]}
+optional-dependencies = {optional = {file = ["optional_requirements.txt"]}}
diff --git a/requirements.txt b/requirements.txt
index f162505..fcef575 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,7 +1,7 @@
-# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
+# SPDX-FileCopyrightText: 2022 Alec Delaney, for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
Adafruit-Blinka
-adafruit-circuitpython-busdevice
adafruit-circuitpython-register
+adafruit-circuitpython-busdevice
diff --git a/ruff.toml b/ruff.toml
new file mode 100644
index 0000000..36332ff
--- /dev/null
+++ b/ruff.toml
@@ -0,0 +1,105 @@
+# SPDX-FileCopyrightText: 2024 Tim Cocks for Adafruit Industries
+#
+# SPDX-License-Identifier: MIT
+
+target-version = "py38"
+line-length = 100
+
+[lint]
+preview = true
+select = ["I", "PL", "UP"]
+
+extend-select = [
+ "D419", # empty-docstring
+ "E501", # line-too-long
+ "W291", # trailing-whitespace
+ "PLC0414", # useless-import-alias
+ "PLC2401", # non-ascii-name
+ "PLC2801", # unnecessary-dunder-call
+ "PLC3002", # unnecessary-direct-lambda-call
+ "E999", # syntax-error
+ "PLE0101", # return-in-init
+ "F706", # return-outside-function
+ "F704", # yield-outside-function
+ "PLE0116", # continue-in-finally
+ "PLE0117", # nonlocal-without-binding
+ "PLE0241", # duplicate-bases
+ "PLE0302", # unexpected-special-method-signature
+ "PLE0604", # invalid-all-object
+ "PLE0605", # invalid-all-format
+ "PLE0643", # potential-index-error
+ "PLE0704", # misplaced-bare-raise
+ "PLE1141", # dict-iter-missing-items
+ "PLE1142", # await-outside-async
+ "PLE1205", # logging-too-many-args
+ "PLE1206", # logging-too-few-args
+ "PLE1307", # bad-string-format-type
+ "PLE1310", # bad-str-strip-call
+ "PLE1507", # invalid-envvar-value
+ "PLE2502", # bidirectional-unicode
+ "PLE2510", # invalid-character-backspace
+ "PLE2512", # invalid-character-sub
+ "PLE2513", # invalid-character-esc
+ "PLE2514", # invalid-character-nul
+ "PLE2515", # invalid-character-zero-width-space
+ "PLR0124", # comparison-with-itself
+ "PLR0202", # no-classmethod-decorator
+ "PLR0203", # no-staticmethod-decorator
+ "UP004", # useless-object-inheritance
+ "PLR0206", # property-with-parameters
+ "PLR0904", # too-many-public-methods
+ "PLR0911", # too-many-return-statements
+ "PLR0912", # too-many-branches
+ "PLR0913", # too-many-arguments
+ "PLR0914", # too-many-locals
+ "PLR0915", # too-many-statements
+ "PLR0916", # too-many-boolean-expressions
+ "PLR1702", # too-many-nested-blocks
+ "PLR1704", # redefined-argument-from-local
+ "PLR1711", # useless-return
+ "C416", # unnecessary-comprehension
+ "PLR1733", # unnecessary-dict-index-lookup
+ "PLR1736", # unnecessary-list-index-lookup
+
+ # ruff reports this rule is unstable
+ #"PLR6301", # no-self-use
+
+ "PLW0108", # unnecessary-lambda
+ "PLW0120", # useless-else-on-loop
+ "PLW0127", # self-assigning-variable
+ "PLW0129", # assert-on-string-literal
+ "B033", # duplicate-value
+ "PLW0131", # named-expr-without-context
+ "PLW0245", # super-without-brackets
+ "PLW0406", # import-self
+ "PLW0602", # global-variable-not-assigned
+ "PLW0603", # global-statement
+ "PLW0604", # global-at-module-level
+
+ # fails on the try: import typing used by libraries
+ #"F401", # unused-import
+
+ "F841", # unused-variable
+ "E722", # bare-except
+ "PLW0711", # binary-op-exception
+ "PLW1501", # bad-open-mode
+ "PLW1508", # invalid-envvar-default
+ "PLW1509", # subprocess-popen-preexec-fn
+ "PLW2101", # useless-with-lock
+ "PLW3301", # nested-min-max
+]
+
+ignore = [
+ "PLR2004", # magic-value-comparison
+ "UP030", # format literals
+ "PLW1514", # unspecified-encoding
+ "PLR0913", # too-many-arguments
+ "PLR0915", # too-many-statements
+ "PLR0917", # too-many-positional-arguments
+ "PLR0904", # too-many-public-methods
+ "PLR0912", # too-many-branches
+ "PLR0916", # too-many-boolean-expressions
+]
+
+[format]
+line-ending = "lf"
diff --git a/setup.py b/setup.py
deleted file mode 100644
index 3a8f246..0000000
--- a/setup.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
-#
-# SPDX-License-Identifier: MIT
-
-"""A setuptools based setup module.
-
-See:
-https://packaging.python.org/en/latest/distributing.html
-https://github.com/pypa/sampleproject
-"""
-
-# Always prefer setuptools over distutils
-from setuptools import setup, find_packages
-
-# To use a consistent encoding
-from codecs import open
-from os import path
-
-here = path.abspath(path.dirname(__file__))
-
-# Get the long description from the README file
-with open(path.join(here, "README.rst"), encoding="utf-8") as f:
- long_description = f.read()
-
-setup(
- name="adafruit-circuitpython-bmp280",
- use_scm_version=True,
- setup_requires=["setuptools_scm"],
- description="CircuitPython driver for the BMP280.",
- long_description=long_description,
- long_description_content_type="text/x-rst",
- # The project's main homepage.
- url="https://github.com/adafruit/Adafruit_CircuitPython_BMP280",
- # Author details
- author="Adafruit Industries",
- author_email="circuitpython@adafruit.com",
- install_requires=["Adafruit-Blinka", "adafruit-circuitpython-busdevice"],
- # Choose your license
- license="MIT",
- # See https://pypi.python.org/pypi?%3Aaction=list_classifiers
- classifiers=[
- "Development Status :: 3 - Alpha",
- "Intended Audience :: Developers",
- "Topic :: Software Development :: Libraries",
- "Topic :: System :: Hardware",
- "License :: OSI Approved :: MIT License",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.4",
- "Programming Language :: Python :: 3.5",
- ],
- # What does your project relate to?
- keywords="adafruit bmp280 barometric pressure temperature hardware sensor micropython circuitpython",
- # You can just specify the packages manually here if your project is
- # simple. Or you can use find_packages().
- py_modules=["adafruit_bmp280"],
-)
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy