fetching calibration consts
This commit is contained in:
parent
9dd87604db
commit
8cbfe48e0f
6 changed files with 161 additions and 204 deletions
19
README.rst
19
README.rst
|
|
@ -30,11 +30,6 @@ This is easily achieved by downloading
|
|||
|
||||
Installing from PyPI
|
||||
=====================
|
||||
.. note:: This library is not available on PyPI yet. Install documentation is included
|
||||
as a standard element. Stay tuned for PyPI availability!
|
||||
|
||||
.. todo:: Remove the above note if PyPI version is/will be available at time of release.
|
||||
If the library is not planned for PyPI, remove the entire 'Installing from PyPI' section.
|
||||
|
||||
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
|
||||
PyPI <https://pypi.org/project/adafruit-circuitpython-hts221/>`_. To install for current user:
|
||||
|
|
@ -61,7 +56,19 @@ To install in a virtual environment in your current project:
|
|||
Usage Example
|
||||
=============
|
||||
|
||||
.. todo:: Add a quick, simple example. It and other examples should live in the examples folder and be included in docs/examples.rst.
|
||||
.. code-block:: python3
|
||||
|
||||
import time
|
||||
import board
|
||||
import busio
|
||||
import adafruit_hts221
|
||||
|
||||
i2c = busio.I2C(board.SCL, board.SDA)
|
||||
hts = adafruit_hts221.HTS221(i2c)
|
||||
while True:
|
||||
print("Humidity: %.2f percent rH" % hts.humidity)
|
||||
print("Temperature: %.2f C" % hts.temperature)
|
||||
time.sleep(1)
|
||||
|
||||
Contributing
|
||||
============
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ Implementation Notes
|
|||
|
||||
**Software and Dependencies:**
|
||||
* Adafruit CircuitPython firmware for the supported boards:
|
||||
https://circuitpythohn.org/downloads
|
||||
https://circuitpython.org/downloads
|
||||
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
|
||||
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
|
||||
|
||||
|
|
@ -55,27 +55,24 @@ _WHO_AM_I = const(0x0F)
|
|||
|
||||
_CTRL_REG1 = const(0x20)
|
||||
_CTRL_REG2 = const(0x21)
|
||||
_CTRL_REG3 = const(0x22) #Third control regsiter; DRDY_H_L, DRDY
|
||||
_CTRL_REG3 = const(0x22)
|
||||
|
||||
_HUMIDITY_OUT_L = const(0x28 | 0x80) #Humidity output register (LSByte)
|
||||
_TEMP_OUT_L = const(0x2A | 0x80) #Temperature output register (LSByte)
|
||||
# some addresses are anded to set the top bit so that multi-byte reads will work
|
||||
_HUMIDITY_OUT_L = const(0x28 | 0x80) # Humidity output register (LSByte)
|
||||
_TEMP_OUT_L = const(0x2A | 0x80) # Temperature output register (LSByte)
|
||||
|
||||
_H0_RH_X2 = const(0x30) #Humididy calibration LSB values
|
||||
_H1_RH_X2 = const(0x31) #Humididy calibration LSB values
|
||||
_H0_RH_X2 = const(0x30) # Humididy calibration LSB values
|
||||
_H1_RH_X2 = const(0x31) # Humididy calibration LSB values
|
||||
|
||||
_T0_DEGC_X8 = const(0x32) #First byte of T0, T1 calibration values
|
||||
_T1_DEGC_X8 = const(0x33) #First byte of T0, T1 calibration values
|
||||
_T1_T0_MSB = const(0x35) #Top 2 bits of T0 and T1 (each are 10 bits)
|
||||
_T0_DEGC_X8 = const(0x32) # First byte of T0, T1 calibration values
|
||||
_T1_DEGC_X8 = const(0x33) # First byte of T0, T1 calibration values
|
||||
_T1_T0_MSB = const(0x35) # Top 2 bits of T0 and T1 (each are 10 bits)
|
||||
|
||||
_H0_T0_OUT = const(0x36|0x80) #Humididy calibration Time 0 value
|
||||
_H1_T1_OUT = const(0x3A|0x80) #Humididy calibration Time 1 value
|
||||
_H0_T0_OUT = const(0x36 | 0x80) # Humididy calibration Time 0 value
|
||||
_H1_T1_OUT = const(0x3A | 0x80) # Humididy calibration Time 1 value
|
||||
|
||||
_T0_OUT = const(0x3C|0x80) #T0_OUT LSByte
|
||||
_T1_OUT = const(0x3E|0x80) #T1_OUT LSByte
|
||||
|
||||
|
||||
# _PRESS_OUT_XL = const(0x28 | 0x80) # | 0x80 to set auto increment on multi-byte read
|
||||
# _TEMP_OUT_L = const(0x2B | 0x80) # | 0x80 to set auto increment on multi-byte read
|
||||
_T0_OUT = const(0x3C | 0x80) # T0_OUT LSByte
|
||||
_T1_OUT = const(0x3E | 0x80) # T1_OUT LSByte
|
||||
|
||||
_HTS221_CHIP_ID = 0xBC
|
||||
_HTS221_DEFAULT_ADDRESS = 0x5F
|
||||
|
|
@ -132,8 +129,8 @@ Rate.add_values(
|
|||
)
|
||||
)
|
||||
|
||||
def bp(val):
|
||||
return format(val, "#010b")
|
||||
# def bp(val):
|
||||
# return format(val, "#010b")
|
||||
class HTS221: # pylint: disable=too-many-instance-attributes
|
||||
"""Library for the ST LPS2x family of humidity sensors
|
||||
|
||||
|
|
@ -152,7 +149,6 @@ class HTS221: # pylint: disable=too-many-instance-attributes
|
|||
_raw_temperature = ROUnaryStruct(_TEMP_OUT_L, "<h")
|
||||
_raw_humidity = ROUnaryStruct(_HUMIDITY_OUT_L, "<b")
|
||||
|
||||
|
||||
# humidity calibration consts
|
||||
_t0_deg_c_x8_lsbyte = ROBits(8, _T0_DEGC_X8, 0)
|
||||
_t1_deg_c_x8_lsbyte = ROBits(8, _T1_DEGC_X8, 0)
|
||||
|
|
@ -161,13 +157,12 @@ class HTS221: # pylint: disable=too-many-instance-attributes
|
|||
_t0_out = ROUnaryStruct(_T0_OUT, "<h")
|
||||
_t1_out = ROUnaryStruct(_T1_OUT, "<h")
|
||||
|
||||
_h0_rh_x2 = ROUnaryStruct(_H0_RH_X2, "<b")
|
||||
_h1_rh_x2 = ROUnaryStruct(_H1_RH_X2, "<b")
|
||||
_h0_rh_x2 = ROUnaryStruct(_H0_RH_X2, "<B")
|
||||
_h1_rh_x2 = ROUnaryStruct(_H1_RH_X2, "<B")
|
||||
|
||||
_h0_t0_out = ROUnaryStruct(_H0_T0_OUT, "<h")
|
||||
_h1_t0_out = ROUnaryStruct(_H1_T1_OUT, "<h")
|
||||
|
||||
|
||||
def __init__(self, i2c_bus, address=_HTS221_DEFAULT_ADDRESS):
|
||||
self.i2c_device = i2cdevice.I2CDevice(i2c_bus, address)
|
||||
if not self._chip_id in [_HTS221_CHIP_ID]:
|
||||
|
|
@ -177,99 +172,41 @@ class HTS221: # pylint: disable=too-many-instance-attributes
|
|||
self.boot()
|
||||
self.enabled = True
|
||||
self.data_rate = Rate.RATE_12_5_HZ # pylint:disable=no-member
|
||||
self.T0_DEG_C = None
|
||||
self.T1_DEG_C = None
|
||||
self.T0_OUT = None
|
||||
self.T1_OUT = None
|
||||
|
||||
self.H0_RH = None
|
||||
self.H1_RH = None
|
||||
self.H0_T0_OUT = None
|
||||
self.H1_T0_OUT = None
|
||||
self._load_calibration_values()
|
||||
|
||||
print(" T0_DEG_C", self.T0_DEG_C)
|
||||
print(" T1_DEG_C", self. T1_DEG_C)
|
||||
print(" T0_OUT", self.T0_OUT)
|
||||
print(" T1_OUT", self.T1_OUT)
|
||||
|
||||
print(" H0_RH", self.H0_RH)
|
||||
print(" H1_RH", self.H1_RH)
|
||||
print("H0_T0_OUT", self.H0_T0_OUT)
|
||||
print("H1_T0_OUT", self.H1_T0_OUT)
|
||||
|
||||
def _load_calibration_values(self):
|
||||
print("loading")
|
||||
t1_t0_msbs = self._t1_t0_deg_c_x8_msbits
|
||||
# print("t1t0msbs:", bp(t1_t0_msbs))
|
||||
|
||||
self.T0_DEG_C = self._t0_deg_c_x8_lsbyte
|
||||
self.T0_DEG_C |= ((t1_t0_msbs & 0b0011) << 8)
|
||||
# print("\nT0_DEG_C:", bp(self.T0_DEG_C))
|
||||
|
||||
self.T1_DEG_C = self._t1_deg_c_x8_lsbyte
|
||||
# print("\nT1_DEG_C:", bp(self.T1_DEG_C))
|
||||
self.T1_DEG_C |= (t1_t0_msbs & 0b1100) << 6
|
||||
# print("\nT1_DEG_C:", bp(self.T1_DEG_C))
|
||||
self.T0_OUT = self._t0_out
|
||||
self.T1_OUT = self._t1_out
|
||||
# self.T1_OUT = None
|
||||
|
||||
self.H0_RH = self._h0_rh_x2
|
||||
self.H1_RH = self._h1_rh_x2
|
||||
self.H0_T0_OUT = self._h0_t0_out
|
||||
self.H1_T0_OUT = self._h1_t0_out
|
||||
# self._t0_deg_c_x8_lsbyte = ROUnaryStruct(_T0_DEGC_X8, "<b")
|
||||
# self._t1_deg_c_x8_lsbyte = ROUnaryStruct(_T1_DEGC_X8, "<b")
|
||||
# self._t1_t0_deg_c_x8_msbits = ROBits(4, _T1_T0_MSB, 0)
|
||||
|
||||
# self._h0_rh_x2 = ROUnaryStruct(_H0_RH_X2, "<b")
|
||||
# self._h1_rh_x2 = ROUnaryStruct(_H1_RH_X2, "<b")
|
||||
|
||||
# self._h0_t0_out = ROUnaryStruct(_H0_T0_OUT, "<h")
|
||||
# self._h1_t0_out = ROUnaryStruct(_H1_T1_OUT, "<h")
|
||||
|
||||
# to_out = ROUnaryStruct(_T0_OUT, "<h")
|
||||
# t1_out = ROUnaryStruct(_T1_OUT, "<h")
|
||||
|
||||
# _T0_DEGC_X8 = const(0x32|0x80) #First byte of T0, T1 calibration values
|
||||
# _T1_T0_MSB = const(0x35|0x80) #Top 2 bits of T0 and T1 (each are 10 bits)
|
||||
# # TO, T1 have to be assembled
|
||||
# self._T0 = 0
|
||||
# self._T1 = 0
|
||||
# self._T1 = (buffer[0] & 0b1100)
|
||||
# self._T1 <<= 6
|
||||
# self._T0 = (buffer[0] & 0b0011)
|
||||
# self._T0 <<= 8
|
||||
|
||||
# t0_degc_x8_l.read(buffer, 2)
|
||||
# # Or self._T1[0:7] on to the above to make a full 10 bits
|
||||
# self._T0 |= buffer[0]
|
||||
# self._T0 >>= 3 #// divide by 8 (as documented)
|
||||
# self._T1 |= buffer[1]
|
||||
# self._T1 >>= 3
|
||||
|
||||
self.t0_deg_c = self._t0_deg_c_x8_lsbyte
|
||||
self.t0_deg_c |= (t1_t0_msbs & 0b0011) << 8
|
||||
self.t1_deg_c = self._t1_deg_c_x8_lsbyte
|
||||
self.t1_deg_c |= (t1_t0_msbs & 0b1100) << 6
|
||||
|
||||
self.t0_out = self._t0_out
|
||||
self.t1_out = self._t1_out
|
||||
self.h0_rh = self._h0_rh_x2
|
||||
self.h1_rh = self._h1_rh_x2
|
||||
self.h0_out = self._h0_t0_out
|
||||
self.h1_out = self._h1_t0_out
|
||||
|
||||
def _correct_humidity(self):
|
||||
pass
|
||||
# hum = ((int16_t)(H1) - (int16_t)(H0)) / 2.0; // remove x2 multiple
|
||||
pass
|
||||
|
||||
# // Calculate humidity in decimal of grade centigrades i.e. 15.0 = 150.
|
||||
# h_temp = (float)(((int16_t)raw_humidity - (int16_t)H0_T0_OUT) * hum) /
|
||||
# (float)((int16_t)H1_T0_OUT - (int16_t)H0_T0_OUT);
|
||||
# hum = (float)((int16_t)H0) / 2.0; // remove x2 multiple
|
||||
# corrected_humidity = (hum + h_temp); // provide signed % measurement unit
|
||||
# hum = ((int16_t)(H1) - (int16_t)(H0)) / 2.0; // remove x2 multiple
|
||||
|
||||
# // Calculate humidity in decimal of grade centigrades i.e. 15.0 = 150.
|
||||
# h_temp = (float)(((int16_t)raw_humidity - (int16_t)H0_T0_OUT) * hum) /
|
||||
# (float)((int16_t)H1_T0_OUT - (int16_t)H0_T0_OUT);
|
||||
# hum = (float)((int16_t)H0) / 2.0; // remove x2 multiple
|
||||
# corrected_humidity = (hum + h_temp); // provide signed % measurement unit
|
||||
def _correct_temp(self):
|
||||
pass
|
||||
# corrected_temp =
|
||||
# (float)
|
||||
# // measured temp(LSB) - offset(LSB) * (calibration measurement delta)
|
||||
# (float)((int16_t)raw_temperature - (int16_t)T0_OUT) *
|
||||
# (float)((int16_t)T1 - (int16_t)T0) / // divided by..
|
||||
# // Calibration LSB delta + Calibration offset?
|
||||
# (float)((int16_t)T1_OUT - (int16_t)T0_OUT) +
|
||||
# (int16_t)T0;
|
||||
pass
|
||||
|
||||
# corrected_temp =
|
||||
# (float)
|
||||
# // measured temp(LSB) - offset(LSB) * (calibration measurement delta)
|
||||
# (float)((int16_t)raw_temperature - (int16_t)T0_OUT) *
|
||||
# (float)((int16_t)T1 - (int16_t)T0) / // divided by..
|
||||
# // Calibration LSB delta + Calibration offset?
|
||||
# (float)((int16_t)T1_OUT - (int16_t)T0_OUT) +
|
||||
# (int16_t)T0;
|
||||
def boot(self):
|
||||
"""Reset the sensor, restoring all configuration registers to their defaults"""
|
||||
self._boot = True
|
||||
|
|
@ -306,4 +243,4 @@ class HTS221: # pylint: disable=too-many-instance-attributes
|
|||
if not Rate.is_valid(value):
|
||||
raise AttributeError("data_rate must be a `Rate`")
|
||||
|
||||
self._data_rate = value
|
||||
self._data_rate = value
|
||||
|
|
|
|||
123
docs/conf.py
123
docs/conf.py
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('..'))
|
||||
|
||||
sys.path.insert(0, os.path.abspath(".."))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
|
|
@ -10,42 +11,52 @@ sys.path.insert(0, os.path.abspath('..'))
|
|||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.napoleon',
|
||||
'sphinx.ext.todo',
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinx.ext.todo",
|
||||
]
|
||||
|
||||
# TODO: Please Read!
|
||||
# Uncomment the below if you use native CircuitPython modules such as
|
||||
# digitalio, micropython and busio. List the modules you use. Without it, the
|
||||
# autodoc module docs will fail to generate with a warning.
|
||||
# autodoc_mock_imports = ["digitalio", "busio"]
|
||||
autodoc_mock_imports = ["micropython", "adafruit_bus_device", "adafruit_register"]
|
||||
|
||||
|
||||
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'Register': ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
|
||||
intersphinx_mapping = {
|
||||
"python": ("https://docs.python.org/3.4", None),
|
||||
"BusDevice": (
|
||||
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
|
||||
None,
|
||||
),
|
||||
"Register": (
|
||||
"https://circuitpython.readthedocs.io/projects/register/en/latest/",
|
||||
None,
|
||||
),
|
||||
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
|
||||
}
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
templates_path = ["_templates"]
|
||||
|
||||
source_suffix = '.rst'
|
||||
source_suffix = ".rst"
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
master_doc = "index"
|
||||
|
||||
# General information about the project.
|
||||
project = u'Adafruit HTS221 Library'
|
||||
copyright = u'2020 Bryan Siepert'
|
||||
author = u'Bryan Siepert'
|
||||
project = "Adafruit HTS221 Library"
|
||||
copyright = "2020 Bryan Siepert"
|
||||
author = "Bryan Siepert"
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = u'1.0'
|
||||
version = "1.0"
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = u'1.0'
|
||||
release = "1.0"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
@ -57,7 +68,7 @@ language = None
|
|||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This patterns also effect to html_static_path and html_extra_path
|
||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
|
||||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
|
|
@ -69,7 +80,7 @@ default_role = "any"
|
|||
add_function_parentheses = True
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
pygments_style = "sphinx"
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = False
|
||||
|
|
@ -84,59 +95,62 @@ napoleon_numpy_docstring = False
|
|||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
||||
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
|
||||
|
||||
if not on_rtd: # only import and set the theme if we're building docs locally
|
||||
try:
|
||||
import sphinx_rtd_theme
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
|
||||
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
|
||||
except:
|
||||
html_theme = 'default'
|
||||
html_theme_path = ['.']
|
||||
html_theme = "default"
|
||||
html_theme_path = ["."]
|
||||
else:
|
||||
html_theme_path = ['.']
|
||||
html_theme_path = ["."]
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
html_static_path = ["_static"]
|
||||
|
||||
# The name of an image file (relative to this directory) to use as a favicon of
|
||||
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#
|
||||
html_favicon = '_static/favicon.ico'
|
||||
html_favicon = "_static/favicon.ico"
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'AdafruitHts221Librarydoc'
|
||||
htmlhelp_basename = "AdafruitHts221Librarydoc"
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'AdafruitHTS221Library.tex', u'AdafruitHTS221 Library Documentation',
|
||||
author, 'manual'),
|
||||
(
|
||||
master_doc,
|
||||
"AdafruitHTS221Library.tex",
|
||||
"AdafruitHTS221 Library Documentation",
|
||||
author,
|
||||
"manual",
|
||||
),
|
||||
]
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
|
@ -144,8 +158,13 @@ latex_documents = [
|
|||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'AdafruitHTS221library', u'Adafruit HTS221 Library Documentation',
|
||||
[author], 1)
|
||||
(
|
||||
master_doc,
|
||||
"AdafruitHTS221library",
|
||||
"Adafruit HTS221 Library Documentation",
|
||||
[author],
|
||||
1,
|
||||
)
|
||||
]
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
|
@ -154,7 +173,13 @@ man_pages = [
|
|||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'AdafruitHTS221Library', u'Adafruit HTS221 Library Documentation',
|
||||
author, 'AdafruitHTS221Library', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
(
|
||||
master_doc,
|
||||
"AdafruitHTS221Library",
|
||||
"Adafruit HTS221 Library Documentation",
|
||||
author,
|
||||
"AdafruitHTS221Library",
|
||||
"One line description of project.",
|
||||
"Miscellaneous",
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -23,14 +23,11 @@ Table of Contents
|
|||
.. toctree::
|
||||
:caption: Tutorials
|
||||
|
||||
.. todo:: Add any Learn guide links here. If there are none, then simply delete this todo and leave
|
||||
the toctree above for use later.
|
||||
|
||||
.. toctree::
|
||||
:caption: Related Products
|
||||
|
||||
.. todo:: Add any product links here. If there are none, then simply delete this todo and leave
|
||||
the toctree above for use later.
|
||||
* `HTS221 Breakout <https://www.adafruit.com/products/4535>`_
|
||||
|
||||
.. toctree::
|
||||
:caption: Other Links
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@ import time
|
|||
import board
|
||||
import busio
|
||||
import adafruit_hts221
|
||||
print("poop")
|
||||
|
||||
i2c = busio.I2C(board.SCL, board.SDA)
|
||||
hts = adafruit_hts221.HTS221(i2c)
|
||||
print("got out of init")
|
||||
while True:
|
||||
print("Humidity: %.2f percent rH" % hts.humidity)
|
||||
print("Temperature: %.2f C" % hts.temperature)
|
||||
time.sleep(1)
|
||||
time.sleep(1)
|
||||
|
|
|
|||
56
setup.py
56
setup.py
|
|
@ -6,6 +6,7 @@ https://github.com/pypa/sampleproject
|
|||
"""
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
# To use a consistent encoding
|
||||
from codecs import open
|
||||
from os import path
|
||||
|
|
@ -13,54 +14,45 @@ 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:
|
||||
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
|
||||
long_description = f.read()
|
||||
|
||||
setup(
|
||||
name='adafruit-circuitpython-hts221',
|
||||
|
||||
name="adafruit-circuitpython-hts221",
|
||||
use_scm_version=True,
|
||||
setup_requires=['setuptools_scm'],
|
||||
|
||||
description='Helper library for the HTS221 Humidity and Temperature Sensor',
|
||||
setup_requires=["setuptools_scm"],
|
||||
description="Helper library for the HTS221 Humidity and Temperature Sensor",
|
||||
long_description=long_description,
|
||||
long_description_content_type='text/x-rst',
|
||||
|
||||
long_description_content_type="text/x-rst",
|
||||
# The project's main homepage.
|
||||
url='https://github.com/adafruit/Adafruit_CircuitPython_HTS221',
|
||||
|
||||
url="https://github.com/adafruit/Adafruit_CircuitPython_HTS221",
|
||||
# Author details
|
||||
author='Adafruit Industries',
|
||||
author_email='circuitpython@adafruit.com',
|
||||
|
||||
author="Adafruit Industries",
|
||||
author_email="circuitpython@adafruit.com",
|
||||
install_requires=[
|
||||
'Adafruit-Blinka',
|
||||
'adafruit-circuitpython-busdevice',
|
||||
'adafruit-circuitpython-register'
|
||||
"Adafruit-Blinka",
|
||||
"adafruit-circuitpython-busdevice",
|
||||
"adafruit-circuitpython-register",
|
||||
],
|
||||
|
||||
# Choose your license
|
||||
license='MIT',
|
||||
|
||||
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',
|
||||
"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 blinka circuitpython micropython hts221 relative humidity temperature '
|
||||
'ST',
|
||||
|
||||
keywords="adafruit blinka circuitpython micropython hts221 relative humidity temperature "
|
||||
"ST",
|
||||
# You can just specify the packages manually here if your project is
|
||||
# simple. Or you can use find_packages().
|
||||
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
|
||||
# CHANGE `py_modules=['...']` TO `packages=['...']`
|
||||
py_modules=['adafruit_hts221'],
|
||||
py_modules=["adafruit_hts221"],
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue