diff --git a/.gitignore b/.gitignore index 0dd8629..55f127b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,12 @@ +*.mpy +.idea __pycache__ _build *.pyc .env build* bundles +*.DS_Store +.eggs +dist +**/*.egg-info \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index f1c0164..8eb9063 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,33 @@ -# 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" - +- '3.6' cache: - pip: true - + pip: true deploy: - provider: releases - api_key: $GITHUB_TOKEN +- provider: releases + api_key: "$GITHUB_TOKEN" file_glob: true - file: $TRAVIS_BUILD_DIR/bundles/* + file: "$TRAVIS_BUILD_DIR/bundles/*" skip_cleanup: true overwrite: true on: tags: true - +- provider: pypi + user: adafruit-travis + on: + tags: true + password: + secure: liFlwauzdAnjem5PGNWCbK0cTU2VACv9t/rTUNRKODp1g5bZPEOL/hBGmkiZaX6hcZ4tU6MkJQXt/HMvHyq/+XL+qaJtYMzlfePbL0h9ulGTcTn0f+smsTRqJ+Xg2ORnDcAQWeOc5q5H+YGJ6vCcpcIaiYDKtiKds8ziRF+zifQSPDVFyYxks59tij84YBKdPi1SbsC5RANwUupdyDdZIdE+DoYL4+Qrnuakt7pPxfhnG+cvDSJMpjqZdGBQsF2d02p1mAmTiyQvb/PVNb089ibNnVGzFMMCouUFLVEwheo2V0CUNmerDpkZQQF9zH6CRjlLyZdCOzS9jJ9w2N/g6jXNtepGPnqYjfzebt0/TmxxJo3sAnxH7gQzmOO2FLzem4JgbECcrEvACLPYQHe4OVpZ3cqlzLuUMvCg+TfBBkg8Qz7O3w71kntaDzMwWLOKiSMHXnb24iIlBbMWoIzSHpmrvfQwWQM5XZc8wm2WWPxn8Adw9dODuliUF1L65L9bBFaWnEFBapnruYQJtTX8TYn5umeAaCrQLwVUcGSW7VBwWqQ86LZ+W8CinzLpRuFYd8LoqRGiw0ToqmN+N+tAbc9+PFafzVD/u3gKnqRnFsMOK9onuEZky5dALIgNL+yAVm4sgPwknNEFQ3yo0uBBeuezH4Xs6Gcsumtv/DKEIL4= install: - - pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme - +- pip install -r requirements.txt +- pip install pylint circuitpython-build-tools Sphinx sphinx-rtd-theme +- pip install --force-reinstall pylint==1.9.2 script: - - pylint adafruit_stmpe610.py - - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py) - - circuitpython-build-bundles --filename_prefix adafruit-circuitpython-stmpe610 --library_location . - - cd docs && sphinx-build -E -W -b html . _build/html +- pylint adafruit_stmpe610.py +- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace + examples/*.py) +- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-stmpe610 --library_location + . +- cd docs && sphinx-build -E -W -b html . _build/html && cd .. diff --git a/adafruit_stmpe610.py b/adafruit_stmpe610.py index 5ff5c74..d3f5d9a 100644 --- a/adafruit_stmpe610.py +++ b/adafruit_stmpe610.py @@ -274,6 +274,7 @@ def _write_register_byte(self, register, value): i2c.write(bytes([register & 0xFF, value & 0xFF])) #print("$%02X <= 0x%02X" % (register, value)) + class Adafruit_STMPE610_SPI(Adafruit_STMPE610): """ SPI driver for the STMPE610 Resistive Touch sensor. @@ -294,6 +295,8 @@ def __init__(self, spi, cs, baudrate=1000000): raise RuntimeError('Failed to find STMPE610! Chip Version 0x%x' % version) super().__init__() + # pylint: disable=no-member + # Disable should be reconsidered when refactor can be tested. def _read_register(self, register, length): """Low level register reading over SPI, returns a list of values""" register = (register | 0x80) & 0xFF # Read single, bit 7 high. diff --git a/docs/conf.py b/docs/conf.py index 7f9160d..f7ac008 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,7 +20,7 @@ # 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 = ["micropython"] +# autodoc_mock_imports = ["micropython"] 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)} diff --git a/examples/stmpe610_paint_demo.py b/examples/stmpe610_paint_demo.py index 1cb80f4..3f183b9 100644 --- a/examples/stmpe610_paint_demo.py +++ b/examples/stmpe610_paint_demo.py @@ -22,7 +22,7 @@ display.fill(color565(0, 0, 0)) st_cs_pin = digitalio.DigitalInOut(board.D6) -st = adafruit_stmpe610.Adafruit_STMPE610_SPI(spi,st_cs_pin) +st = adafruit_stmpe610.Adafruit_STMPE610_SPI(spi, st_cs_pin) while True: if st.touched: diff --git a/examples/stmpe610_simpletest.py b/examples/stmpe610_simpletest.py index fd0000c..28df1cf 100644 --- a/examples/stmpe610_simpletest.py +++ b/examples/stmpe610_simpletest.py @@ -2,9 +2,11 @@ import board import digitalio from adafruit_stmpe610 import Adafruit_STMPE610_SPI -spi=busio.SPI(board.SCK,board.MOSI,board.MISO) + +spi = busio.SPI(board.SCK, board.MOSI, board.MISO) cs = digitalio.DigitalInOut(board.D6) -st=Adafruit_STMPE610_SPI(spi,cs) +st = Adafruit_STMPE610_SPI(spi, cs) + print("Go Ahead - Touch the Screen - Make My Day!") while True: if not st.buffer_empty: diff --git a/requirements.txt b/requirements.txt index 7053ecf..edf9394 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ -adafruit-circuitpython-bus-device -adafruit-circuitpython-register +Adafruit-Blinka diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..1544d0b --- /dev/null +++ b/setup.py @@ -0,0 +1,61 @@ +"""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-stmpe610', + + use_scm_version=True, + setup_requires=['setuptools_scm'], + + description='CircuitPython library for STMPE610 Resistive Touch Screen Controller.', + long_description=long_description, + long_description_content_type='text/x-rst', + + # The project's main homepage. + url='https://github.com/adafruit/Adafruit_CircuitPython_STMPE610', + + # Author details + author='Adafruit Industries', + author_email='circuitpython@adafruit.com', + + install_requires=['Adafruit-Blinka'], + + # 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 stmpe610 resistive touch screen controller' + 'hardware micropython circuitpython', + + # You can just specify the packages manually here if your project is + # simple. Or you can use find_packages(). + py_modules=['adafruit_stmpe610'], +)