├── packaging ├── debian │ ├── docs │ ├── compat │ ├── clean │ ├── source │ │ ├── format │ │ └── options │ ├── README │ ├── changelog │ ├── rules │ ├── control │ └── copyright ├── CHANGELOG ├── makedoc.sh ├── makedeb.sh ├── makelog.sh └── makeall.sh ├── sphinx ├── _templates │ ├── breadcrumbs.html │ └── layout.html ├── favicon.png ├── shop-logo.png ├── _static │ └── custom.css ├── index.rst └── conf.py ├── library ├── README.md ├── Makefile ├── MANIFEST.in ├── CHANGELOG.txt ├── test.py ├── LICENSE.txt ├── setup.py ├── README.rst └── motephat │ └── __init__.py ├── terminal.jpg ├── mote-logo.png ├── .stickler.yml ├── .gitignore ├── docker ├── Dockerfile ├── Dockerfile.alpine └── README.md ├── examples ├── pulse-white.py ├── test.py ├── rainbow.py ├── rgb.py ├── static-rainbow.py ├── cheerlights.py └── bilgetank.py ├── LICENSE ├── documentation └── REFERENCE.md └── README.md /packaging/debian/docs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packaging/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /sphinx/_templates/breadcrumbs.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packaging/debian/clean: -------------------------------------------------------------------------------- 1 | *.egg-info/* 2 | -------------------------------------------------------------------------------- /library/README.md: -------------------------------------------------------------------------------- 1 | # Mote pHAT Python Library 2 | -------------------------------------------------------------------------------- /packaging/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /packaging/debian/source/options: -------------------------------------------------------------------------------- 1 | extend-diff-ignore = "^[^/]+\.egg-info/" 2 | -------------------------------------------------------------------------------- /terminal.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimoroni/mote-phat/HEAD/terminal.jpg -------------------------------------------------------------------------------- /mote-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimoroni/mote-phat/HEAD/mote-logo.png -------------------------------------------------------------------------------- /sphinx/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimoroni/mote-phat/HEAD/sphinx/favicon.png -------------------------------------------------------------------------------- /sphinx/shop-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pimoroni/mote-phat/HEAD/sphinx/shop-logo.png -------------------------------------------------------------------------------- /.stickler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | linters: 3 | flake8: 4 | python: 3 5 | max-line-length: 160 6 | -------------------------------------------------------------------------------- /library/Makefile: -------------------------------------------------------------------------------- 1 | devel: 2 | -rm -r build 3 | python setup.py build 4 | sudo python setup.py develop 5 | -------------------------------------------------------------------------------- /library/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include CHANGELOG.txt 2 | include LICENSE.txt 3 | include README.rst 4 | include setup.py 5 | include motephat/* 6 | -------------------------------------------------------------------------------- /packaging/debian/README: -------------------------------------------------------------------------------- 1 | README 2 | 3 | Mote pHAT sports four channels with microUSB connectors that can drive up to 64 RGB LEDs using four 16 pixel Mote strips. 4 | 5 | Learn more: https://shop.pimoroni.com/products/mote-phat 6 | For examples run: `curl -sS get.pimoroni.com/motephat | bash` 7 | -------------------------------------------------------------------------------- /packaging/CHANGELOG: -------------------------------------------------------------------------------- 1 | motephat (0.0.2) stable; urgency=low 2 | 3 | * Initial release to Raspbian apt repository 4 | 5 | -- Phil Howard Thu, 10 Nov 2016 00:00:00 +0000 6 | 7 | motephat (0.0.1) UNRELEASED; urgency=low 8 | 9 | * Mote-compatible library for Mote pHAT 10 | 11 | -- Phil Howard Fri, 28 Oct 2016 00:00:00 +0000 12 | 13 | -------------------------------------------------------------------------------- /packaging/debian/changelog: -------------------------------------------------------------------------------- 1 | motephat (0.0.2) stable; urgency=low 2 | 3 | * Initial release to Raspbian apt repository 4 | 5 | -- Phil Howard Thu, 10 Nov 2016 00:00:00 +0000 6 | 7 | motephat (0.0.1) UNRELEASED; urgency=low 8 | 9 | * Mote-compatible library for Mote pHAT 10 | 11 | -- Phil Howard Fri, 28 Oct 2016 00:00:00 +0000 12 | 13 | -------------------------------------------------------------------------------- /packaging/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | #export DH_VERBOSE=1 5 | export DH_OPTIONS 6 | 7 | %: 8 | dh $@ --with python2,python3 --buildsystem=python_distutils 9 | 10 | override_dh_auto_install: 11 | python setup.py install --root debian/python-motephat --install-layout=deb 12 | python3 setup.py install --root debian/python3-motephat --install-layout=deb 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | sphinx/_build/ 3 | *.py[cod] 4 | *.swp 5 | dist/ 6 | sdist/ 7 | env/ 8 | build/ 9 | develop-eggs/ 10 | eggs/ 11 | *.egg-info/ 12 | .installed.cfg 13 | *.egg 14 | *.deb 15 | *.dsc 16 | *.build 17 | *.changes 18 | *.orig.* 19 | testing/ 20 | MANIFEST 21 | .idea 22 | pip-log.txt 23 | pip-delete-this-directory.txt 24 | library/test/scrollphat/ 25 | library/debian/ 26 | packaging/*tar.xz 27 | -------------------------------------------------------------------------------- /library/CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | 0.0.3 2 | ----- 3 | 4 | * Fix EOF packet to 42 clocks 5 | * Add gamma adjustment 6 | * Switch from "exit" to "raise ImportError" when checking required modules 7 | * Add short sleep to guarantee that pin state is set when toggled 8 | 9 | 0.0.2 10 | ----- 11 | 12 | * Initial release to Raspbian apt repository 13 | 14 | 0.0.1 15 | ----- 16 | 17 | * Mote-compatible library for Mote pHAT 18 | 19 | -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM resin/rpi-raspbian 2 | MAINTAINER alexellis2@gmail.com 3 | 4 | WORKDIR /root/ 5 | RUN apt-get update \ 6 | && apt-get install git python-dev python-pip gcc \ 7 | && git clone https://github.com/pimoroni/mote-phat \ 8 | && cd mote-phat/library && python setup.py install \ 9 | && apt-get -qy remove python-dev gcc \ 10 | && rm -rf /var/lib/apt/lists/* 11 | 12 | WORKDIR /root/mote-phat/examples 13 | 14 | CMD ["python", "./test.py"] 15 | -------------------------------------------------------------------------------- /examples/pulse-white.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import math 4 | import time 5 | 6 | import motephat as mote 7 | 8 | print(""" 9 | Mote pHAT: Pulse White 10 | 11 | Pulse all LEDs white from 0, 0, 0 to 255, 255, 255 12 | using a sine wave. 13 | 14 | Press Ctrl+C to exit! 15 | 16 | """) 17 | 18 | try: 19 | while True: 20 | br = (math.sin(time.time()) + 1) / 2 21 | br *= 255.0 22 | br = int(br) 23 | mote.set_all(br, br, br) 24 | mote.show() 25 | time.sleep(0.01) 26 | 27 | except KeyboardInterrupt: 28 | mote.clear() 29 | mote.show() 30 | -------------------------------------------------------------------------------- /docker/Dockerfile.alpine: -------------------------------------------------------------------------------- 1 | FROM armhf/alpine:latest 2 | MAINTAINER alexellis2@gmail.com 3 | 4 | WORKDIR /root/ 5 | RUN apk add --update git python && \ 6 | git clone https://github.com/pimoroni/mote-phat && \ 7 | apk del git 8 | WORKDIR /root/mote-phat/library 9 | RUN apk add --update py-setuptools gcc python-dev ca-certificates linux-headers musl-dev libffi-dev && \ 10 | /usr/bin/easy_install-2.7 RPi.GPIO && \ 11 | python setup.py install && \ 12 | apk del gcc ca-certificates linux-headers musl-dev libffi-dev 13 | WORKDIR /root/mote-phat/examples 14 | 15 | CMD ["python2", "./test.py"] 16 | -------------------------------------------------------------------------------- /examples/test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import colorsys 4 | 5 | import motephat 6 | 7 | 8 | print(""" 9 | Mote pHAT: Test 10 | 11 | Press Ctrl+C to exit! 12 | 13 | """) 14 | 15 | 16 | offset = 0 17 | 18 | while True: 19 | offset += 1 20 | for channel in range(4): 21 | for pixel in range(16): 22 | hue = offset + (10 * (channel * 16) + pixel) 23 | hue %= 360 24 | hue /= 360.0 25 | 26 | r, g, b = [int(c*255) for c in colorsys.hsv_to_rgb(hue, 1.0, 1.0)] 27 | motephat.set_pixel(channel+1, pixel, r, g, b) 28 | 29 | motephat.show() 30 | -------------------------------------------------------------------------------- /library/test.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import mock 3 | import threading 4 | import time 5 | import atexit 6 | 7 | sys.modules["RPi.GPIO"] = mock.Mock() 8 | sys.modules["RPi"] = mock.Mock() 9 | sys.path.insert(0, "../examples/") 10 | 11 | import motephat 12 | 13 | _running = True 14 | 15 | 16 | def watch(): 17 | while _running: 18 | print(motephat.pixels) 19 | time.sleep(0.5) 20 | 21 | 22 | def stop(): 23 | global _running 24 | _running = False 25 | 26 | 27 | _t_watch = threading.Thread(target=watch) 28 | _t_watch.start() 29 | atexit.register(stop) 30 | 31 | import bilgetank 32 | 33 | _running = False 34 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | Docker integration 2 | ================== 3 | 4 | ### Build an image 5 | 6 | To build the Git repo into an image type in: 7 | 8 | ``` 9 | docker build -t mote-phat . 10 | ``` 11 | 12 | For a leaner image you can use Alpine Linux: 13 | 14 | ``` 15 | docker build -t mote-phat . -f Dockerfile.alpine 16 | ``` 17 | 18 | ### Run an image 19 | 20 | ``` 21 | docker run --privileged -ti mote-phat 22 | ``` 23 | 24 | The base Dockerfile is built to run the `test.py` file but you can override the `CMD` instruction to run whatever you want. Imagine you created your own file called rainbows.py. 25 | 26 | ``` 27 | FROM mote-phat 28 | COPY rainbows.py . 29 | CMD ["python", "rainbows.py"] 30 | ``` 31 | 32 | For more information check out the tutorials by Alex Ellis here: 33 | 34 | * [Docker & Pi tutorials](http://blog.alexellis.io/tag/raspberry-pi/) 35 | 36 | 37 | -------------------------------------------------------------------------------- /examples/rainbow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import time 4 | from colorsys import hsv_to_rgb 5 | 6 | import motephat as mote 7 | 8 | 9 | print(""" 10 | Mote pHAT: Rainbow 11 | 12 | Press Ctrl+C to exit. 13 | """) 14 | 15 | mote.configure_channel(1, 16, False) 16 | mote.configure_channel(2, 16, False) 17 | mote.configure_channel(3, 16, False) 18 | mote.configure_channel(4, 16, False) 19 | 20 | try: 21 | while True: 22 | h = time.time() * 50 23 | for channel in range(4): 24 | for pixel in range(16): 25 | hue = (h + (channel * 64) + (pixel * 4)) 26 | hue = hue % 360 27 | hue = hue / 360.0 28 | r, g, b = [int(c * 255) for c in hsv_to_rgb(hue, 1.0, 1.0)] 29 | mote.set_pixel(channel + 1, pixel, r, g, b) 30 | mote.show() 31 | time.sleep(0.01) 32 | 33 | except KeyboardInterrupt: 34 | mote.clear() 35 | mote.show() 36 | -------------------------------------------------------------------------------- /examples/rgb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | import time 5 | 6 | import motephat 7 | 8 | 9 | motephat.set_brightness(1) 10 | motephat.set_clear_on_exit(True) 11 | 12 | 13 | def usage(): 14 | print("Usage: {} ".format(sys.argv[0])) 15 | sys.exit(1) 16 | 17 | 18 | if len(sys.argv) != 4: 19 | usage() 20 | 21 | # Exit if non integer value. int() will raise a ValueError 22 | try: 23 | r, g, b = [int(x) for x in sys.argv[1:]] 24 | except ValueError: 25 | usage() 26 | 27 | # Exit if any of r, g, b are greater than 255 28 | if max(r, g, b) > 255: 29 | usage() 30 | 31 | print(""" 32 | Mote pHAT: RGB 33 | 34 | Setting Mote to {r},{g},{b}" 35 | 36 | Press Ctrl+C to exit! 37 | 38 | """.format(r=r, g=g, b=b)) 39 | 40 | while True: 41 | 42 | for channel in range(4): 43 | for pixel in range(16): 44 | motephat.set_pixel(channel + 1, pixel, r, g, b) 45 | time.sleep(0.01) 46 | 47 | motephat.show() 48 | -------------------------------------------------------------------------------- /examples/static-rainbow.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import time 4 | from colorsys import hsv_to_rgb 5 | 6 | import motephat as mote 7 | 8 | 9 | print(""" 10 | Mote pHAT: Static Rainbow 11 | 12 | Press Ctrl+C to clear and exit. 13 | """) 14 | 15 | mote.configure_channel(1, 16, False) 16 | mote.configure_channel(2, 16, False) 17 | mote.configure_channel(3, 16, False) 18 | mote.configure_channel(4, 16, False) 19 | 20 | h = 1 21 | 22 | try: 23 | while True: 24 | for channel in range(1, 5): 25 | pixel_count = mote.get_pixel_count(channel) 26 | for pixel in range(pixel_count): 27 | hue = (h + ((channel - 1) * pixel_count * 5) + (pixel * 5)) 28 | hue %= 360 29 | hue /= 360.0 30 | r, g, b = [int(c * 255) for c in hsv_to_rgb(hue, 1.0, 1.0)] 31 | mote.set_pixel(channel, pixel, r, g, b) 32 | mote.show() 33 | time.sleep(0.05) 34 | 35 | except KeyboardInterrupt: 36 | mote.clear() 37 | mote.show() 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Pimoroni Ltd. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packaging/debian/control: -------------------------------------------------------------------------------- 1 | Source: motephat 2 | Maintainer: Phil Howard 3 | Homepage: https://github.com/pimoroni/mote-phat 4 | Section: python 5 | Priority: extra 6 | Build-Depends: debhelper (>= 9.0.0), dh-python, python-all (>= 2.7), python-setuptools, python3-all (>= 3.4), python3-setuptools 7 | Standards-Version: 3.9.6 8 | X-Python-Version: >= 2.7 9 | X-Python3-Version: >= 3.4 10 | 11 | Package: python-motephat 12 | Architecture: all 13 | Section: python 14 | Depends: ${misc:Depends}, ${python:Depends}, python-rpi.gpio 15 | Suggests: python-psutil, python-requests 16 | Description: Python library for the Pimoroni Mote pHAT 17 | Mote pHAT provides four multiplexed channels for driving APA102 pixels. 18 | . 19 | This is the Python 2 version of the package. 20 | 21 | Package: python3-motephat 22 | Architecture: all 23 | Section: python 24 | Depends: ${misc:Depends}, ${python3:Depends}, python3-rpi.gpio 25 | Suggests: python3-psutil, python3-requests 26 | Description: Python library for the Pimoroni Mote pHAT 27 | Mote pHAT provides four multiplexed channels for driving APA102 pixels. 28 | . 29 | This is the Python 3 version of the package. 30 | -------------------------------------------------------------------------------- /library/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Pimoroni Ltd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /sphinx/_static/custom.css: -------------------------------------------------------------------------------- 1 | .rst-content a, .rst-content a:focus { 2 | color:#13c0d7; 3 | } 4 | .rst-content a:visited, .rst-content a:active { 5 | color:#87319a; 6 | } 7 | .rst-content .highlighted { 8 | background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAJElEQVQIW2P8//9/PSMjYyMDEmAEsdElwILoEnBBZAkUQZgEABMWE4Kzp1KUAAAAAElFTkSuQmCC),rgba(246,167,4,0.2); 9 | margin:0 -6px; 10 | } 11 | .wy-side-nav-search { 12 | background:#333333; 13 | } 14 | .wy-nav-side { 15 | background:#444444; 16 | } 17 | .rst-content dl:not(.docutils) dt { 18 | background:#e7fafd; 19 | border-top:solid 3px #13c0d7; 20 | color:rgba(0,0,0,0.5); 21 | } 22 | .rst-content .viewcode-link, .rst-content .viewcode-back { 23 | color:#00b09b; 24 | } 25 | code.literal { 26 | color:#e63c2e; 27 | } 28 | .rst-content #module-motephat { 29 | margin-bottom:24px; 30 | } 31 | .rst-content #module-motephat dl:not(.docutils) dt { 32 | border:none; 33 | background:#f0f0f0; 34 | } 35 | .rst-content #module-motephat dl:not(.docutils) dd { 36 | display:none; 37 | } 38 | .rst-content #module-motephat dl:not(.docutils) { 39 | margin-bottom:0; 40 | } -------------------------------------------------------------------------------- /sphinx/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | {% block extrahead %} 3 | 4 | {% endblock %} 5 | {% block footer %} 6 | 43 | {% endblock %} -------------------------------------------------------------------------------- /packaging/makedoc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gettools="no" # if set to yes downloads the tools required 4 | setup="yes" # if set to yes populates library folder 5 | buildoc="yes" # if set to yes builds the deb files 6 | cleanup="yes" # if set to yes cleans up build files 7 | pkgfiles=( "build" "changes" "deb" "dsc" "tar.xz" ) 8 | 9 | if [ $gettools == "yes" ]; then 10 | sudo apt-get update && sudo apt-get install build-essential debhelper devscripts dh-make dh-python 11 | sudo apt-get install python-all python-setuptools python3-all python3-setuptools 12 | sudo apt-get install python-mock python-sphinx python-sphinx-rtd-theme 13 | sudo pip install Sphinx --upgrade && sudo pip install sphinx_rtd_theme --upgrade 14 | fi 15 | 16 | if [ $setup == "yes" ]; then 17 | rm -R ../library/build ../library/debian &> /dev/null 18 | cp -R ./debian ../library/ && cp -R ../sphinx ../library/doc 19 | fi 20 | 21 | cd ../library 22 | 23 | if [ $buildoc == "yes" ]; then 24 | debuild 25 | for file in ${pkgfiles[@]}; do 26 | rm ../*.$file &> /dev/null 27 | done 28 | rm -R ../documentation/html &> /dev/null 29 | cp -R ./build/sphinx/html ../documentation 30 | fi 31 | 32 | if [ $cleanup == "yes" ]; then 33 | debuild clean 34 | rm -R ./build ./debian ./doc &> /dev/null 35 | fi 36 | 37 | exit 0 38 | -------------------------------------------------------------------------------- /packaging/debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: motephat 3 | Source: https://github.com/pimoroni/mote-phat 4 | 5 | Files: * 6 | Copyright: 2016 Pimoroni Ltd 7 | License: MIT 8 | 9 | License: MIT 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | . 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | . 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /packaging/makedeb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gettools="no" # if set to yes downloads the tools required 4 | setup="yes" # if set to yes populates library folder 5 | buildeb="yes" # if set to yes builds the deb files 6 | cleanup="yes" # if set to yes cleans up build files 7 | pkgfiles=( "build" "changes" "deb" "dsc" "tar.xz" ) 8 | 9 | if [ $gettools == "yes" ]; then 10 | sudo apt-get update && sudo apt-get install build-essential debhelper devscripts dh-make dh-python dput gnupg 11 | sudo apt-get install python-all python-setuptools python3-all python3-setuptools 12 | sudo apt-get install python-mock python-sphinx python-sphinx-rtd-theme 13 | sudo pip install Sphinx --upgrade && sudo pip install sphinx_rtd_theme --upgrade 14 | fi 15 | 16 | if [ $setup == "yes" ]; then 17 | rm -R ../library/build ../library/debian &> /dev/null 18 | cp -R ./debian ../library/ && cp -R ../sphinx ../library/doc 19 | fi 20 | 21 | cd ../library 22 | 23 | if [ $buildeb == "yes" ]; then 24 | debuild -aarmhf 25 | for file in ${pkgfiles[@]}; do 26 | rm ../packaging/*.$file &> /dev/null 27 | mv ../*.$file ../packaging 28 | done 29 | rm -R ../documentation/html &> /dev/null 30 | cp -R ./build/sphinx/html ../documentation 31 | fi 32 | 33 | if [ $cleanup == "yes" ]; then 34 | debuild clean 35 | rm -R ./build ./debian ./doc &> /dev/null 36 | fi 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /sphinx/index.rst: -------------------------------------------------------------------------------- 1 | Welcome 2 | ------- 3 | 4 | Mote pHAT is an add-on for your Raspberry Pi or Pi Zero that lets you drive 4 strips of APA102 pixels. 5 | 6 | * More information - https://shop.pimoroni.com/products/mote 7 | * Get the code - https://github.com/pimoroni/mote-phat 8 | * GPIO pinout - http://pinout.xyz/pinout/mote_phat 9 | * Get help - http://forums.pimoroni.com/c/support 10 | 11 | At A Glance 12 | ----------- 13 | 14 | .. automoduleoutline:: motephat 15 | :members: 16 | 17 | Clear All Channels 18 | ------------------ 19 | 20 | .. automodule:: motephat 21 | :noindex: 22 | :members: clear 23 | 24 | Clear A Single Channel 25 | ---------------------- 26 | 27 | .. automodule:: motephat 28 | :noindex: 29 | :members: clear_channel 30 | 31 | Set A Pixel 32 | ----------- 33 | 34 | .. automodule:: motephat 35 | :noindex: 36 | :members: set_pixel 37 | 38 | Set All Pixels 39 | -------------- 40 | 41 | .. automodule:: motephat 42 | :noindex: 43 | :members: set_all 44 | 45 | Set Brightness 46 | -------------- 47 | 48 | .. automodule:: motephat 49 | :noindex: 50 | :members: set_brightness 51 | 52 | Set Clear On Exit 53 | ----------------- 54 | 55 | .. automodule:: motephat 56 | :noindex: 57 | :members: set_clear_on_exit 58 | 59 | Show Buffer 60 | ----------- 61 | 62 | .. automodule:: motephat 63 | :noindex: 64 | :members: show 65 | 66 | 67 | Constants 68 | --------- 69 | 70 | NUM_PIXELS = 8 -------------------------------------------------------------------------------- /examples/cheerlights.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import time 4 | from sys import exit 5 | 6 | try: 7 | import requests 8 | except ImportError: 9 | exit("""This script requires the requests module. 10 | Install with: sudo pip install requests""") 11 | 12 | import motephat 13 | 14 | 15 | print(""" 16 | Mote pHAT: Cheerlights 17 | 18 | Display colours from the cheerlights API. 19 | 20 | Press Ctrl+C to exit! 21 | 22 | """) 23 | 24 | 25 | motephat.set_brightness(1) 26 | 27 | num_pixels = 16 28 | 29 | motephat.configure_channel(1, num_pixels, False) 30 | motephat.configure_channel(2, num_pixels, False) 31 | motephat.configure_channel(3, num_pixels, False) 32 | motephat.configure_channel(4, num_pixels, False) 33 | 34 | 35 | try: 36 | while True: 37 | r = requests.get('http://api.thingspeak.com/channels/1417/feed.json') 38 | j = r.json() 39 | f = j['feeds'][-8:] 40 | 41 | f = [element for index, element in enumerate(f) if index % 2 == 0] 42 | 43 | print(f) 44 | 45 | channel = 1 46 | for col in f: 47 | col = col['field2'] 48 | r, g, b = tuple(ord(c) for c in col[1:].lower().decode('hex')) 49 | for pixel in range(motephat.get_pixel_count(channel)): 50 | motephat.set_pixel(channel, pixel, r, g, b) 51 | channel += 1 52 | 53 | motephat.show() 54 | 55 | time.sleep(5) 56 | 57 | except KeyboardInterrupt: 58 | motephat.clear() 59 | motephat.show() 60 | time.sleep(0.1) 61 | -------------------------------------------------------------------------------- /examples/bilgetank.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import math 4 | import time 5 | from colorsys import hsv_to_rgb 6 | 7 | import motephat 8 | 9 | 10 | print(""" 11 | Mote pHAT: #BilgeTank 12 | 13 | This is the lighting script we use to run the shelves in BilgeTank. 14 | 15 | It uses a simple Sine wave to sweep gently between greeny blue 16 | and blue, giving a nice oceanic effect! 17 | 18 | This is achieved by moving around a portion of a hue wheel, 19 | defined by hue_start and hue_range. 20 | 21 | Press Ctrl+C to clear and exit. 22 | """) 23 | 24 | # The hue wheel is 360 degrees around, with; 25 | # 0 = Red 26 | # 40ish = Orange 27 | # 120 = Green 28 | # 180 = Teal 29 | # 240 = Blue 30 | # 300 = Purple 31 | 32 | hue_start = 160 33 | hue_range = 80 34 | speed = 1 35 | 36 | motephat.configure_channel(1, 16, False) 37 | motephat.configure_channel(2, 16, False) 38 | motephat.configure_channel(3, 16, False) 39 | motephat.configure_channel(4, 16, False) 40 | 41 | try: 42 | while True: 43 | phase = 0 44 | for channel in [1, 2, 3, 4]: 45 | for pixel in range(motephat.get_pixel_count(channel)): 46 | h = (time.time() * speed) + (phase / 10.0) 47 | h = math.sin(h) * (hue_range / 2) 48 | hue = hue_start + (hue_range / 2) + h 49 | hue %= 360 50 | hue /= 360.0 51 | 52 | r, g, b = [int(c * 255) for c in hsv_to_rgb(hue, 1.0, 1.0)] 53 | motephat.set_pixel(channel, pixel, r, g, b) 54 | 55 | phase += 1 56 | 57 | motephat.show() 58 | time.sleep(0.01) 59 | 60 | except KeyboardInterrupt: 61 | motephat.clear() 62 | motephat.show() 63 | -------------------------------------------------------------------------------- /documentation/REFERENCE.md: -------------------------------------------------------------------------------- 1 | # Mote pHAT Function Reference 2 | 3 | ## Clear All Channels 4 | ```python 5 | motephat.clear()[source] 6 | ``` 7 | Clear the pixel buffer. 8 | 9 | ## Clear A Single Channel 10 | ```python 11 | motephat.clear_channel(c)[source] 12 | ``` 13 | Clear a single channel. 14 | 15 | Parameters: 16 | c – Channel to clear: 0 to 3 17 | 18 | ## Set A Pixel 19 | ```python 20 | motephat.set_pixel(c, x, r, g, b, brightness=None)[source] 21 | ``` 22 | Set the RGB value, and optionally brightness, of a single pixel. If you don’t supply a brightness value, the last value will be kept. 23 | 24 | Parameters: 25 | x – The horizontal position of the pixel: 0 to 7 26 | r – Amount of red: 0 to 255 27 | g – Amount of green: 0 to 255 28 | b – Amount of blue: 0 to 255 29 | brightness – Brightness: 0.0 to 1.0 (default around 0.2) 30 | 31 | ## Set All Pixels 32 | ```python 33 | motephat.set_all(r, g, b, brightness=None)[source] 34 | ``` 35 | Set the RGB value and optionally brightness of all pixels. If you don’t supply a brightness value, the last value set for each pixel be kept. 36 | 37 | Parameters: 38 | r – Amount of red: 0 to 255 39 | g – Amount of green: 0 to 255 40 | b – Amount of blue: 0 to 255 41 | brightness – Brightness: 0.0 to 1.0 (default around 0.2) 42 | 43 | ## Set Brightness 44 | ```python 45 | motephat.set_brightness(brightness)[source] 46 | ``` 47 | Set the brightness of all pixels. 48 | 49 | Parameters: 50 | brightness – Brightness: 0.0 to 1.0 51 | 52 | ## Set Clear On Exit 53 | ```python 54 | motephat.set_clear_on_exit(value=True)[source] 55 | ``` 56 | Set whether Mote pHAT should be cleared upon exit. 57 | 58 | By default Mote pHAT will turn off the pixels on exit, but calling `blinkt.set_clear_on_exit(False)` will ensure that it does not. 59 | 60 | Parameters: 61 | value – True or False (default True) 62 | 63 | ## Show Buffer 64 | ```python 65 | motephat.show()[source] 66 | ``` 67 | Output the buffer to Mote pHAT. 68 | -------------------------------------------------------------------------------- /library/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ 4 | Copyright (c) 2016 Pimoroni 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 10 | of the Software, and to permit persons to whom the Software is furnished to do 11 | so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | 25 | try: 26 | from setuptools import setup 27 | except ImportError: 28 | from distutils.core import setup 29 | 30 | classifiers = [ 31 | 'Development Status :: 5 - Production/Stable', 32 | 'Operating System :: POSIX :: Linux', 33 | 'License :: OSI Approved :: MIT License', 34 | 'Intended Audience :: Developers', 35 | 'Programming Language :: Python :: 2.6', 36 | 'Programming Language :: Python :: 2.7', 37 | 'Programming Language :: Python :: 3', 38 | 'Topic :: Software Development', 39 | 'Topic :: System :: Hardware'] 40 | 41 | setup( 42 | name='motephat', 43 | version='0.0.3', 44 | author='Philip Howard', 45 | author_email='phil@pimoroni.com', 46 | description="""Python library for driving Pimoroni Mote pHAT""", 47 | long_description=open('README.rst').read() + "\n" + open('CHANGELOG.txt').read(), 48 | license='MIT', 49 | keywords='Raspberry Pi LED', 50 | url='http://www.pimoroni.com', 51 | classifiers=classifiers, 52 | packages=['motephat'], 53 | install_requires=['RPi.GPIO'] 54 | ) 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Mote](mote-logo.png) 2 | https://shop.pimoroni.com/products/mote-phat 3 | 4 | Drive four channels of APA102 pixels from your Raspberry Pi or Pi Zero with Mote pHAT 5 | 6 | ## Installing 7 | 8 | ### Full install (recommended): 9 | 10 | We've created an easy installation script that will install all pre-requisites and get your Mote pHAT 11 | up and running with minimal efforts. To run it, fire up Terminal which you'll find in Menu -> Accessories -> Terminal 12 | on your Raspberry Pi desktop, as illustrated below: 13 | 14 | ![Finding the terminal](http://get.pimoroni.com/resources/github-repo-terminal.png) 15 | 16 | In the new terminal window type the command exactly as it appears below (check for typos) and follow the on-screen instructions: 17 | 18 | ```bash 19 | curl https://get.pimoroni.com/motephat | bash 20 | ``` 21 | 22 | Alternatively, on Raspbian, you can download the `pimoroni-dashboard` and install your product by browsing to the relevant entry: 23 | 24 | ```bash 25 | sudo apt-get install pimoroni 26 | ``` 27 | (you will find the Dashboard under 'Accessories' too, in the Pi menu - or just run `pimoroni-dashboard` at the command line) 28 | 29 | If you choose to download examples you'll find them in `/home/pi/Pimoroni/motephat/`. 30 | 31 | ### Manual install: 32 | 33 | #### Library install for Python 3: 34 | 35 | on Raspbian: 36 | 37 | ```bash 38 | sudo apt-get install python3-motephat 39 | ``` 40 | 41 | other environments: 42 | 43 | ```bash 44 | sudo pip3 install motephat 45 | ``` 46 | 47 | #### Library install for Python 2: 48 | 49 | on Raspbian: 50 | 51 | ```bash 52 | sudo apt-get install python-motephat 53 | ``` 54 | 55 | other environments: 56 | 57 | ```bash 58 | sudo pip2 install motephat 59 | ``` 60 | 61 | ### Development: 62 | 63 | If you want to contribute, or like living on the edge of your seat by having the latest code, you should clone this repository, `cd` to the library directory, and run: 64 | 65 | ```bash 66 | sudo python3 setup.py install 67 | ``` 68 | (or `sudo python setup.py install` whichever your primary Python environment may be) 69 | 70 | In all cases you will have to enable the i2c bus. 71 | 72 | ## Documentation & Support 73 | 74 | * Guides and tutorials - https://learn.pimoroni.com/mote-phat 75 | * Function reference - http://docs.pimoroni.com/motephat/ 76 | * GPIO Pinout - https://pinout.xyz/pinout/mote_phat 77 | * Get help - http://forums.pimoroni.com/c/support 78 | -------------------------------------------------------------------------------- /packaging/makelog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # script control variables 4 | 5 | libname="" # leave this blank for auto-detection 6 | sibname=() # name of sibling in packages list 7 | versionwarn="yes" # set to anything but 'yes' to turn off warning 8 | 9 | debdir="$(pwd)" 10 | rootdir="$(dirname $debdir)" 11 | libdir="$rootdir/library" 12 | 13 | mainlog="CHANGELOG" 14 | debianlog="debian/changelog" 15 | pypilog="$libdir/CHANGELOG.txt" 16 | 17 | # function define 18 | 19 | success() { 20 | echo "$(tput setaf 2)$1$(tput sgr0)" 21 | } 22 | 23 | inform() { 24 | echo "$(tput setaf 6)$1$(tput sgr0)" 25 | } 26 | 27 | warning() { 28 | echo "$(tput setaf 1)$1$(tput sgr0)" 29 | } 30 | 31 | newline() { 32 | echo "" 33 | } 34 | 35 | # generate debian changelog 36 | 37 | cat $mainlog > $debianlog 38 | inform "seeded debian changelog" 39 | 40 | # generate pypi changelog 41 | 42 | sed -e "/--/d" -e "s/ \*/\*/" \ 43 | -e "s/.*\([0-9].[0-9].[0-9]\).*/\1/" \ 44 | -e '/[0-9].[0-9].[0-9]/ a\ 45 | -----' $mainlog | cat -s > $pypilog 46 | 47 | version=$(head -n 1 $pypilog) 48 | inform "pypi changelog generated" 49 | 50 | # touch up version in setup.py file 51 | 52 | if [ -n $(grep version "$libdir/setup.py" &> /dev/null) ]; then 53 | inform "touched up version in setup.py" 54 | sed -i "s/'[0-9].[0-9].[0-9]'/'$version'/" "$libdir/setup.py" 55 | else 56 | warning "couldn't touch up version in setup, no match found" 57 | fi 58 | 59 | # touch up version in lib or package siblings 60 | 61 | if [ -z "$libname" ]; then 62 | cd "$libdir" 63 | libname=$(grep "name" setup.py | tr -d "[:space:]" | cut -c 7- | rev | cut -c 3- | rev) 64 | libname=$(echo "$libname" | tr "[A-Z]" "[a-z]") && cd "$debdir" 65 | sibname+=( "$libname" ) 66 | elif [ "$libname" != "package" ]; then 67 | sibname+=( "$libname" ) 68 | fi 69 | 70 | for sibling in ${sibname[@]}; do 71 | if grep -e "__version__" "$libdir/$sibling.py" &> /dev/null; then 72 | sed -i "s/__version__ = '[0-9].[0-9].[0-9]'/__version__ = '$version'/" "$libdir/$sibling.py" 73 | inform "touched up version in $sibling.py" 74 | elif grep -e "__version__" "$libdir/$sibling/__init__.py" &> /dev/null; then 75 | sed -i "s/__version__ = '[0-9].[0-9].[0-9]'/__version__ = '$version'/" "$libdir/$sibling/__init__.py" 76 | inform "touched up version in $sibling/__init__.py" 77 | elif [ "$versionwarn" == "yes" ]; then 78 | warning "couldn't touch up __version__ in $sibling, no match found" 79 | fi 80 | done 81 | 82 | exit 0 83 | -------------------------------------------------------------------------------- /library/README.rst: -------------------------------------------------------------------------------- 1 | |Mote| https://shop.pimoroni.com/products/mote-phat 2 | 3 | Drive four channels of APA102 pixels from your Raspberry Pi or Pi Zero 4 | with Mote pHAT 5 | 6 | Installing 7 | ---------- 8 | 9 | Full install (recommended): 10 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 | 12 | We've created an easy installation script that will install all 13 | pre-requisites and get your Mote pHAT up and running with minimal 14 | efforts. To run it, fire up Terminal which you'll find in Menu -> 15 | Accessories -> Terminal on your Raspberry Pi desktop, as illustrated 16 | below: 17 | 18 | .. figure:: http://get.pimoroni.com/resources/github-repo-terminal.png 19 | :alt: Finding the terminal 20 | 21 | In the new terminal window type the command exactly as it appears below 22 | (check for typos) and follow the on-screen instructions: 23 | 24 | .. code:: bash 25 | 26 | curl https://get.pimoroni.com/motephat | bash 27 | 28 | Alternatively, on Raspbian, you can download the ``pimoroni-dashboard`` 29 | and install your product by browsing to the relevant entry: 30 | 31 | .. code:: bash 32 | 33 | sudo apt-get install pimoroni 34 | 35 | (you will find the Dashboard under 'Accessories' too, in the Pi menu - 36 | or just run ``pimoroni-dashboard`` at the command line) 37 | 38 | If you choose to download examples you'll find them in 39 | ``/home/pi/Pimoroni/motephat/``. 40 | 41 | Manual install: 42 | ~~~~~~~~~~~~~~~ 43 | 44 | Library install for Python 3: 45 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 46 | 47 | on Raspbian: 48 | 49 | .. code:: bash 50 | 51 | sudo apt-get install python3-motephat 52 | 53 | other environments: 54 | 55 | .. code:: bash 56 | 57 | sudo pip3 install motephat 58 | 59 | Library install for Python 2: 60 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 61 | 62 | on Raspbian: 63 | 64 | .. code:: bash 65 | 66 | sudo apt-get install python-motephat 67 | 68 | other environments: 69 | 70 | .. code:: bash 71 | 72 | sudo pip2 install motephat 73 | 74 | Development: 75 | ~~~~~~~~~~~~ 76 | 77 | If you want to contribute, or like living on the edge of your seat by 78 | having the latest code, you should clone this repository, ``cd`` to the 79 | library directory, and run: 80 | 81 | .. code:: bash 82 | 83 | sudo python3 setup.py install 84 | 85 | (or ``sudo python setup.py install`` whichever your primary Python 86 | environment may be) 87 | 88 | In all cases you will have to enable the i2c bus. 89 | 90 | Documentation & Support 91 | ----------------------- 92 | 93 | - Guides and tutorials - https://learn.pimoroni.com/mote-phat 94 | - Function reference - http://docs.pimoroni.com/motephat/ 95 | - GPIO Pinout - https://pinout.xyz/pinout/mote\_phat 96 | - Get help - http://forums.pimoroni.com/c/support 97 | 98 | .. |Mote| image:: mote-logo.png 99 | 100 | -------------------------------------------------------------------------------- /packaging/makeall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # script control variables 4 | 5 | reponame="" # leave this blank for auto-detection 6 | libname="" # leave this blank for auto-detection 7 | packagename="" # leave this blank for auto-selection 8 | 9 | debianlog="debian/changelog" 10 | debcontrol="debian/control" 11 | debcopyright="debian/copyright" 12 | debrules="debian/rules" 13 | debreadme="debian/README" 14 | 15 | debdir="$(pwd)" 16 | rootdir="$(dirname $debdir)" 17 | libdir="$rootdir/library" 18 | 19 | FLAG=false 20 | 21 | # function define 22 | 23 | success() { 24 | echo "$(tput setaf 2)$1$(tput sgr0)" 25 | } 26 | 27 | inform() { 28 | echo "$(tput setaf 6)$1$(tput sgr0)" 29 | } 30 | 31 | warning() { 32 | echo "$(tput setaf 1)$1$(tput sgr0)" 33 | } 34 | 35 | newline() { 36 | echo "" 37 | } 38 | 39 | # assessing repo and library variables 40 | 41 | if [ -z "$reponame" ] || [ -z "$libname" ]; then 42 | inform "detecting reponame and libname..." 43 | else 44 | inform "using reponame and libname overrides" 45 | fi 46 | 47 | if [ -z "$reponame" ]; then 48 | if [[ $rootdir == *"python"* ]]; then 49 | repodir="$(dirname $rootdir)" 50 | reponame="$(basename $repodir)" 51 | else 52 | repodir="$rootdir" 53 | reponame="$(basename $repodir)" 54 | fi 55 | reponame=$(echo "$reponame" | tr "[A-Z]" "[a-z]") 56 | fi 57 | 58 | if [ -z "$libname" ]; then 59 | cd "$libdir" 60 | libname=$(grep "name" setup.py | tr -d "[:space:]" | cut -c 7- | rev | cut -c 3- | rev) 61 | libname=$(echo "$libname" | tr "[A-Z]" "[a-z]") && cd "$debdir" 62 | fi 63 | 64 | if [ -z "$packagename" ]; then 65 | packagename="$libname" 66 | fi 67 | 68 | echo "reponame is $reponame and libname is $libname" 69 | echo "output packages will be python-$packagename and python3-$packagename" 70 | 71 | # checking generating changelog file 72 | 73 | ./makelog.sh 74 | version=$(head -n 1 "$libdir/CHANGELOG.txt") 75 | echo "building $libname version $version" 76 | 77 | # checking debian/changelog file 78 | 79 | inform "checking debian/changelog file..." 80 | 81 | if ! head -n 1 $debianlog | grep "$libname" &> /dev/null; then 82 | warning "library not mentioned in header!" && FLAG=true 83 | elif head -n 1 $debianlog | grep "UNRELEASED"; then 84 | warning "this changelog is not going to generate a release!" 85 | warning "change distribution to 'stable'" && FLAG=true 86 | fi 87 | 88 | # checking debian/copyright file 89 | 90 | inform "checking debian/copyright file..." 91 | 92 | if ! grep "^Source" $debcopyright | grep "$reponame" &> /dev/null; then 93 | warning "$(grep "^Source" $debcopyright)" && FLAG=true 94 | fi 95 | 96 | if ! grep "^Upstream-Name" $debcopyright | grep "$libname" &> /dev/null; then 97 | warning "$(grep "^Upstream-Name" $debcopyright)" && FLAG=true 98 | fi 99 | 100 | # checking debian/control file 101 | 102 | inform "checking debian/control file..." 103 | 104 | if ! grep "^Source" $debcontrol | grep "$libname" &> /dev/null; then 105 | warning "$(grep "^Source" $debcontrol)" && FLAG=true 106 | fi 107 | 108 | if ! grep "^Homepage" $debcontrol | grep "$reponame" &> /dev/null; then 109 | warning "$(grep "^Homepage" $debcontrol)" && FLAG=true 110 | fi 111 | 112 | if ! grep "^Package: python-$packagename" $debcontrol &> /dev/null; then 113 | warning "$(grep "^Package: python-" $debcontrol)" && FLAG=true 114 | fi 115 | 116 | if ! grep "^Package: python3-$packagename" $debcontrol &> /dev/null; then 117 | warning "$(grep "^Package: python3-" $debcontrol)" && FLAG=true 118 | fi 119 | 120 | if ! grep "^Priority: extra" $debcontrol &> /dev/null; then 121 | warning "$(grep "^Priority" $debcontrol)" && FLAG=true 122 | fi 123 | 124 | 125 | # checking debian/rules file 126 | 127 | inform "checking debian/rules file..." 128 | 129 | if ! grep "debian/python-$packagename" $debrules &> /dev/null; then 130 | warning "$(grep "debian/python-" $debrules)" && FLAG=true 131 | fi 132 | 133 | if ! grep "debian/python3-$packagename" $debrules &> /dev/null; then 134 | warning "$(grep "debian/python3-" $debrules)" && FLAG=true 135 | fi 136 | 137 | # checking debian/README file 138 | 139 | inform "checking debian/readme file..." 140 | 141 | if ! grep -e "$libname" -e "$reponame" $debreadme &> /dev/null; then 142 | warning "README does not seem to mention product, repo or lib!" && FLAG=true 143 | fi 144 | 145 | # summary of checks pre build 146 | 147 | if $FLAG; then 148 | warning "Check all of the above and correct!" && exit 1 149 | else 150 | inform "we're good to go... bulding!" 151 | fi 152 | 153 | # building deb and final checks 154 | 155 | ./makedeb.sh 156 | 157 | inform "running lintian..." 158 | lintian -v $(find -name "python*$version*.deb") 159 | lintian -v $(find -name "python3*$version*.deb") 160 | 161 | inform "checking signatures..." 162 | gpg --verify $(find -name "*$version*changes") 163 | gpg --verify $(find -name "*$version*dsc") 164 | 165 | exit 0 166 | -------------------------------------------------------------------------------- /library/motephat/__init__.py: -------------------------------------------------------------------------------- 1 | import atexit 2 | import time 3 | 4 | try: 5 | import RPi.GPIO as GPIO 6 | except ImportError: 7 | raise ImportError("This library requires the RPi.GPIO module\nInstall with: sudo pip install RPi.GPIO") 8 | 9 | 10 | __version__ = '0.0.3' 11 | 12 | 13 | DAT_PIN = 10 14 | CLK_PIN = 11 15 | LED_SOF = 0b11100000 16 | LED_MAX_BR = 0b00011111 17 | 18 | CHANNEL_PINS = [8, 7, 25, 24] 19 | 20 | NUM_PIXELS_PER_CHANNEL = 16 21 | NUM_CHANNELS = 4 22 | 23 | DEFAULT_BRIGHTNESS = 0.2 24 | 25 | _gamma_table = [ 26 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27 | 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 28 | 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 29 | 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 30 | 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 31 | 19, 19, 20, 21, 21, 22, 22, 23, 23, 24, 25, 25, 26, 27, 27, 28, 32 | 29, 29, 30, 31, 31, 32, 33, 34, 34, 35, 36, 37, 37, 38, 39, 40, 33 | 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 34 | 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 35 | 71, 72, 73, 74, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89, 36 | 90, 91, 93, 94, 95, 96, 98, 99, 100, 102, 103, 104, 106, 107, 109, 110, 37 | 111, 113, 114, 116, 117, 119, 120, 121, 123, 124, 126, 128, 129, 131, 132, 134, 38 | 135, 137, 138, 140, 142, 143, 145, 146, 148, 150, 151, 153, 155, 157, 158, 160, 39 | 162, 163, 165, 167, 169, 170, 172, 174, 176, 178, 179, 181, 183, 185, 187, 189, 40 | 191, 193, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 41 | 222, 224, 227, 229, 231, 233, 235, 237, 239, 241, 244, 246, 248, 250, 252, 255] 42 | 43 | _white_point = (1.0, 1.0, 1.0) 44 | 45 | _sleep_time = 0 46 | 47 | pixels = [ 48 | [[0, 0, 0, DEFAULT_BRIGHTNESS]] * NUM_PIXELS_PER_CHANNEL, 49 | [[0, 0, 0, DEFAULT_BRIGHTNESS]] * NUM_PIXELS_PER_CHANNEL, 50 | [[0, 0, 0, DEFAULT_BRIGHTNESS]] * NUM_PIXELS_PER_CHANNEL, 51 | [[0, 0, 0, DEFAULT_BRIGHTNESS]] * NUM_PIXELS_PER_CHANNEL 52 | ] 53 | 54 | channels = [(16, False) for c in range(NUM_CHANNELS)] 55 | 56 | _gpio_setup = False 57 | _clear_on_exit = True 58 | 59 | 60 | def _exit(): 61 | if _clear_on_exit: 62 | clear() 63 | show() 64 | GPIO.cleanup() 65 | 66 | 67 | def set_white_point(r, g, b): 68 | """Set the white point. 69 | 70 | :param r: Red amount, from 0.0 to 1.0 71 | :param g: Green amount, from 0.0 to 1.0 72 | :param b: Green amount, from 0.0 to 1.0 73 | 74 | """ 75 | global _white_point 76 | _white_point = (r, g, b) 77 | 78 | 79 | def _set_gamma_table(table): 80 | """Set the gamma table. 81 | 82 | :param table: Must be a list of 256 values 83 | 84 | """ 85 | 86 | global _gamma_table 87 | if isinstance(table, list) and len(table) == 256: 88 | _gamma_table = table 89 | 90 | 91 | def configure_channel(channel, num_pixels, gamma_correction=False): 92 | """Configure a channel. 93 | 94 | :param channel: Index of channel to configure 95 | :param num_pixels: Number of pixels in channel 96 | :param gamma_correction: Whether this channel should be gamma corrected 97 | 98 | """ 99 | 100 | global channels 101 | channels[channel - 1] = (num_pixels, gamma_correction) 102 | 103 | 104 | def get_pixel_count(channel): 105 | """Get the number of pixels in a channel. 106 | 107 | :param channel: Index of channel to query 108 | 109 | """ 110 | 111 | return channels[channel - 1][0] 112 | 113 | 114 | def set_brightness(brightness): 115 | """Set the brightness of all pixels 116 | 117 | :param brightness: Brightness: 0.0 to 1.0 118 | """ 119 | for c in range(NUM_CHANNELS): 120 | for x in range(NUM_PIXELS_PER_CHANNEL): 121 | pixels[c][x][3] = brightness 122 | 123 | 124 | def clear_channel(channel): 125 | """Clear a single channel 126 | 127 | :param channel: Channel to clear: 0 to 3 128 | """ 129 | for index in range(NUM_PIXELS_PER_CHANNEL): 130 | pixels[channel - 1][index][0:3] = [0, 0, 0] 131 | 132 | 133 | def clear(): 134 | """Clear the pixel buffer""" 135 | for channel in range(1, NUM_CHANNELS + 1): 136 | clear_channel(channel) 137 | 138 | 139 | def _select_channel(channel): 140 | for x in range(NUM_CHANNELS): 141 | GPIO.output(CHANNEL_PINS[x], GPIO.LOW if x == channel else GPIO.HIGH) 142 | 143 | 144 | def _write_byte(byte): 145 | for x in range(8): 146 | GPIO.output(DAT_PIN, byte & 0b10000000) 147 | GPIO.output(CLK_PIN, 1) 148 | time.sleep(_sleep_time) 149 | byte <<= 1 150 | GPIO.output(CLK_PIN, 0) 151 | time.sleep(_sleep_time) 152 | 153 | 154 | # Emit exactly enough clock pulses to latch the small dark die APA102s which are weird 155 | # for some reason it takes 36 clocks, the other IC takes just 4 (number of pixels/2) 156 | def _eof(): 157 | GPIO.output(DAT_PIN, 0) 158 | for x in range(42): 159 | GPIO.output(CLK_PIN, 1) 160 | time.sleep(_sleep_time) 161 | GPIO.output(CLK_PIN, 0) 162 | time.sleep(_sleep_time) 163 | 164 | 165 | def _sof(): 166 | GPIO.output(DAT_PIN, 0) 167 | for x in range(32): 168 | GPIO.output(CLK_PIN, 1) 169 | time.sleep(_sleep_time) 170 | GPIO.output(CLK_PIN, 0) 171 | time.sleep(_sleep_time) 172 | 173 | 174 | def show(): 175 | """Output the buffer to Mote pHAT""" 176 | global _gpio_setup 177 | 178 | if not _gpio_setup: 179 | GPIO.setmode(GPIO.BCM) 180 | GPIO.setwarnings(False) 181 | GPIO.setup([DAT_PIN, CLK_PIN], GPIO.OUT) 182 | GPIO.setup(CHANNEL_PINS, GPIO.OUT) 183 | atexit.register(_exit) 184 | _gpio_setup = True 185 | 186 | for index, channel in enumerate(pixels): 187 | _select_channel(index) 188 | gamma = _gamma_table if channels[1] else range(256) 189 | _sof() 190 | for pixel in channel: 191 | r, g, b, brightness = pixel 192 | r, g, b = [int(gamma[int(x)] * brightness * _white_point[i]) & 0xff for i, x in enumerate([r, g, b])] 193 | _write_byte(LED_SOF | LED_MAX_BR) 194 | _write_byte(b) 195 | _write_byte(g) 196 | _write_byte(r) 197 | 198 | _eof() 199 | 200 | 201 | def set_all(r, g, b, brightness=None, channel=None): 202 | """Set the RGB value and optionally brightness of all pixels 203 | 204 | If you don't supply a brightness value, the last value set for each pixel be kept. 205 | 206 | :param r: Amount of red: 0 to 255 207 | :param g: Amount of green: 0 to 255 208 | :param b: Amount of blue: 0 to 255 209 | :param brightness: Brightness: 0.0 to 1.0 (default around 0.2) 210 | :param channel: Optional channel: 1, 2, 3 or 4 (default to all) 211 | 212 | """ 213 | 214 | if channel in range(1, NUM_CHANNELS + 1): 215 | for index in range(get_pixel_count(channel)): 216 | set_pixel(channel, index, r, g, b, brightness) 217 | return 218 | 219 | for channel in range(1, NUM_CHANNELS + 1): 220 | for index in range(get_pixel_count(channel)): 221 | set_pixel(channel, index, r, g, b, brightness) 222 | 223 | 224 | def get_pixel(channel, index): 225 | return tuple(pixels[channel - 1][index]) 226 | 227 | 228 | def set_pixel(channel, index, r, g, b, brightness=None): 229 | """Set the RGB value, and optionally brightness, of a single pixel 230 | 231 | If you don't supply a brightness value, the last value will be kept. 232 | 233 | :param channel: The channel on which to set the pixel: 1, 2, 3 or 4 234 | :param index: The horizontal position of the pixel: 0 to 7 235 | :param r: Amount of red: 0 to 255 236 | :param g: Amount of green: 0 to 255 237 | :param b: Amount of blue: 0 to 255 238 | :param brightness: Brightness: 0.0 to 1.0 (default around 0.2) 239 | 240 | """ 241 | 242 | channel -= 1 243 | channel %= NUM_CHANNELS 244 | index %= get_pixel_count(channel) 245 | 246 | if brightness is None: 247 | brightness = pixels[channel][index][3] 248 | 249 | pixels[channel][index] = [r, g, b, brightness] 250 | 251 | 252 | def set_clear_on_exit(value=True): 253 | """Set whether Mote pHAT should be cleared upon exit 254 | 255 | By default Mote pHAT will turn off the pixels on exit, but calling:: 256 | 257 | blinkt.set_clear_on_exit(False) 258 | 259 | Will ensure that it does not. 260 | 261 | :param value: True or False (default True) 262 | """ 263 | global _clear_on_exit 264 | _clear_on_exit = value 265 | -------------------------------------------------------------------------------- /sphinx/conf.py: -------------------------------------------------------------------------------- 1 | #-*- coding: utf-8 -*- 2 | 3 | import sys 4 | import site 5 | 6 | import mock 7 | 8 | 9 | # Prompte /usr/local/lib to the front of sys.path 10 | #sys.path.insert(0,site.getsitepackages()[0]) 11 | 12 | import sphinx_rtd_theme 13 | 14 | sys.modules['RPi'] = mock.Mock() 15 | sys.modules['RPi.GPIO'] = mock.Mock() 16 | 17 | sys.path.insert(0, '../library/') 18 | 19 | 20 | from sphinx.ext import autodoc 21 | 22 | 23 | class OutlineMethodDocumenter(autodoc.MethodDocumenter): 24 | objtype = 'method' 25 | 26 | def add_content(self, more_content, no_docstring=False): 27 | return 28 | 29 | class OutlineFunctionDocumenter(autodoc.FunctionDocumenter): 30 | objtype = 'function' 31 | 32 | def add_content(self, more_content, no_docstring=False): 33 | return 34 | 35 | class ModuleOutlineDocumenter(autodoc.ModuleDocumenter): 36 | objtype = 'moduleoutline' 37 | 38 | def __init__(self, directive, name, indent=u''): 39 | # Monkey path the Method and Function documenters 40 | sphinx_app.add_autodocumenter(OutlineMethodDocumenter) 41 | sphinx_app.add_autodocumenter(OutlineFunctionDocumenter) 42 | autodoc.ModuleDocumenter.__init__(self, directive, name, indent) 43 | 44 | def __del__(self): 45 | # Return the Method and Function documenters to normal 46 | sphinx_app.add_autodocumenter(autodoc.MethodDocumenter) 47 | sphinx_app.add_autodocumenter(autodoc.FunctionDocumenter) 48 | 49 | 50 | def setup(app): 51 | global sphinx_app 52 | sphinx_app = app 53 | app.add_autodocumenter(ModuleOutlineDocumenter) 54 | 55 | ModuleOutlineDocumenter.objtype = 'module' 56 | 57 | import motephat 58 | 59 | PACKAGE_NAME = u"MotepHAT" 60 | PACKAGE_HANDLE = "MotepHAT" 61 | PACKAGE_MODULE = "motephat" 62 | PACKAGE_VERSION = motephat.__version__ 63 | suppress_warnings = ["app.add_directive"] 64 | 65 | # -- General configuration ------------------------------------------------ 66 | 67 | # If your documentation needs a minimal Sphinx version, state it here. 68 | # 69 | # needs_sphinx = '1.0' 70 | 71 | # Add any Sphinx extension module names here, as strings. They can be 72 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 73 | # ones. 74 | extensions = [ 75 | 'sphinx.ext.autodoc', 76 | 'sphinx.ext.autosummary', 77 | 'sphinx.ext.viewcode', 78 | ] 79 | 80 | # Add any paths that contain templates here, relative to this directory. 81 | templates_path = ['_templates'] 82 | 83 | # The suffix(es) of source filenames. 84 | # You can specify multiple suffix as a list of string: 85 | # 86 | # source_suffix = ['.rst', '.md'] 87 | source_suffix = '.rst' 88 | 89 | # The encoding of source files. 90 | # 91 | # source_encoding = 'utf-8-sig' 92 | 93 | # The master toctree document. 94 | master_doc = 'index' 95 | 96 | # General information about the project. 97 | project = PACKAGE_NAME 98 | copyright = u'2016, Pimoroni Ltd' 99 | author = u'Phil Howard' 100 | 101 | # The version info for the project you're documenting, acts as replacement for 102 | # |version| and |release|, also used in various other places throughout the 103 | # built documents. 104 | # 105 | # The short X.Y version. 106 | version = u'{}'.format(PACKAGE_VERSION) 107 | # The full version, including alpha/beta/rc tags. 108 | release = u'{}'.format(PACKAGE_VERSION) 109 | 110 | # The language for content autogenerated by Sphinx. Refer to documentation 111 | # for a list of supported languages. 112 | # 113 | # This is also used if you do content translation via gettext catalogs. 114 | # Usually you set "language" from the command line for these cases. 115 | language = None 116 | 117 | # There are two options for replacing |today|: either, you set today to some 118 | # non-false value, then it is used: 119 | # 120 | # today = '' 121 | # 122 | # Else, today_fmt is used as the format for a strftime call. 123 | # 124 | # today_fmt = '%B %d, %Y' 125 | 126 | # List of patterns, relative to source directory, that match files and 127 | # directories to ignore when looking for source files. 128 | # This patterns also effect to html_static_path and html_extra_path 129 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] 130 | 131 | # The reST default role (used for this markup: `text`) to use for all 132 | # documents. 133 | # 134 | # default_role = None 135 | 136 | # If true, '()' will be appended to :func: etc. cross-reference text. 137 | # 138 | # add_function_parentheses = True 139 | 140 | # If true, the current module name will be prepended to all description 141 | # unit titles (such as .. function::). 142 | # 143 | # add_module_names = True 144 | 145 | # If true, sectionauthor and moduleauthor directives will be shown in the 146 | # output. They are ignored by default. 147 | # 148 | # show_authors = False 149 | 150 | # The name of the Pygments (syntax highlighting) style to use. 151 | pygments_style = 'sphinx' 152 | 153 | # A list of ignored prefixes for module index sorting. 154 | # modindex_common_prefix = [] 155 | 156 | # If true, keep warnings as "system message" paragraphs in the built documents. 157 | # keep_warnings = False 158 | 159 | # If true, `todo` and `todoList` produce output, else they produce nothing. 160 | todo_include_todos = False 161 | 162 | 163 | # -- Options for HTML output ---------------------------------------------- 164 | 165 | # The theme to use for HTML and HTML Help pages. See the documentation for 166 | # a list of builtin themes. 167 | # 168 | html_theme = 'sphinx_rtd_theme' 169 | #html_theme = 'alabaster' 170 | 171 | # Theme options are theme-specific and customize the look and feel of a theme 172 | # further. For a list of options available for each theme, see the 173 | # documentation. 174 | # 175 | html_theme_options = { 176 | 'collapse_navigation': False, 177 | 'display_version': True 178 | } 179 | 180 | # Add any paths that contain custom themes here, relative to this directory. 181 | html_theme_path = [ 182 | '_themes', 183 | sphinx_rtd_theme.get_html_theme_path() 184 | ] 185 | 186 | # The name for this set of Sphinx documents. 187 | # " v documentation" by default. 188 | # 189 | # html_title = PACKAGE_NAME + u' v0.1.2' 190 | 191 | # A shorter title for the navigation bar. Default is the same as html_title. 192 | # 193 | # html_short_title = None 194 | 195 | # The name of an image file (relative to this directory) to place at the top 196 | # of the sidebar. 197 | # 198 | html_logo = 'shop-logo.png' 199 | 200 | # The name of an image file (relative to this directory) to use as a favicon of 201 | # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 202 | # pixels large. 203 | # 204 | html_favicon = 'favicon.png' 205 | 206 | # Add any paths that contain custom static files (such as style sheets) here, 207 | # relative to this directory. They are copied after the builtin static files, 208 | # so a file named "default.css" will overwrite the builtin "default.css". 209 | html_static_path = ['_static'] 210 | 211 | # Add any extra paths that contain custom files (such as robots.txt or 212 | # .htaccess) here, relative to this directory. These files are copied 213 | # directly to the root of the documentation. 214 | # 215 | # html_extra_path = [] 216 | 217 | # If not None, a 'Last updated on:' timestamp is inserted at every page 218 | # bottom, using the given strftime format. 219 | # The empty string is equivalent to '%b %d, %Y'. 220 | # 221 | # html_last_updated_fmt = None 222 | 223 | # If true, SmartyPants will be used to convert quotes and dashes to 224 | # typographically correct entities. 225 | # 226 | # html_use_smartypants = True 227 | 228 | # Custom sidebar templates, maps document names to template names. 229 | # 230 | # html_sidebars = {} 231 | 232 | # Additional templates that should be rendered to pages, maps page names to 233 | # template names. 234 | # 235 | # html_additional_pages = {} 236 | 237 | # If false, no module index is generated. 238 | # 239 | # html_domain_indices = True 240 | 241 | # If false, no index is generated. 242 | # 243 | html_use_index = False 244 | 245 | # If true, the index is split into individual pages for each letter. 246 | # 247 | # html_split_index = False 248 | 249 | # If true, links to the reST sources are added to the pages. 250 | # 251 | html_show_sourcelink = False 252 | 253 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 254 | # 255 | html_show_sphinx = False 256 | 257 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 258 | # 259 | # html_show_copyright = True 260 | 261 | # If true, an OpenSearch description file will be output, and all pages will 262 | # contain a tag referring to it. The value of this option must be the 263 | # base URL from which the finished HTML is served. 264 | # 265 | # html_use_opensearch = '' 266 | 267 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 268 | # html_file_suffix = None 269 | 270 | # Language to be used for generating the HTML full-text search index. 271 | # Sphinx supports the following languages: 272 | # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' 273 | # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' 274 | # 275 | # html_search_language = 'en' 276 | 277 | # A dictionary with options for the search language support, empty by default. 278 | # 'ja' uses this config value. 279 | # 'zh' user can custom change `jieba` dictionary path. 280 | # 281 | # html_search_options = {'type': 'default'} 282 | 283 | # The name of a javascript file (relative to the configuration directory) that 284 | # implements a search results scorer. If empty, the default will be used. 285 | # 286 | # html_search_scorer = 'scorer.js' 287 | 288 | # Output file base name for HTML help builder. 289 | htmlhelp_basename = PACKAGE_HANDLE + 'doc' 290 | 291 | # -- Options for LaTeX output --------------------------------------------- 292 | 293 | latex_elements = { 294 | # The paper size ('letterpaper' or 'a4paper'). 295 | # 296 | # 'papersize': 'letterpaper', 297 | 298 | # The font size ('10pt', '11pt' or '12pt'). 299 | # 300 | # 'pointsize': '10pt', 301 | 302 | # Additional stuff for the LaTeX preamble. 303 | # 304 | # 'preamble': '', 305 | 306 | # Latex figure (float) alignment 307 | # 308 | # 'figure_align': 'htbp', 309 | } 310 | 311 | # Grouping the document tree into LaTeX files. List of tuples 312 | # (source start file, target name, title, 313 | # author, documentclass [howto, manual, or own class]). 314 | latex_documents = [ 315 | (master_doc, PACKAGE_HANDLE + '.tex', PACKAGE_NAME + u' Documentation', 316 | u'Phil Howard', 'manual'), 317 | ] 318 | 319 | # The name of an image file (relative to this directory) to place at the top of 320 | # the title page. 321 | # 322 | # latex_logo = None 323 | 324 | # For "manual" documents, if this is true, then toplevel headings are parts, 325 | # not chapters. 326 | # 327 | # latex_use_parts = False 328 | 329 | # If true, show page references after internal links. 330 | # 331 | # latex_show_pagerefs = False 332 | 333 | # If true, show URL addresses after external links. 334 | # 335 | # latex_show_urls = False 336 | 337 | # Documents to append as an appendix to all manuals. 338 | # 339 | # latex_appendices = [] 340 | 341 | # It false, will not define \strong, \code, itleref, \crossref ... but only 342 | # \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added 343 | # packages. 344 | # 345 | # latex_keep_old_macro_names = True 346 | 347 | # If false, no module index is generated. 348 | # 349 | # latex_domain_indices = True 350 | 351 | 352 | # -- Options for manual page output --------------------------------------- 353 | 354 | # One entry per manual page. List of tuples 355 | # (source start file, name, description, authors, manual section). 356 | man_pages = [ 357 | (master_doc, PACKAGE_MODULE, PACKAGE_NAME + u' Documentation', 358 | [author], 1) 359 | ] 360 | 361 | # If true, show URL addresses after external links. 362 | # 363 | # man_show_urls = False 364 | 365 | 366 | # -- Options for Texinfo output ------------------------------------------- 367 | 368 | # Grouping the document tree into Texinfo files. List of tuples 369 | # (source start file, target name, title, author, 370 | # dir menu entry, description, category) 371 | texinfo_documents = [ 372 | (master_doc, PACKAGE_HANDLE, PACKAGE_NAME + u' Documentation', 373 | author, PACKAGE_HANDLE, 'One line description of project.', 374 | 'Miscellaneous'), 375 | ] 376 | 377 | # Documents to append as an appendix to all manuals. 378 | # 379 | # texinfo_appendices = [] 380 | 381 | # If false, no module index is generated. 382 | # 383 | # texinfo_domain_indices = True 384 | 385 | # How to display URL addresses: 'footnote', 'no', or 'inline'. 386 | # 387 | # texinfo_show_urls = 'footnote' 388 | 389 | # If true, do not generate a @detailmenu in the "Top" node's menu. 390 | # 391 | # texinfo_no_detailmenu = False 392 | --------------------------------------------------------------------------------