{ "info": { "author": "Mark Blakeney", "author_email": "blakeney.mark@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "### PIFACEIO\n\nThis package provides a Python interface to the [PiFace Digital][pifaceboard]\nperipheral I/O board for the [Raspberry Pi][rpi].\nA [PiFace Digital][pifaceboard] board offers 8 digital inputs and 8\ndigital outputs. This package allows a Python program to read the inputs\nand write the outputs on the board via the Raspberry Pi SPI bus.\n\nThe newer [PiFace Digital 2][pifaceboard2] board is exactly compatible\nwith the original board and so is also supported by this package.\n\nMultiple [PiFace Digital][pifaceboard] boards are supported, on either\nor both of the RPi SPI bus chip selects. This pifaceio package is\nfocussed on simplicity and performance for polled implementations and is\nan alternative to the [pifacedigitalio][] and [piface][] (now\ndepreciated) Python packages for the [PiFace Digital][pifaceboard]\nboard. In my simple polled read and write benchmarks, pifaceio performs\nsignificantly faster and with much less overhead than\n[pifacedigitalio][].\n\nInterrupts are not supported. See [pifacedigitalio][] for interrupt and\nother functionality.\n\nThe pifaceio package is implemented in pure Python code using only the\nPython standard library, uses no external 3rd party packages, and is\ncompatible with Python versions 2 and 3.\n\n### INSTALLATION\n\n#### Installation using PIP\n\nThe [pifaceio pypi package][pifaceio] is available from [PyPi][] so\nyou can install it using [pip][] (with or without a [virtualenv][]). If\n[pip][] is not already installed run:\n\n sudo apt-get install python-pip\n\nThen use pip to install the [pifaceio][] package:\n\n sudo pip install pifaceio\n\nTo set up permissions/groups/udev etc for spidev device on RPi, run the\nincluded script and then reboot.\n\n sudo install-spidev.sh\n\n#### Alternative Installation from Github\n\nInstall necessary packages on your Raspberry Pi for build etc:\n\n sudo apt-get install git python-setuptools\n\nGet this package:\n\n git clone http://github.com/bulletmark/pifaceio\n\nInstall (can alternately do this as ordinary user in a [virtualenv][]\nof course):\n\n sudo python ./setup.py install\n\nTo set up permissions/groups/udev etc for spidev device on RPi, run the\nfollowing included script and then reboot.\n\n sudo ./install-spidev.sh\n\n### USAGE\n\nBoard addresses, input pins, and output pins are always numbered from 0.\n\nIn general, you start with a once-off allocation of a PiFace board\ninstance at startup with:\n\n pf = pifaceio.PiFace()\n\nDefault is first PiFace board (0). Optionally takes an argument 0 to 7\nfor up to 8 PiFace board addresses. Create multiple PiFace() instances\nif you want to use multiple boards in parallel.\n\nThere are also other (rarely needed) options to disable the input pull\nup resistors, and to invert the input and output bit polarities. See\npifaceio.py for details.\n\nAt each poll time, e.g. every part second, read all the inputs (i.e. the\nsingle input byte) with:\n\n pf.read() # returns the input byte you can use directly if you prefer\n\nThen read and write individual pins according to your logic with:\n\n in_val = pf.read_pin(pin_in)\n ..\n pf.write_pin(pin_out, out_val)\n ..\n\nFinally, write all the outputs at the end of processing (i.e. write the\nsingle output byte) with:\n\n pf.write() # optionally, takes an output byte to write directly\n\nNote that `read_pin()` is just a convenience method wrapping a bit\ntest around the previously read input byte from `read()` and\n`write_pin()` is just a convenience method wrapping a bit set/clear\naround the output byte pending it being written by `write()`. You don't\nhave to use `read_pin()` or `write_pin()` if you just want to read,\ntest/manipulate, and write the 8 bit input and/or output byte directly.\nIn that case you would just use `read()`, and `write()` only in your\napplication.\n\n### EXAMPLES\n\nSimple example to just reflect all PiFace 8 inputs to the 8 outputs\nevery 10 msec, on the default first PiFace board:\n\n import pifaceio, time\n pf = pifaceio.PiFace()\n\n while True:\n pf.write(pf.read())\n time.sleep(.01)\n\nSame example, but do it across 4 PiFace boards:\n\n import pifaceio, time\n pifaces = [pifaceio.PiFace(n) for n in range(4)]\n\n while True:\n for pf in pifaces:\n pf.write(pf.read())\n time.sleep(.01)\n\nSimple example to test if both input pin 0 and 1 are on at same time,\nand then set output pin 7 if true:\n\n import pifaceio\n pf = pifaceio.PiFace()\n ...\n # Fetch inputs (i.e. single byte)\n pf.read()\n first_two_inputs_on = pf.read_pin(0) and pf.read_pin(1)\n\n # Now write that state to output pin 7\n pf.write_pin(7, first_two_inputs_on)\n\n # Do final (actual) write when all output pin states are set.\n pf.write()\n\nSimulated \"interrupt\" processing example by light-weight poll every 10 msecs:\n\n import pifaceio, time\n pf = pifaceio.PiFace()\n\n def process_change():\n 'On any changed inputs, read inputs and write outputs'\n pf.write_pin(7, pf.read_pin(0) and pf.read_pin(1))\n\n # .. etc .. do logic using pf.read_pin() and pf.write_pin()\n\n # Loop forever polling inputs ..\n last = None\n while True:\n data = pf.read()\n\n # Do processing only on change\n if last != data:\n last = data\n process_change()\n pf.write() # note write() only writes if output changes\n\n time.sleep(.01)\n\n### PIFACE PACKAGE BACKWARDS COMPATIBILITY\n\nThe following [piface][] API will work compatibly, but performance is\nslightly degraded compared to reading and writing the single input and\noutput bytes using the canonical new and preferred pifaceio API\ndescribed above. However, performance is still significantly\nsuperior compared to using the original [piface][] package itself.\n\n #import piface.pfio as pf (change this to next line)\n import pifaceio as pf\n\n # The following calls should be approximately compatible:\n pf.init()\n value = pf.digital_read(pin)\n pf.digital_write(pin, value)\n pf.deinit()\n\nYou can also use multiple boards with this compatibility interface, e.g.\nas follows where board can be from 0 to 7.\n\n value = pf.digital_read(pin, board)\n pf.digital_write(pin, value, board)\n\n### UPGRADE\n\n cd pifaceio # source dir, as above\n git pull\n sudo python ./setup.py install\n\n### LICENSE\n\nCopyright (C) 2013 Mark Blakeney. This program is distributed under the\nterms of the GNU General Public License.\nThis program is free software: you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation, either version 3 of the License, or any later\nversion.\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General\nPublic License at for more details.\n\n[rpi]: http://www.raspberrypi.org\n[pifaceboard]: http://www.piface.org.uk/products/piface_digital/\n[pifaceboard2]: http://www.element14.com/community/docs/DOC-69001/l/piface-digital-2-for-raspberry-pi\n[piface]: http://github.com/thomasmacpherson/piface\n[pifacedigitalio]: http://github.com/piface/pifacedigitalio\n[PyPi]: https://pypi.python.org/pypi\n[pip]: http://www.pip-installer.org/en/latest\n[virtualenv]: https://virtualenv.pypa.io/en/latest\n[pifaceio]: https://pypi.python.org/pypi/pifaceio\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/bulletmark/pifaceio", "keywords": "piface,spidev,raspberrypi", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "pifaceio", "package_url": "https://pypi.org/project/pifaceio/", "platform": "", "project_url": "https://pypi.org/project/pifaceio/", "project_urls": { "Homepage": "http://github.com/bulletmark/pifaceio" }, "release_url": "https://pypi.org/project/pifaceio/1.26.3/", "requires_dist": null, "requires_python": "", "summary": "Python interface to the Raspberry Pi PiFace board", "version": "1.26.3" }, "last_serial": 4163218, "releases": { "1.24": [ { "comment_text": "", "digests": { "md5": "9b3cad2960d8a89993cb49e968ea86b8", "sha256": "6ac87d548ad64caf43b5354dbaca9fd34c9f902c3b432c47045ce00bc639a2ca" }, "downloads": -1, "filename": "pifaceio-1.24.tar.gz", "has_sig": false, "md5_digest": "9b3cad2960d8a89993cb49e968ea86b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7764, "upload_time": "2015-10-31T02:32:44", "url": "https://files.pythonhosted.org/packages/44/2d/11c5eee75824ba57776d4c5c0a12c777fece3940ef23ed1307924dd290fd/pifaceio-1.24.tar.gz" } ], "1.25": [ { "comment_text": "", "digests": { "md5": "18b220fcee717378574417a59a65e15d", "sha256": "c6bdb7731d2089e27dcf64ecafa1729c41cd1dc44191a6d7ccd0563e4d8f4d83" }, "downloads": -1, "filename": "pifaceio-1.25.tar.gz", "has_sig": false, "md5_digest": "18b220fcee717378574417a59a65e15d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7791, "upload_time": "2016-04-26T00:13:09", "url": "https://files.pythonhosted.org/packages/f5/19/0e271b2d5a03bf2a065a3c23a0d01a77bf51ff5d1fb479415844f3f65cc8/pifaceio-1.25.tar.gz" } ], "1.26": [ { "comment_text": "", "digests": { "md5": "c7485613a6b74f9b99bc72c9c232bb8d", "sha256": "81ab6f18693fb3de923c28ff2ba48991b3d01ba3d770f5404fe001447afebea8" }, "downloads": -1, "filename": "pifaceio-1.26.tar.gz", "has_sig": false, "md5_digest": "c7485613a6b74f9b99bc72c9c232bb8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7873, "upload_time": "2017-08-20T05:29:01", "url": "https://files.pythonhosted.org/packages/c5/3d/80ebbb2d6525f7b89af4ec859bee36369e227e3076878fde89d8dcd68cf9/pifaceio-1.26.tar.gz" } ], "1.26.1": [ { "comment_text": "", "digests": { "md5": "c10063c2675964efa882c63c1e32bf4e", "sha256": "f59d1825b17848a3e3a5d2de2e5d4536724d9210a33b4ff8dce2eefc64e67e3e" }, "downloads": -1, "filename": "pifaceio-1.26.1.tar.gz", "has_sig": false, "md5_digest": "c10063c2675964efa882c63c1e32bf4e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7953, "upload_time": "2018-03-16T22:38:00", "url": "https://files.pythonhosted.org/packages/e5/f9/3317b866c799604683a33a37d027c9b05b2b1c90013c4eb3501b70c56c85/pifaceio-1.26.1.tar.gz" } ], "1.26.3": [ { "comment_text": "", "digests": { "md5": "5d68f5040c13f5bab5d5ea4c4cd6e6c5", "sha256": "fda02a3c7b29678782dc4837d2d57d3da3816088776b436053776c245dd4fc93" }, "downloads": -1, "filename": "pifaceio-1.26.3.tar.gz", "has_sig": false, "md5_digest": "5d68f5040c13f5bab5d5ea4c4cd6e6c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8086, "upload_time": "2018-08-13T01:34:53", "url": "https://files.pythonhosted.org/packages/32/03/99249ea09cda35bc87943c1e1a2177172cdd85dfe744bf1b3277ecfc0e2d/pifaceio-1.26.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5d68f5040c13f5bab5d5ea4c4cd6e6c5", "sha256": "fda02a3c7b29678782dc4837d2d57d3da3816088776b436053776c245dd4fc93" }, "downloads": -1, "filename": "pifaceio-1.26.3.tar.gz", "has_sig": false, "md5_digest": "5d68f5040c13f5bab5d5ea4c4cd6e6c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8086, "upload_time": "2018-08-13T01:34:53", "url": "https://files.pythonhosted.org/packages/32/03/99249ea09cda35bc87943c1e1a2177172cdd85dfe744bf1b3277ecfc0e2d/pifaceio-1.26.3.tar.gz" } ] }