Sphinx doc first cut
This commit is contained in:
parent
96534d6c0d
commit
036902b032
|
@ -0,0 +1,20 @@
|
||||||
|
# Minimal makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
# You can set these variables from the command line, and also
|
||||||
|
# from the environment for the first two.
|
||||||
|
SPHINXOPTS ?=
|
||||||
|
SPHINXBUILD ?= sphinx-build
|
||||||
|
SOURCEDIR = .
|
||||||
|
BUILDDIR = _build
|
||||||
|
|
||||||
|
# Put it first so that "make" without argument is like "make help".
|
||||||
|
help:
|
||||||
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
|
.PHONY: help Makefile
|
||||||
|
|
||||||
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
|
%: Makefile
|
||||||
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@ -0,0 +1,55 @@
|
||||||
|
# Configuration file for the Sphinx documentation builder.
|
||||||
|
#
|
||||||
|
# This file only contains a selection of the most common options. For a full
|
||||||
|
# list see the documentation:
|
||||||
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||||
|
|
||||||
|
# -- Path setup --------------------------------------------------------------
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
#
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
sys.path.insert(0, os.path.abspath('..'))
|
||||||
|
|
||||||
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
|
project = 'i2cdriver'
|
||||||
|
copyright = '2020, Excamera Labs'
|
||||||
|
author = 'Excamera Labs'
|
||||||
|
|
||||||
|
|
||||||
|
# -- 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"
|
||||||
|
]
|
||||||
|
|
||||||
|
intersphinx_mapping = {'https://docs.python.org/3/': None}
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
# This pattern also affects html_static_path and html_extra_path.
|
||||||
|
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output -------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
#
|
||||||
|
html_theme = 'alabaster'
|
||||||
|
|
||||||
|
# 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']
|
|
@ -0,0 +1,4 @@
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# pip install --upgrade --force-reinstall ..
|
||||||
|
make html
|
|
@ -0,0 +1,101 @@
|
||||||
|
.. i2cdriver documentation master file, created by
|
||||||
|
sphinx-quickstart on Thu Jan 16 10:21:28 2020.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
Excamera I2CDriver Python API
|
||||||
|
=============================
|
||||||
|
|
||||||
|
|
||||||
|
zxxx
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
xxcc
|
||||||
|
|
||||||
|
Official packages are available on PyPI.
|
||||||
|
|
||||||
|
https://pypi.org/project/i2cdriver/
|
||||||
|
|
||||||
|
|
||||||
|
The main page for I2CDriver includes the complete User Guide:
|
||||||
|
|
||||||
|
https://i2cdriver.com
|
||||||
|
|
||||||
|
|
||||||
|
System Requirements
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Because it is a pure Python module, ``i2cdriver`` can run on any system supported by ``pyserial``.
|
||||||
|
This includes:
|
||||||
|
|
||||||
|
- Windows 7 or 10
|
||||||
|
- Mac OS
|
||||||
|
- Linux, including all Ubuntu distributions
|
||||||
|
|
||||||
|
Both Python 2.7 and 3.x are supported.
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
The ``i2cdriver`` package can be installed from PyPI using ``pip``::
|
||||||
|
|
||||||
|
$ pip install i2cdriver
|
||||||
|
|
||||||
|
Quick start
|
||||||
|
-----------
|
||||||
|
|
||||||
|
To connect to the I2CDriver and scan the bus for connected devices::
|
||||||
|
|
||||||
|
>>> import i2cdriver
|
||||||
|
>>> i2c = i2cdriver.I2CDriver("/dev/ttyUSB0")
|
||||||
|
>>> i2c.scan()
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- 1C -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
48 -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
68 -- -- -- -- -- -- --
|
||||||
|
-- -- -- -- -- -- -- --
|
||||||
|
[28, 72, 104]
|
||||||
|
|
||||||
|
To read the temperature in Celsius from a connected LM75 sensor:
|
||||||
|
|
||||||
|
>>> d=i2cdriver.EDS.Temp(i2c)
|
||||||
|
>>> d.read()
|
||||||
|
17.875
|
||||||
|
>>> d.read()
|
||||||
|
18.0
|
||||||
|
|
||||||
|
The User Guide at https://i2cdriver.com has more examples.
|
||||||
|
|
||||||
|
Module Contents
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. autoclass:: i2cdriver.I2CDriver
|
||||||
|
:member-order: bysource
|
||||||
|
:members:
|
||||||
|
setspeed,
|
||||||
|
setpullups,
|
||||||
|
scan,
|
||||||
|
reset,
|
||||||
|
start,
|
||||||
|
read,
|
||||||
|
write,
|
||||||
|
stop,
|
||||||
|
regwr,
|
||||||
|
regrd,
|
||||||
|
getstatus,
|
||||||
|
monitor
|
||||||
|
|
||||||
|
.. autoclass:: i2cdriver.START
|
||||||
|
.. autoclass:: i2cdriver.STOP
|
||||||
|
.. autoclass:: i2cdriver.BYTE
|
Loading…
Reference in New Issue