Skip to content

Update docs and examples #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/_static/favicon.ico.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries

SPDX-License-Identifier: CC-BY-4.0
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
.. use this format as the module name: "adafruit_foo.foo"

.. automodule:: sparkfun_qwiicas3935
:members:
:members:
4 changes: 4 additions & 0 deletions docs/api.rst.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams

SPDX-License-Identifier: MIT
128 changes: 80 additions & 48 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,63 @@
# -*- coding: utf-8 -*-

# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
#
# SPDX-License-Identifier: MIT

import os
import sys
sys.path.insert(0, os.path.abspath('..'))

sys.path.insert(0, os.path.abspath(".."))

# -- General configuration ------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# 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",
]

autodoc_mock_imports = ["digitalio", "busio"]
# 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"]


intersphinx_mapping = {'python': ('https://docs.python.org/3.4', 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),

"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
}

# Show the docstring from both the class and its __init__() method.
autoclass_content = "both"

# 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'Sparkfun QwiicAS3935 Library'
copyright = u'2019 Gaston Williams'
author = u'Gaston Williams'
project = "Sparkfun CircuitPython QwiicAS3935 Library"
copyright = "2021 Gaston Williams"
author = "Gaston Williams"

# 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.
Expand All @@ -53,7 +69,13 @@
# 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.
Expand All @@ -65,7 +87,7 @@
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
Expand All @@ -80,68 +102,72 @@
# 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 = 'SparkfunQwiicas3935Librarydoc'
htmlhelp_basename = "Sparkfun_CircuitPython_Qwiicas3935_Librarydoc"

# -- 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, 'SparkfunQwiicAS3935Library.tex', u'SparkfunQwiicAS3935 Library Documentation',
author, 'manual'),
(
master_doc,
"Sparkfun_CircuitPython_QwiicAS3935_Library.tex",
"Sparkfun CircuitPython QwiicAS3935 Library Documentation",
author,
"manual",
),
]

# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'SparkfunQwiicAS3935library', u'Sparkfun QwiicAS3935 Library Documentation',
[author], 1)
(
master_doc,
"Sparkfun_CircuitPython_QwiicAS3935_Library",
"Sparkfun CircuitPython QwiicAS3935 Library Documentation",
[author],
1,
),
]

# -- Options for Texinfo output -------------------------------------------
Expand All @@ -150,7 +176,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'SparkfunQwiicAS3935Library', u'Sparkfun QwiicAS3935 Library Documentation',
author, 'SparkfunQwiicAS3935Library', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
"Sparkfun_CircuitPython_QwiicAS3935_Library",
"Sparkfun CircuitPython QwiicAS3935 Library Documentation",
author,
"Sparkfun_CircuitPython_QwiicAS3935_Library",
"One line description of project.",
"Miscellaneous",
),
]
4 changes: 4 additions & 0 deletions docs/examples.rst.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams

SPDX-License-Identifier: MIT
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ Table of Contents
.. toctree::
:caption: Other Links

Download <https://github.com/fourstix/Sparkfun_CircuitPython_QwiicAS3935/releases/latest>
Download from GitHub <https://github.com/fourstix/Sparkfun_CircuitPython_QwiicAS3935/releases/latest>
Download Library Bundle <https://circuitpython.org/libraries>
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
Discord Chat <https://adafru.it/discord>
Expand Down
4 changes: 4 additions & 0 deletions docs/index.rst.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams

SPDX-License-Identifier: MIT
5 changes: 5 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense

sphinx>=4.0.0
4 changes: 4 additions & 0 deletions examples/example1_basic_lightning_i2c.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams
#
# SPDX-License-Identifier: MIT

# This is example is for the SparkFun Qwiic AS3935 Lightning Detector.
# SparkFun sells these at its website: www.sparkfun.com
# Do you like this library? Help support SparkFun. Buy a board!
Expand Down
4 changes: 4 additions & 0 deletions examples/example1_basic_lightning_spi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams
#
# SPDX-License-Identifier: MIT

# This is example is for the SparkFun Qwiic AS3935 Lightning Detector.
# SparkFun sells these at its website: www.sparkfun.com
# Do you like this library? Help support SparkFun. Buy a board!
Expand Down
4 changes: 4 additions & 0 deletions examples/example2_more_lightning_features_i2c.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams
#
# SPDX-License-Identifier: MIT

# This is example is for the SparkFun Qwiic AS3935 Lightning Detector.
# SparkFun sells these at its website: www.sparkfun.com
# Do you like this library? Help support SparkFun. Buy a board!
Expand Down
4 changes: 4 additions & 0 deletions examples/example2_more_lightning_features_spi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams
#
# SPDX-License-Identifier: MIT

# This is example is for the SparkFun Qwiic AS3935 Lightning Detector.
# SparkFun sells these at its website: www.sparkfun.com
# Do you like this library? Help support SparkFun. Buy a board!
Expand Down
4 changes: 4 additions & 0 deletions examples/example3_tune_antenna_i2c.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams
#
# SPDX-License-Identifier: MIT

# This is example is for the SparkFun Qwiic AS3935 Lightning Detector.
# SparkFun sells these at its website: www.sparkfun.com
# Do you like this library? Help support SparkFun. Buy a board!
Expand Down
4 changes: 4 additions & 0 deletions examples/example3_tune_antenna_spi.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams
#
# SPDX-License-Identifier: MIT

# This is example is for the SparkFun Qwiic AS3935 Lightning Detector.
# SparkFun sells these at its website: www.sparkfun.com
# Do you like this library? Help support SparkFun. Buy a board!
Expand Down
4 changes: 4 additions & 0 deletions examples/qwiicas3935_simpletest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams
#
# SPDX-License-Identifier: MIT

# This is example is for the SparkFun Qwiic Relay.
# SparkFun sells these at its website: www.sparkfun.com
# Do you like this library? Help support SparkFun. Buy a board!
Expand Down
11 changes: 6 additions & 5 deletions sparkfun_qwiicas3935.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 Gaston Williams
#
# SPDX-License-Identifier: MIT
# The MIT License (MIT)
#
# Copyright (c) 2019 Gaston Williams
Expand Down Expand Up @@ -52,11 +56,11 @@
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
"""

# imports__version__ = "0.0.0-auto.0"
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/fourstix/Sparkfun_CircuitPython_QwiicAS3935.git"

# imports
from abc import ABC, abstractmethod
from time import sleep
from micropython import const

Expand Down Expand Up @@ -106,7 +110,7 @@
_DIV_MASK = const(0x3F)

# abstract base class
class Sparkfun_QwiicAS3935(ABC):
class Sparkfun_QwiicAS3935:
"""Abstract base class for Sparkfun AS3935 Lightning Detector.
Use the appropriate driver subclass Sprarkfun_QwiicAS3935_I2C() for I2C
or Sparkfun_QwiicAS3935_SPI() for SPI."""
Expand Down Expand Up @@ -511,15 +515,12 @@ def tune_cap(self, value):
self._write_register_bits(_FREQ_DISP_IRQ, _CAP_MASK, reg_value, 0)

# abstract methods
@abstractmethod
def _read_register(self, register):
pass

@abstractmethod
def _read_byte(self, register):
pass

@abstractmethod
def _write_register(self, register, value):
pass

Expand Down