Compare commits
No commits in common. "remove-bad-whitespace-directive" and "master" have entirely different histories.
remove-bad
...
master
23 changed files with 213 additions and 629 deletions
57
.github/workflows/build.yml
vendored
57
.github/workflows/build.yml
vendored
|
|
@ -1,57 +0,0 @@
|
||||||
name: Build CI
|
|
||||||
|
|
||||||
on: [pull_request, push]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Dump GitHub context
|
|
||||||
env:
|
|
||||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
||||||
run: echo "$GITHUB_CONTEXT"
|
|
||||||
- name: Translate Repo Name For Build Tools filename_prefix
|
|
||||||
id: repo-name
|
|
||||||
run: |
|
|
||||||
echo ::set-output name=repo-name::$(
|
|
||||||
echo ${{ github.repository }} |
|
|
||||||
awk -F '\/' '{ print tolower($2) }' |
|
|
||||||
tr '_' '-'
|
|
||||||
)
|
|
||||||
- name: Set up Python 3.6
|
|
||||||
uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: 3.6
|
|
||||||
- name: Versions
|
|
||||||
run: |
|
|
||||||
python3 --version
|
|
||||||
- name: Checkout Current Repo
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Checkout tools repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: adafruit/actions-ci-circuitpython-libs
|
|
||||||
path: actions-ci
|
|
||||||
- name: Install dependencies
|
|
||||||
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
|
|
||||||
run: |
|
|
||||||
source actions-ci/install.sh
|
|
||||||
- name: Pip install pylint, black, & Sphinx
|
|
||||||
run: |
|
|
||||||
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
|
|
||||||
- name: Library version
|
|
||||||
run: git describe --dirty --always --tags
|
|
||||||
- name: Check formatting
|
|
||||||
run: |
|
|
||||||
black --check --target-version=py35 .
|
|
||||||
- name: PyLint
|
|
||||||
run: |
|
|
||||||
pylint $( find . -path './adafruit*.py' )
|
|
||||||
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" ))
|
|
||||||
- name: Build assets
|
|
||||||
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
|
|
||||||
- name: Build docs
|
|
||||||
working-directory: docs
|
|
||||||
run: sphinx-build -E -W -b html . _build/html
|
|
||||||
81
.github/workflows/release.yml
vendored
81
.github/workflows/release.yml
vendored
|
|
@ -1,81 +0,0 @@
|
||||||
name: Release Actions
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
upload-release-assets:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Dump GitHub context
|
|
||||||
env:
|
|
||||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
||||||
run: echo "$GITHUB_CONTEXT"
|
|
||||||
- name: Translate Repo Name For Build Tools filename_prefix
|
|
||||||
id: repo-name
|
|
||||||
run: |
|
|
||||||
echo ::set-output name=repo-name::$(
|
|
||||||
echo ${{ github.repository }} |
|
|
||||||
awk -F '\/' '{ print tolower($2) }' |
|
|
||||||
tr '_' '-'
|
|
||||||
)
|
|
||||||
- name: Set up Python 3.6
|
|
||||||
uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: 3.6
|
|
||||||
- name: Versions
|
|
||||||
run: |
|
|
||||||
python3 --version
|
|
||||||
- name: Checkout Current Repo
|
|
||||||
uses: actions/checkout@v1
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Checkout tools repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: adafruit/actions-ci-circuitpython-libs
|
|
||||||
path: actions-ci
|
|
||||||
- name: Install deps
|
|
||||||
run: |
|
|
||||||
source actions-ci/install.sh
|
|
||||||
- name: Build assets
|
|
||||||
run: circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
|
|
||||||
- name: Upload Release Assets
|
|
||||||
# the 'official' actions version does not yet support dynamically
|
|
||||||
# supplying asset names to upload. @csexton's version chosen based on
|
|
||||||
# discussion in the issue below, as its the simplest to implement and
|
|
||||||
# allows for selecting files with a pattern.
|
|
||||||
# https://github.com/actions/upload-release-asset/issues/4
|
|
||||||
#uses: actions/upload-release-asset@v1.0.1
|
|
||||||
uses: csexton/release-asset-action@master
|
|
||||||
with:
|
|
||||||
pattern: "bundles/*"
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
upload-pypi:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: Check For setup.py
|
|
||||||
id: need-pypi
|
|
||||||
run: |
|
|
||||||
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
|
|
||||||
- name: Set up Python
|
|
||||||
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
|
|
||||||
uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
- name: Install dependencies
|
|
||||||
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install setuptools wheel twine
|
|
||||||
- name: Build and publish
|
|
||||||
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
|
|
||||||
env:
|
|
||||||
TWINE_USERNAME: ${{ secrets.pypi_username }}
|
|
||||||
TWINE_PASSWORD: ${{ secrets.pypi_password }}
|
|
||||||
run: |
|
|
||||||
python setup.py sdist
|
|
||||||
twine upload dist/*
|
|
||||||
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -1,11 +1,6 @@
|
||||||
*.mpy
|
|
||||||
.idea
|
|
||||||
__pycache__
|
__pycache__
|
||||||
_build
|
_build
|
||||||
*.pyc
|
*.pyc
|
||||||
.env
|
.env
|
||||||
|
build*
|
||||||
bundles
|
bundles
|
||||||
*.DS_Store
|
|
||||||
.eggs
|
|
||||||
dist
|
|
||||||
**/*.egg-info
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ confidence=
|
||||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||||
# --disable=W"
|
# --disable=W"
|
||||||
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
|
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
|
||||||
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation
|
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error
|
||||||
|
|
||||||
# Enable the message, report, category or checker with the given id(s). You can
|
# Enable the message, report, category or checker with the given id(s). You can
|
||||||
# either give multiple identifier separated by comma (,) or put this option
|
# either give multiple identifier separated by comma (,) or put this option
|
||||||
|
|
@ -156,7 +156,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local
|
||||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||||
# and thus existing member attributes cannot be deduced by static analysis. It
|
# and thus existing member attributes cannot be deduced by static analysis. It
|
||||||
# supports qualified module names, as well as Unix pattern matching.
|
# supports qualified module names, as well as Unix pattern matching.
|
||||||
ignored-modules=board
|
ignored-modules=
|
||||||
|
|
||||||
# Show a hint with possible names when a member name was not found. The aspect
|
# Show a hint with possible names when a member name was not found. The aspect
|
||||||
# of finding the hint is based on edit distance.
|
# of finding the hint is based on edit distance.
|
||||||
|
|
|
||||||
31
.travis.yml
Normal file
31
.travis.yml
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
# This is a common .travis.yml for generating library release zip files for
|
||||||
|
# CircuitPython library releases using circuitpython-build-tools.
|
||||||
|
# See https://github.com/adafruit/circuitpython-build-tools for detailed setup
|
||||||
|
# instructions.
|
||||||
|
|
||||||
|
dist: trusty
|
||||||
|
sudo: false
|
||||||
|
language: python
|
||||||
|
python:
|
||||||
|
- "3.6"
|
||||||
|
|
||||||
|
cache:
|
||||||
|
pip: true
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
provider: releases
|
||||||
|
api_key: $GITHUB_TOKEN
|
||||||
|
file_glob: true
|
||||||
|
file: bundles/*
|
||||||
|
skip_cleanup: true
|
||||||
|
overwrite: true
|
||||||
|
on:
|
||||||
|
tags: true
|
||||||
|
|
||||||
|
install:
|
||||||
|
- pip install pylint circuitpython-build-tools
|
||||||
|
|
||||||
|
script:
|
||||||
|
- pylint adafruit_apds9960.py
|
||||||
|
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)
|
||||||
|
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-apds9960 --library_location .
|
||||||
|
|
@ -1,129 +1,74 @@
|
||||||
# Adafruit Community Code of Conduct
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
## Our Pledge
|
## Our Pledge
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, we as
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
contributors and leaders pledge to making participation in our project and
|
contributors and maintainers pledge to making participation in our project and
|
||||||
our community a harassment-free experience for everyone, regardless of age, body
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
size, disability, ethnicity, gender identity and expression, level or type of
|
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||||
experience, education, socio-economic status, nationality, personal appearance,
|
nationality, personal appearance, race, religion, or sexual identity and
|
||||||
race, religion, or sexual identity and orientation.
|
orientation.
|
||||||
|
|
||||||
## Our Standards
|
## Our Standards
|
||||||
|
|
||||||
We are committed to providing a friendly, safe and welcoming environment for
|
|
||||||
all.
|
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment
|
Examples of behavior that contributes to creating a positive environment
|
||||||
include:
|
include:
|
||||||
|
|
||||||
* Be kind and courteous to others
|
|
||||||
* Using welcoming and inclusive language
|
* Using welcoming and inclusive language
|
||||||
* Being respectful of differing viewpoints and experiences
|
* Being respectful of differing viewpoints and experiences
|
||||||
* Collaborating with other community members
|
|
||||||
* Gracefully accepting constructive criticism
|
* Gracefully accepting constructive criticism
|
||||||
* Focusing on what is best for the community
|
* Focusing on what is best for the community
|
||||||
* Showing empathy towards other community members
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
* The use of sexualized language or imagery and sexual attention or advances
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
* The use of inappropriate images, including in a community member's avatar
|
advances
|
||||||
* The use of inappropriate language, including in a community member's nickname
|
|
||||||
* Any spamming, flaming, baiting or other attention-stealing behavior
|
|
||||||
* Excessive or unwelcome helping; answering outside the scope of the question
|
|
||||||
asked
|
|
||||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
* Promoting or spreading disinformation, lies, or conspiracy theories against
|
|
||||||
a person, group, organisation, project, or community
|
|
||||||
* Public or private harassment
|
* Public or private harassment
|
||||||
* Publishing others' private information, such as a physical or electronic
|
* Publishing others' private information, such as a physical or electronic
|
||||||
address, without explicit permission
|
address, without explicit permission
|
||||||
* Other conduct which could reasonably be considered inappropriate
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
The goal of the standards and moderation guidelines outlined here is to build
|
|
||||||
and maintain a respectful community. We ask that you don’t just aim to be
|
|
||||||
"technically unimpeachable", but rather try to be your best self.
|
|
||||||
|
|
||||||
We value many things beyond technical expertise, including collaboration and
|
|
||||||
supporting others within our community. Providing a positive experience for
|
|
||||||
other community members can have a much more significant impact than simply
|
|
||||||
providing the correct answer.
|
|
||||||
|
|
||||||
## Our Responsibilities
|
## Our Responsibilities
|
||||||
|
|
||||||
Project leaders are responsible for clarifying the standards of acceptable
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
behavior and are expected to take appropriate and fair corrective action in
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
response to any instances of unacceptable behavior.
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
Project leaders have the right and responsibility to remove, edit, or
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
reject messages, comments, commits, code, issues, and other contributions
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
permanently any community member for other behaviors that they deem
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
inappropriate, threatening, offensive, or harmful.
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
## Moderation
|
|
||||||
|
|
||||||
Instances of behaviors that violate the Adafruit Community Code of Conduct
|
|
||||||
may be reported by any member of the community. Community members are
|
|
||||||
encouraged to report these situations, including situations they witness
|
|
||||||
involving other community members.
|
|
||||||
|
|
||||||
You may report in the following ways:
|
|
||||||
|
|
||||||
In any situation, you may send an email to <support@adafruit.com>.
|
|
||||||
|
|
||||||
On the Adafruit Discord, you may send an open message from any channel
|
|
||||||
to all Community Moderators by tagging @community moderators. You may
|
|
||||||
also send an open message from any channel, or a direct message to
|
|
||||||
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
|
|
||||||
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
|
|
||||||
|
|
||||||
Email and direct message reports will be kept confidential.
|
|
||||||
|
|
||||||
In situations on Discord where the issue is particularly egregious, possibly
|
|
||||||
illegal, requires immediate action, or violates the Discord terms of service,
|
|
||||||
you should also report the message directly to Discord.
|
|
||||||
|
|
||||||
These are the steps for upholding our community’s standards of conduct.
|
|
||||||
|
|
||||||
1. Any member of the community may report any situation that violates the
|
|
||||||
Adafruit Community Code of Conduct. All reports will be reviewed and
|
|
||||||
investigated.
|
|
||||||
2. If the behavior is an egregious violation, the community member who
|
|
||||||
committed the violation may be banned immediately, without warning.
|
|
||||||
3. Otherwise, moderators will first respond to such behavior with a warning.
|
|
||||||
4. Moderators follow a soft "three strikes" policy - the community member may
|
|
||||||
be given another chance, if they are receptive to the warning and change their
|
|
||||||
behavior.
|
|
||||||
5. If the community member is unreceptive or unreasonable when warned by a
|
|
||||||
moderator, or the warning goes unheeded, they may be banned for a first or
|
|
||||||
second offense. Repeated offenses will result in the community member being
|
|
||||||
banned.
|
|
||||||
|
|
||||||
## Scope
|
## Scope
|
||||||
|
|
||||||
This Code of Conduct and the enforcement policies listed above apply to all
|
|
||||||
Adafruit Community venues. This includes but is not limited to any community
|
|
||||||
spaces (both public and private), the entire Adafruit Discord server, and
|
|
||||||
Adafruit GitHub repositories. Examples of Adafruit Community spaces include
|
|
||||||
but are not limited to meet-ups, audio chats on the Adafruit Discord, or
|
|
||||||
interaction at a conference.
|
|
||||||
|
|
||||||
This Code of Conduct applies both within project spaces and in public spaces
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
when an individual is representing the project or its community. As a community
|
when an individual is representing the project or its community. Examples of
|
||||||
member, you are representing our community, and are expected to behave
|
representing a project or community include using an official project e-mail
|
||||||
accordingly.
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at support@adafruit.com. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
## Attribution
|
## Attribution
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
version 1.4, available at
|
available at [http://contributor-covenant.org/version/1/4][version]
|
||||||
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>,
|
|
||||||
and the [Rust Code of Conduct](https://www.rust-lang.org/en-US/conduct.html).
|
|
||||||
|
|
||||||
For other projects adopting the Adafruit Community Code of
|
[homepage]: http://contributor-covenant.org
|
||||||
Conduct, please contact the maintainers of those projects for enforcement.
|
[version]: http://contributor-covenant.org/version/1/4/
|
||||||
If you wish to use this code of conduct for your own project, consider
|
|
||||||
explicitly mentioning your moderation policy or making a copy with your
|
|
||||||
own moderation policy so as to avoid confusion.
|
|
||||||
|
|
|
||||||
21
LICENSE
21
LICENSE
|
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2017 Michael McWethy for Adafruit Inc
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
90
README.rst
90
README.rst
|
|
@ -2,25 +2,23 @@
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
|
|
||||||
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-apds9960/badge/?version=latest
|
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-APDS9960/badge/?version=latest
|
||||||
:target: https://circuitpython.readthedocs.io/projects/apds9960/en/latest/
|
|
||||||
|
:target: https://circuitpython.readthedocs.io/projects/apds/en/latest/
|
||||||
|
|
||||||
:alt: Documentation Status
|
:alt: Documentation Status
|
||||||
|
|
||||||
.. image :: https://img.shields.io/discord/327254708534116352.svg
|
.. image :: https://img.shields.io/discord/327254708534116352.svg
|
||||||
:target: https://discord.gg/nBQh6qu
|
:target: https://discord.gg/nBQh6qu
|
||||||
:alt: Discord
|
:alt: Discord
|
||||||
|
|
||||||
.. image:: https://github.com/adafruit/Adafruit_CircuitPython_APDS9960/workflows/Build%20CI/badge.svg
|
|
||||||
:target: https://github.com/adafruit/Adafruit_CircuitPython_APDS9960/actions/
|
|
||||||
:alt: Build Status
|
|
||||||
|
|
||||||
The APDS9960 is a specialize chip that detects hand gestures, proximity detection
|
The APDS9960 is a specialize chip that detects hand gestures, proximity detection
|
||||||
and ambient light color over I2C. Its available on
|
and ambient light color over I2C. Its available on
|
||||||
`Adafruit as a breakout <https://www.adafruit.com/product/3595>`_.
|
`Adafruit as a breakout <https://www.adafruit.com/product/3595>`_.
|
||||||
|
|
||||||
|
|
||||||
Installation and Dependencies
|
Dependencies
|
||||||
=============================
|
=============
|
||||||
This driver depends on:
|
This driver depends on:
|
||||||
|
|
||||||
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
|
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
|
||||||
|
|
@ -29,52 +27,9 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
|
||||||
This is easily achieved by downloading
|
This is easily achieved by downloading
|
||||||
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
|
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
|
||||||
|
|
||||||
Installing from PyPI
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from PyPI <https://pypi.org/project/adafruit-circuitpython-apds9960/>`_. To install for current user:
|
|
||||||
|
|
||||||
.. code-block:: shell
|
|
||||||
|
|
||||||
pip3 install adafruit-circuitpython-apds9960
|
|
||||||
|
|
||||||
To install system-wide (this may be required in some cases):
|
|
||||||
|
|
||||||
.. code-block:: shell
|
|
||||||
|
|
||||||
sudo pip3 install adafruit-circuitpython-apds9960
|
|
||||||
|
|
||||||
To install in a virtual environment in your current project:
|
|
||||||
|
|
||||||
.. code-block:: shell
|
|
||||||
|
|
||||||
mkdir project-name && cd project-name
|
|
||||||
python3 -m venv .env
|
|
||||||
source .env/bin/activate
|
|
||||||
pip3 install adafruit-circuitpython-apds9960
|
|
||||||
|
|
||||||
Usage Example
|
Usage Example
|
||||||
=============
|
=============
|
||||||
|
|
||||||
.. code-block:: python
|
|
||||||
|
|
||||||
import board
|
|
||||||
import busio
|
|
||||||
import digitalio
|
|
||||||
from adafruit_apds9960.apds9960 import APDS9960
|
|
||||||
|
|
||||||
i2c = busio.I2C(board.SCL, board.SDA)
|
|
||||||
int_pin = digitalio.DigitalInOut(board.D5)
|
|
||||||
apds = APDS9960(i2c, interrupt_pin=int_pin)
|
|
||||||
|
|
||||||
apds.enable_proximity = True
|
|
||||||
apds.proximity_interrupt_threshold = (0, 175)
|
|
||||||
apds.enable_proximity_interrupt = True
|
|
||||||
|
|
||||||
while True:
|
|
||||||
print(apds.proximity)
|
|
||||||
apds.clear_interrupt()
|
|
||||||
|
|
||||||
Hardware Set-up
|
Hardware Set-up
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
|
@ -153,12 +108,20 @@ To check for a object in proximity, see if a gesture is available first, then ge
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if not interrupt_pin.value:
|
if not interrupt_pin.value:
|
||||||
print(apds.proximity)
|
print(apds.proximity())
|
||||||
|
|
||||||
# clear the interrupt
|
# clear the interrupt
|
||||||
apds.clear_interrupt()
|
apds.clear_interrupt()
|
||||||
|
|
||||||
|
|
||||||
|
API Reference
|
||||||
|
=============
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
api
|
||||||
|
|
||||||
Contributing
|
Contributing
|
||||||
============
|
============
|
||||||
|
|
||||||
|
|
@ -189,26 +152,3 @@ Then run the build:
|
||||||
.. code-block::shell
|
.. code-block::shell
|
||||||
|
|
||||||
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-apds --library_location .
|
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-apds --library_location .
|
||||||
|
|
||||||
Sphinx documentation
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
Sphinx is used to build the documentation based on rST files and comments in the code. First,
|
|
||||||
install dependencies (feel free to reuse the virtual environment from above):
|
|
||||||
|
|
||||||
.. code-block:: shell
|
|
||||||
|
|
||||||
python3 -m venv .env
|
|
||||||
source .env/bin/activate
|
|
||||||
pip install Sphinx sphinx-rtd-theme
|
|
||||||
|
|
||||||
Now, once you have the virtual environment activated:
|
|
||||||
|
|
||||||
.. code-block:: shell
|
|
||||||
|
|
||||||
cd docs
|
|
||||||
sphinx-build -E -W -b html . _build/html
|
|
||||||
|
|
||||||
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
|
|
||||||
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
|
|
||||||
locally verify it will pass.
|
|
||||||
|
|
|
||||||
|
|
@ -35,13 +35,12 @@ from adafruit_register.i2c_bit import RWBit
|
||||||
from adafruit_bus_device.i2c_device import I2CDevice
|
from adafruit_bus_device.i2c_device import I2CDevice
|
||||||
from micropython import const
|
from micropython import const
|
||||||
|
|
||||||
__version__ = "0.0.0-auto.0"
|
|
||||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_APDS9960.git"
|
|
||||||
|
|
||||||
# ADDRESS_DEF = const(0x39)
|
# ADDRESS_DEF = const(0x39)
|
||||||
# INTEGRATION_TIME_DEF = const(0x01)
|
# INTEGRATION_TIME_DEF = const(0x01)
|
||||||
# GAIN_DEF = const(0x01)
|
# GAIN_DEF = const(0x01)
|
||||||
|
|
||||||
|
#pylint: disable-msg=bad-whitespace
|
||||||
#APDS9960_RAM = const(0x00)
|
#APDS9960_RAM = const(0x00)
|
||||||
APDS9960_ENABLE = const(0x80)
|
APDS9960_ENABLE = const(0x80)
|
||||||
APDS9960_ATIME = const(0x81)
|
APDS9960_ATIME = const(0x81)
|
||||||
|
|
@ -92,6 +91,7 @@ APDS9960_GFIFO_U = const(0xFC)
|
||||||
# APDS9960_GFIFO_D = const(0xFD)
|
# APDS9960_GFIFO_D = const(0xFD)
|
||||||
# APDS9960_GFIFO_L = const(0xFE)
|
# APDS9960_GFIFO_L = const(0xFE)
|
||||||
# APDS9960_GFIFO_R = const(0xFF)
|
# APDS9960_GFIFO_R = const(0xFF)
|
||||||
|
#pylint: enable-msg=bad-whitespace
|
||||||
|
|
||||||
|
|
||||||
#pylint: disable-msg=too-many-instance-attributes
|
#pylint: disable-msg=too-many-instance-attributes
|
||||||
|
|
@ -105,9 +105,12 @@ class APDS9960:
|
||||||
_gesture_mode = RWBit(APDS9960_GCONF4, 0)
|
_gesture_mode = RWBit(APDS9960_GCONF4, 0)
|
||||||
_proximity_persistance = RWBits(4, APDS9960_PERS, 4)
|
_proximity_persistance = RWBits(4, APDS9960_PERS, 4)
|
||||||
|
|
||||||
def __init__(
|
def __init__(self,
|
||||||
self, i2c, *, interrupt_pin=None, address=0x39, integration_time=0x01, gain=0x01
|
i2c, *,
|
||||||
):
|
interrupt_pin=None,
|
||||||
|
address=0x39,
|
||||||
|
integration_time=0x01,
|
||||||
|
gain=0x01):
|
||||||
|
|
||||||
self.buf129 = None
|
self.buf129 = None
|
||||||
self.buf2 = bytearray(2)
|
self.buf2 = bytearray(2)
|
||||||
|
|
@ -150,6 +153,7 @@ class APDS9960:
|
||||||
self._saw_left_start = 0
|
self._saw_left_start = 0
|
||||||
self._saw_right_start = 0
|
self._saw_right_start = 0
|
||||||
|
|
||||||
|
|
||||||
enable = RWBit(APDS9960_ENABLE, 0)
|
enable = RWBit(APDS9960_ENABLE, 0)
|
||||||
"""Board enable. True to enable, False to disable"""
|
"""Board enable. True to enable, False to disable"""
|
||||||
enable_color = RWBit(APDS9960_ENABLE, 1)
|
enable_color = RWBit(APDS9960_ENABLE, 1)
|
||||||
|
|
@ -206,13 +210,8 @@ class APDS9960:
|
||||||
if n_recs:
|
if n_recs:
|
||||||
|
|
||||||
with self.i2c_device as i2c:
|
with self.i2c_device as i2c:
|
||||||
i2c.write_then_readinto(
|
i2c.write(buffer, end=1, stop=False)
|
||||||
buffer,
|
i2c.readinto(buffer, start=1, end=min(129, 1 + n_recs * 4))
|
||||||
buffer,
|
|
||||||
out_end=1,
|
|
||||||
in_start=1,
|
|
||||||
in_end=min(129, 1 + n_recs * 4),
|
|
||||||
)
|
|
||||||
upp, down, left, right = buffer[1:5]
|
upp, down, left, right = buffer[1:5]
|
||||||
|
|
||||||
if abs(upp - down) > 13:
|
if abs(upp - down) > 13:
|
||||||
|
|
@ -281,12 +280,10 @@ class APDS9960:
|
||||||
@property
|
@property
|
||||||
def color_data(self):
|
def color_data(self):
|
||||||
"""Tuple containing r, g, b, c values"""
|
"""Tuple containing r, g, b, c values"""
|
||||||
return (
|
return self._color_data16(APDS9960_CDATAL + 2), \
|
||||||
self._color_data16(APDS9960_CDATAL + 2),
|
self._color_data16(APDS9960_CDATAL + 4), \
|
||||||
self._color_data16(APDS9960_CDATAL + 4),
|
self._color_data16(APDS9960_CDATAL + 6), \
|
||||||
self._color_data16(APDS9960_CDATAL + 6),
|
self._color_data16(APDS9960_CDATAL)
|
||||||
self._color_data16(APDS9960_CDATAL),
|
|
||||||
)
|
|
||||||
|
|
||||||
### PROXIMITY
|
### PROXIMITY
|
||||||
@property
|
@property
|
||||||
|
|
@ -296,11 +293,9 @@ class APDS9960:
|
||||||
When setting the proximity interrupt threshold values using a tuple of
|
When setting the proximity interrupt threshold values using a tuple of
|
||||||
zero to three values: low threshold, high threshold, persistance.
|
zero to three values: low threshold, high threshold, persistance.
|
||||||
persistance defaults to 4 if not provided"""
|
persistance defaults to 4 if not provided"""
|
||||||
return (
|
return self._read8(APDS9960_PILT), \
|
||||||
self._read8(APDS9960_PILT),
|
self._read8(APDS9960_PIHT), \
|
||||||
self._read8(APDS9960_PIHT),
|
self._proximity_persistance
|
||||||
self._proximity_persistance,
|
|
||||||
)
|
|
||||||
|
|
||||||
@proximity_interrupt_threshold.setter
|
@proximity_interrupt_threshold.setter
|
||||||
def proximity_interrupt_threshold(self, setting_tuple):
|
def proximity_interrupt_threshold(self, setting_tuple):
|
||||||
|
|
@ -313,6 +308,7 @@ class APDS9960:
|
||||||
persist = min(setting_tuple[2], 7)
|
persist = min(setting_tuple[2], 7)
|
||||||
self._proximity_persistance = persist
|
self._proximity_persistance = persist
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def gesture_proximity_threshold(self):
|
def gesture_proximity_threshold(self):
|
||||||
"""Proximity threshold value: range 0-255"""
|
"""Proximity threshold value: range 0-255"""
|
||||||
|
|
@ -320,11 +316,10 @@ class APDS9960:
|
||||||
|
|
||||||
@gesture_proximity_threshold.setter
|
@gesture_proximity_threshold.setter
|
||||||
def gesture_proximity_threshold(self, thresh):
|
def gesture_proximity_threshold(self, thresh):
|
||||||
self._write8(APDS9960_GPENTH, thresh & 0xFF)
|
self._write8(APDS9960_GPENTH, thresh & 0xff)
|
||||||
|
|
||||||
@property
|
|
||||||
def proximity(self):
|
def proximity(self):
|
||||||
"""Proximity value: range 0-255"""
|
"""proximity value: range 0-255"""
|
||||||
return self._read8(APDS9960_PDATA)
|
return self._read8(APDS9960_PDATA)
|
||||||
|
|
||||||
def clear_interrupt(self):
|
def clear_interrupt(self):
|
||||||
|
|
@ -338,7 +333,7 @@ class APDS9960:
|
||||||
|
|
||||||
@integration_time.setter
|
@integration_time.setter
|
||||||
def integration_time(self, int_time):
|
def integration_time(self, int_time):
|
||||||
self._write8(APDS9960_ATIME, int_time & 0xFF)
|
self._write8(APDS9960_ATIME, int_time & 0xff)
|
||||||
|
|
||||||
# method for reading and writing to I2C
|
# method for reading and writing to I2C
|
||||||
def _write8(self, command, abyte):
|
def _write8(self, command, abyte):
|
||||||
|
|
@ -361,7 +356,8 @@ class APDS9960:
|
||||||
buf = self.buf2
|
buf = self.buf2
|
||||||
buf[0] = command
|
buf[0] = command
|
||||||
with self.i2c_device as i2c:
|
with self.i2c_device as i2c:
|
||||||
i2c.write_then_readinto(buf, buf, out_end=1, in_end=1)
|
i2c.write(buf, end=1)
|
||||||
|
i2c.readinto(buf, end=1)
|
||||||
return buf[0]
|
return buf[0]
|
||||||
|
|
||||||
def _color_data16(self, command):
|
def _color_data16(self, command):
|
||||||
|
|
@ -370,5 +366,6 @@ class APDS9960:
|
||||||
buf = self.buf2
|
buf = self.buf2
|
||||||
buf[0] = command
|
buf[0] = command
|
||||||
with self.i2c_device as i2c:
|
with self.i2c_device as i2c:
|
||||||
i2c.write_then_readinto(buf, buf, out_end=1)
|
i2c.write(buf, end=1, stop=False)
|
||||||
|
i2c.readinto(buf)
|
||||||
return buf[1] << 8 | buf[0]
|
return buf[1] << 8 | buf[0]
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,6 @@ Helper functions for color calculations
|
||||||
* Author(s): Michael McWethy
|
* Author(s): Michael McWethy
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = "0.0.0-auto.0"
|
|
||||||
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_APDS9960.git"
|
|
||||||
|
|
||||||
|
|
||||||
def calculate_color_temperature(r, g, b):
|
def calculate_color_temperature(r, g, b):
|
||||||
"""Converts the raw R/G/B values to color temperature in degrees Kelvin"""
|
"""Converts the raw R/G/B values to color temperature in degrees Kelvin"""
|
||||||
|
|
@ -56,7 +53,6 @@ def calculate_color_temperature(r, g, b):
|
||||||
# Return the results in degrees Kelvin
|
# Return the results in degrees Kelvin
|
||||||
return cct
|
return cct
|
||||||
|
|
||||||
|
|
||||||
def calculate_lux(r, g, b):
|
def calculate_lux(r, g, b):
|
||||||
"""Calculate ambient light values"""
|
"""Calculate ambient light values"""
|
||||||
# This only uses RGB ... how can we integrate clear or calculate lux
|
# This only uses RGB ... how can we integrate clear or calculate lux
|
||||||
|
|
|
||||||
10
api.rst
Normal file
10
api.rst
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
`APDS9960` - Driver for Gesture/Proximity/Color detection board
|
||||||
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
.. automodule:: adafruit_apds9960.apds9960
|
||||||
|
:members:
|
||||||
|
|
||||||
|
`Color Utility Functions` - Utility function related to Color detection
|
||||||
|
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
.. automodule:: adafruit_apds9960.colorutility
|
||||||
|
:members:
|
||||||
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
sys.path.insert(0, os.path.abspath('.'))
|
||||||
sys.path.insert(0, os.path.abspath(".."))
|
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -11,48 +10,39 @@ sys.path.insert(0, os.path.abspath(".."))
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
# ones.
|
# ones.
|
||||||
extensions = [
|
extensions = [
|
||||||
"sphinx.ext.autodoc",
|
'sphinx.ext.autodoc',
|
||||||
"sphinx.ext.intersphinx",
|
'sphinx.ext.intersphinx',
|
||||||
"sphinx.ext.viewcode",
|
'sphinx.ext.viewcode',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Mock out micropython ourselves so that we can make const a lambda.
|
# Uncomment the below if you use native CircuitPython modules such as
|
||||||
import imp
|
# 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"]
|
||||||
|
|
||||||
m = imp.new_module("micropython")
|
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
|
||||||
m.const = lambda x: x
|
|
||||||
sys.modules["micropython"] = m
|
|
||||||
|
|
||||||
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),
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# 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.
|
# The master toctree document.
|
||||||
master_doc = "index"
|
master_doc = 'README'
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = "Adafruit APDS9960 Library"
|
project = u'Adafruit APDS9960 Library'
|
||||||
copyright = "2017 Michael McWethy"
|
copyright = u'2017 Michael McWethy'
|
||||||
author = "Michael McWethy"
|
author = u'Michael McWethy'
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = "1.0"
|
version = u'1.0'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = "1.0"
|
release = u'1.0'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
|
@ -64,7 +54,7 @@ language = None
|
||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
# This patterns also effect to html_static_path and html_extra_path
|
# 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']
|
||||||
|
|
||||||
# The reST default role (used for this markup: `text`) to use for all
|
# The reST default role (used for this markup: `text`) to use for all
|
||||||
# documents.
|
# documents.
|
||||||
|
|
@ -76,47 +66,37 @@ default_role = "any"
|
||||||
add_function_parentheses = True
|
add_function_parentheses = True
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
# 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.
|
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||||
todo_include_todos = False
|
todo_include_todos = False
|
||||||
|
|
||||||
# If this is True, todo emits a warning for each TODO entries. The default is False.
|
|
||||||
todo_emit_warnings = True
|
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTML output ----------------------------------------------
|
# -- Options for HTML output ----------------------------------------------
|
||||||
|
|
||||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
# a list of builtin themes.
|
# 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
|
if not on_rtd: # only import and set the theme if we're building docs locally
|
||||||
try:
|
try:
|
||||||
import sphinx_rtd_theme
|
import sphinx_rtd_theme
|
||||||
|
html_theme = 'sphinx_rtd_theme'
|
||||||
html_theme = "sphinx_rtd_theme"
|
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
|
||||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
|
|
||||||
except:
|
except:
|
||||||
html_theme = "default"
|
html_theme = 'default'
|
||||||
html_theme_path = ["."]
|
html_theme_path = ['.']
|
||||||
else:
|
else:
|
||||||
html_theme_path = ["."]
|
html_theme_path = ['.']
|
||||||
|
|
||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
# 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,
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
# 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"
|
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = "AdafruitApds9960Librarydoc"
|
htmlhelp_basename = 'AdafruitApds9960Librarydoc'
|
||||||
|
|
||||||
# -- Options for LaTeX output ---------------------------------------------
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
|
|
@ -124,12 +104,15 @@ latex_elements = {
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
#
|
#
|
||||||
# 'papersize': 'letterpaper',
|
# 'papersize': 'letterpaper',
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
#
|
#
|
||||||
# 'pointsize': '10pt',
|
# 'pointsize': '10pt',
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
# Additional stuff for the LaTeX preamble.
|
||||||
#
|
#
|
||||||
# 'preamble': '',
|
# 'preamble': '',
|
||||||
|
|
||||||
# Latex figure (float) alignment
|
# Latex figure (float) alignment
|
||||||
#
|
#
|
||||||
# 'figure_align': 'htbp',
|
# 'figure_align': 'htbp',
|
||||||
|
|
@ -139,13 +122,8 @@ latex_elements = {
|
||||||
# (source start file, target name, title,
|
# (source start file, target name, title,
|
||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
(
|
(master_doc, 'AdafruitAPDS9960Library.tex', u'AdafruitAPDS9960 Library Documentation',
|
||||||
master_doc,
|
author, 'manual'),
|
||||||
"AdafruitAPDS9960Library.tex",
|
|
||||||
"AdafruitAPDS9960 Library Documentation",
|
|
||||||
author,
|
|
||||||
"manual",
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# -- Options for manual page output ---------------------------------------
|
# -- Options for manual page output ---------------------------------------
|
||||||
|
|
@ -153,13 +131,8 @@ latex_documents = [
|
||||||
# One entry per manual page. List of tuples
|
# One entry per manual page. List of tuples
|
||||||
# (source start file, name, description, authors, manual section).
|
# (source start file, name, description, authors, manual section).
|
||||||
man_pages = [
|
man_pages = [
|
||||||
(
|
(master_doc, 'AdafruitAPDS9960library', u'Adafruit APDS9960 Library Documentation',
|
||||||
master_doc,
|
[author], 1)
|
||||||
"AdafruitAPDS9960library",
|
|
||||||
"Adafruit APDS9960 Library Documentation",
|
|
||||||
[author],
|
|
||||||
1,
|
|
||||||
)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# -- Options for Texinfo output -------------------------------------------
|
# -- Options for Texinfo output -------------------------------------------
|
||||||
|
|
@ -168,13 +141,7 @@ man_pages = [
|
||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
(
|
(master_doc, 'AdafruitAPDS9960Library', u'Adafruit APDS9960 Library Documentation',
|
||||||
master_doc,
|
author, 'AdafruitAPDS9960Library', 'One line description of project.',
|
||||||
"AdafruitAPDS9960Library",
|
'Miscellaneous'),
|
||||||
"Adafruit APDS9960 Library Documentation",
|
|
||||||
author,
|
|
||||||
"AdafruitAPDS9960Library",
|
|
||||||
"One line description of project.",
|
|
||||||
"Miscellaneous",
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
BIN
docs/_static/favicon.ico
vendored
BIN
docs/_static/favicon.ico
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 4.3 KiB |
|
|
@ -1,8 +0,0 @@
|
||||||
|
|
||||||
.. If you created a package, create one automodule per module in the package.
|
|
||||||
|
|
||||||
.. automodule:: adafruit_apds9960.apds9960
|
|
||||||
:members:
|
|
||||||
|
|
||||||
.. automodule:: adafruit_apds9960.colorutility
|
|
||||||
:members:
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
Simple test
|
|
||||||
------------
|
|
||||||
|
|
||||||
Ensure your device works with this simple test.
|
|
||||||
|
|
||||||
.. literalinclude:: ../examples/apds9960_color_simpletest.py
|
|
||||||
:caption: examples/apds9960_color_simpletest.py
|
|
||||||
:linenos:
|
|
||||||
|
|
||||||
.. literalinclude:: ../examples/apds9960_gesture_simpletest.py
|
|
||||||
:caption: examples/apds9960_gesture_simpletest.py
|
|
||||||
:linenos:
|
|
||||||
|
|
||||||
.. literalinclude:: ../examples/apds9960_proximity_simpletest.py
|
|
||||||
:caption: examples/apds9960_proximity_simpletest.py
|
|
||||||
:linenos:
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
.. include:: ../README.rst
|
|
||||||
|
|
||||||
Table of Contents
|
|
||||||
=================
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:maxdepth: 4
|
|
||||||
:hidden:
|
|
||||||
|
|
||||||
self
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:caption: Examples
|
|
||||||
|
|
||||||
examples
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:caption: API Reference
|
|
||||||
:maxdepth: 3
|
|
||||||
|
|
||||||
api
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:caption: Tutorials
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:caption: Related Products
|
|
||||||
|
|
||||||
Adafruit APDS9960 Proximity, Light, RGB, and Gesture Sensor <https://www.adafruit.com/product/3595>
|
|
||||||
|
|
||||||
.. toctree::
|
|
||||||
:caption: Other Links
|
|
||||||
|
|
||||||
Download <https://github.com/adafruit/Adafruit_CircuitPython_APDS9960/releases/latest>
|
|
||||||
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
|
|
||||||
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
|
|
||||||
Discord Chat <https://adafru.it/discord>
|
|
||||||
Adafruit Learning System <https://learn.adafruit.com>
|
|
||||||
Adafruit Blog <https://blog.adafruit.com>
|
|
||||||
Adafruit Store <https://www.adafruit.com>
|
|
||||||
|
|
||||||
Indices and tables
|
|
||||||
==================
|
|
||||||
|
|
||||||
* :ref:`genindex`
|
|
||||||
* :ref:`modindex`
|
|
||||||
* :ref:`search`
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
import time
|
|
||||||
import board
|
|
||||||
import busio
|
|
||||||
from adafruit_apds9960.apds9960 import APDS9960
|
|
||||||
|
|
||||||
i2c = busio.I2C(board.SCL, board.SDA)
|
|
||||||
apds = APDS9960(i2c)
|
|
||||||
|
|
||||||
apds.enable_proximity = True
|
|
||||||
|
|
||||||
while True:
|
|
||||||
print(apds.proximity)
|
|
||||||
time.sleep(0.2)
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
import time
|
import time
|
||||||
import board
|
import board
|
||||||
import busio
|
import busio
|
||||||
|
import digitalio
|
||||||
from adafruit_apds9960.apds9960 import APDS9960
|
from adafruit_apds9960.apds9960 import APDS9960
|
||||||
from adafruit_apds9960 import colorutility
|
from adafruit_apds9960 import colorutility
|
||||||
|
|
||||||
i2c = busio.I2C(board.SCL, board.SDA)
|
i2c = busio.I2C(board.SCL, board.SDA)
|
||||||
|
int_pin = digitalio.DigitalInOut(board.A2)
|
||||||
apds = APDS9960(i2c)
|
apds = APDS9960(i2c)
|
||||||
apds.enable_color = True
|
apds.enable_color = True
|
||||||
|
|
||||||
|
|
@ -16,6 +18,7 @@ while True:
|
||||||
while not apds.color_data_ready:
|
while not apds.color_data_ready:
|
||||||
time.sleep(0.005)
|
time.sleep(0.005)
|
||||||
|
|
||||||
|
|
||||||
#get the data and print the different channels
|
#get the data and print the different channels
|
||||||
r, g, b, c = apds.color_data
|
r, g, b, c = apds.color_data
|
||||||
print("red: ", r)
|
print("red: ", r)
|
||||||
|
|
@ -4,7 +4,7 @@ import digitalio
|
||||||
from adafruit_apds9960.apds9960 import APDS9960
|
from adafruit_apds9960.apds9960 import APDS9960
|
||||||
|
|
||||||
i2c = busio.I2C(board.SCL, board.SDA)
|
i2c = busio.I2C(board.SCL, board.SDA)
|
||||||
int_pin = digitalio.DigitalInOut(board.D5)
|
int_pin = digitalio.DigitalInOut(board.A2)
|
||||||
apds = APDS9960(i2c, interrupt_pin=int_pin)
|
apds = APDS9960(i2c, interrupt_pin=int_pin)
|
||||||
|
|
||||||
apds.enable_proximity = True
|
apds.enable_proximity = True
|
||||||
|
|
@ -14,7 +14,7 @@ apds.enable_proximity_interrupt = True
|
||||||
while True:
|
while True:
|
||||||
# print the proximity reading when the interrupt pin goes low
|
# print the proximity reading when the interrupt pin goes low
|
||||||
if not int_pin.value:
|
if not int_pin.value:
|
||||||
print(apds.proximity)
|
print(apds.proximity())
|
||||||
|
|
||||||
# clear the interrupt
|
# clear the interrupt
|
||||||
apds.clear_interrupt()
|
apds.clear_interrupt()
|
||||||
|
|
@ -1,3 +1,2 @@
|
||||||
Adafruit-Blinka
|
adafruit-circuitpython-bus-device
|
||||||
adafruit-circuitpython-busdevice
|
|
||||||
adafruit-circuitpython-register
|
adafruit-circuitpython-register
|
||||||
|
|
|
||||||
56
setup.py
56
setup.py
|
|
@ -1,56 +0,0 @@
|
||||||
"""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-apds9960",
|
|
||||||
use_scm_version=True,
|
|
||||||
setup_requires=["setuptools_scm"],
|
|
||||||
description="CircuitPython driver for APSD9960 Gesture breakout board",
|
|
||||||
long_description=long_description,
|
|
||||||
long_description_content_type="text/x-rst",
|
|
||||||
# The project's main homepage.
|
|
||||||
url="https://github.com/adafruit/Adafruit_CircuitPython_APDS9960",
|
|
||||||
# Author details
|
|
||||||
author="Adafruit Industries",
|
|
||||||
author_email="circuitpython@adafruit.com",
|
|
||||||
install_requires=[
|
|
||||||
"Adafruit-Blinka",
|
|
||||||
"adafruit-circuitpython-register",
|
|
||||||
"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 apsd9960 gesture color proximity light sensor hardware micropython circuitpython",
|
|
||||||
# You can just specify the packages manually here if your project is
|
|
||||||
# simple. Or you can use find_packages().
|
|
||||||
packages=["adafruit_apds9960"],
|
|
||||||
)
|
|
||||||
Loading…
Reference in a new issue