{ "info": { "author": "Stefan Mavrodiev", "author_email": "stefan@olimex.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Education", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Topic :: Home Automation", "Topic :: Software Development :: Embedded Systems" ], "description": "pyA20\n=====\n\n|Build Status|\n\nDescription\n-----------\n\nThe package provide methods for controlling GPIO pins, I2C and SPI\nbuses. It's written for\n`A20-OLinuXino-MICRO `__,\nbut it can be used with other boards. In this case proper operation is\nnot guaranteed. You can check\n`wiki `__ for more\ninformation.\n\n**Notes**:\n\n\t* When using GPIO make sure that the desired gpio is not used by another periphery.\n\t* Using this library requires root access.\n\nGPIO methods\n------------\n\nThe following methods are available:\n\n* **init()** - Make initialization of the module. Must be called first.\n* **getcfg()** - Read current configuration of gpio.\n* **setcfg()** - Write configuration to gpio.\n* **input()** - Return current value of gpio.\n* **output()** - Set output value.\n* **pullup()** - Set pull-up/pull-down.\n\nThe available constants are:\n\n* **HIGH** - 1\n* **LOW** - 0\n* **INPUT** - 0\n* **OUPTUT** - 1\n* **PULLUP** - 1\n* **PULLDOWN** - 2\n\nThe gpio are named two ways:\n\n* By port name: PH0, PG2, PE10, etc. These can be imported from port module:\n\n.. code:: python\n\n\t>>> from pyA20.gpio import port\n\t>>> dir(port)\n\n* By connector name and pin number: gpio2p12, gpio3p8, lcdp18, uext1p3 and etc:\n\n.. code:: python\n\n\t>>> from pyA20.gpio import connector\n\t>>> dir(connector)\n\nGenerally these constants are just an offset in the memory from the base\nGPIO address, so they can be assigned to a number type variable.\n\n.. code:: python\n\n\t>>> led = port.PH2\n\t>>> print led\n\t226\n\nI2C methods\n-----------\n\n- **init()** - Make initialization of the module\n- **open()** - Begin communication with slave device\n- **read()** - Read from slave device\n- **write()** - Write data to slave device\n- **close()** - End communication with slave device\n\nSPI methods\n-----------\n\n- **open()** - Open SPI bus with given configuration\n- **read()** - Read data from slave device without write\n- **write()** - Write data to slave device without read\n- **xfer()** - Do write and after that read\n- **close()** - Close SPI bus\n\nExamples\n--------\n\nGPIO\n~~~~\n\nThe example consist of: \\* Initialize gpio module \\* Initialize one gpio\nas output and another one as input \\* Polling input state and write\ncorresponding output value\n\n.. code:: python\n\n\t#!/usr/bin/env python\n\n\tfrom pyA20.gpio import gpio\n\tfrom pyA20.gpio import port\n\tfrom pyA20.gpio import connector\n\n\tgpio.init() #Initialize module. Always called first\n\n\tgpio.setcfg(port.PG9, gpio.OUTPUT) #Configure LED1 as output\n\tgpio.setcfg(port.PG9, 1) #This is the same as above\n\n\tgpio.setcfg(port.PE11, gpio.INPUT) #Configure PE11 as input\n\tgpio.setcfg(port.PE11, 0) #Same as above\n\n\tgpio.pullup(port.PE11, 0) #Clear pullups\n\tgpio.pullup(port.PE11, gpio.PULLDOWN) #Enable pull-down\n\tgpio.pullup(port.PE11, gpio.PULLUP) #Enable pull-up\n\n\twhile True:\n\t\tif gpio.input(port.PE11) == 1:\n\t\t\tgpio.output(port.PG9, gpio.LOW)\n\t\t\tgpio.output(port.PG9, 0)\n\t\telse:\n\t\t\tgpio.output(port.PG9, gpio.HIGH)\n\t\t\tgpio.output(port.PG9, 1)\n\nI2C\n~~~\n\nIn this example: \\* I2C module is imported \\* Bus number 2 is opened \\*\nSome data is written, then verified\n\n.. code:: python\n\n\t#!/usr/bin/env python\n\n\tfrom pyA20.i2c import i2c\n\n\ti2c.init(\"/dev/i2c-2\") #Initialize module to use /dev/i2c-2\n\ti2c.open(0x55) #The slave device address is 0x55\n\n\t#If we want to write to some register\n\ti2c.write([0xAA, 0x20]) #Write 0x20 to register 0xAA\n\ti2c.write([0xAA, 0x10, 0x11, 0x12]) #Do continuous write with start address 0xAA\n\n\t#If we want to do write and read\n\ti2c.write([0xAA]) #Set address at 0xAA register\n\tvalue = i2c.read(1) #Read 1 byte with start address 0xAA\n\n\ti2c.close() #End communication with slave device\n\nSPI\n~~~\n\nIn ths example: \\* SPI module is imported \\* Bus 2 with chip-select 0 is\nopened \\* Some data is transfered to slave device\n\n.. code:: python\n\n\t#!/usr/bin/env python\n\n\tfrom pyA20.spi import spi\n\n\tspi.open(\"/dev/spidev2.0\")\n\t#Open SPI device with default settings\n\t# mode : 0\n\t# speed : 100000kHz\n\t# delay : 0\n\t# bits-per-word: 8\n\n\t#Different ways to open device\n\tspi.open(\"/dev/spidev2.0\", mode=1)\n\tspi.open(\"/dev/spidev2.0\", mode=2, delay=0)\n\tspi.open(\"/dev/spidev2.0\", mode=3, delay=0, bits_per_word=8)\n\tspi.open(\"/dev/spidev2.0\", mode=0, delay=0, bits_per_word=8, speed=100000)\n\n\tspi.write([0x01, 0x02]) #Write 2 bytes to slave device\n\tspi.read(2) #Read 2 bytes from slave device\n\tspi.xfer([0x01, 0x02], 2) #Write 2 byte and then read 2 bytes.\n\n\tspi.close() #Close SPI bus\n\nChangelog\n---------\n- pyA20 0.2.12 (8 DEC 2017)\n\n\t- Fixed extensions import\n\t- Update examples\n\n- pyA20 0.2.11 (21 NOV 2017)\n\n\t- Fixed mapping on portG\n\t- Updated README\n\t- Removed processor checking to allow build scripts\n\t- Update license\n\n- pyA20 0.2.0 (02 SEP 2014)\n\n\t- Updated to enable SPI and I2C control\n\t- GPIO constant in separate modules\n\t- Added example files\n\t- Added support for Python3\n\n.. |Build Status| image:: https://travis-ci.org/StefanMavrodiev/pyA20.svg?branch=master\n :target: https://travis-ci.org/StefanMavrodiev/pyA20", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.olimex.com/", "keywords": "", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "pyA20", "package_url": "https://pypi.org/project/pyA20/", "platform": "", "project_url": "https://pypi.org/project/pyA20/", "project_urls": { "Homepage": "https://www.olimex.com/" }, "release_url": "https://pypi.org/project/pyA20/0.2.12/", "requires_dist": null, "requires_python": "", "summary": "Control GPIO, I2C and SPI on A20-OLinuXino-MICRO", "version": "0.2.12" }, "last_serial": 3400261, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a8e173f7bcad826c4603e026aeb4630b", "sha256": "7d0d06bc607dda83e3e06d7dea2751b9e07aad79469f791d83213b27057800d6" }, "downloads": -1, "filename": "pyA20-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a8e173f7bcad826c4603e026aeb4630b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4834, "upload_time": "2013-08-20T05:33:22", "url": "https://files.pythonhosted.org/packages/11/0b/af68c9d306babd6b4d2213d3c925250aea7550adf5deebf08b2e65e28874/pyA20-0.1.0.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "93352b0e371cfc2d71e33de3db0af9cc", "sha256": "2f8fcda878e25157145a36cf71c6d1f6d032316bfcbd3c2e9e067d6c05c0efda" }, "downloads": -1, "filename": "pyA20-0.1.2.tar.gz", "has_sig": false, "md5_digest": "93352b0e371cfc2d71e33de3db0af9cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6731, "upload_time": "2013-08-23T14:01:51", "url": "https://files.pythonhosted.org/packages/e0/21/ca75df3e5f5ea699ad68454784f5eec621cfe806a3934173769f003da9f1/pyA20-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "a08bd8c2851331324b0965b0da90c98c", "sha256": "bc06ac950a46bbc530f55a447b08923c43b52ea73a7d0fd9e1baccf26d314e53" }, "downloads": -1, "filename": "pyA20-0.1.3.tar.gz", "has_sig": false, "md5_digest": "a08bd8c2851331324b0965b0da90c98c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5850, "upload_time": "2013-08-23T14:04:41", "url": "https://files.pythonhosted.org/packages/ed/ee/95dae8b01bdf548b3d589239a5ad2de21e876daa1fe8ad212aaa365fa092/pyA20-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "67f228bf5fce2b1a2343ea1320ec4a24", "sha256": "0ff2c653596cb88dc70290755ec6ee7277deadcbfc1f0b37e086e07cb4a7dc5a" }, "downloads": -1, "filename": "pyA20-0.1.4.tar.gz", "has_sig": false, "md5_digest": "67f228bf5fce2b1a2343ea1320ec4a24", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6716, "upload_time": "2013-09-13T12:54:51", "url": "https://files.pythonhosted.org/packages/cc/cc/ce9d9d3e907d11d29fcb35479d76c88a88de52bafa6ad49599f1c5796561/pyA20-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "6b2db6d4a9465fda12dd4470113e526b", "sha256": "02f05f9be8d4950a2898a2c5f5bc9e427d4a8cac85a19eff37cecb674580e7aa" }, "downloads": -1, "filename": "pyA20-0.1.5.tar.gz", "has_sig": false, "md5_digest": "6b2db6d4a9465fda12dd4470113e526b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6650, "upload_time": "2013-09-13T12:57:25", "url": "https://files.pythonhosted.org/packages/55/2c/8da847bc583f4f23234025c022e5a1a191631a1c3843f46cd6bde60bb0a2/pyA20-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "ee29f1ced6366eced83724a6cd736c0e", "sha256": "bc4501dfd2188bed0025db46cea98f14de464ed47d6591e15b22a0ac9a8c684f" }, "downloads": -1, "filename": "pyA20-0.1.6.tar.gz", "has_sig": false, "md5_digest": "ee29f1ced6366eced83724a6cd736c0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6609, "upload_time": "2013-09-13T13:00:06", "url": "https://files.pythonhosted.org/packages/42/5b/fdc33e58deb009814eb9d5c22f3beeee34d7c70c694b738015f309015796/pyA20-0.1.6.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "b4115859834f09ebd389f810f2ffefb9", "sha256": "9855747d9bbdfcce6b460fcd67d953155e39f4e002a9a4c573910248b451dad8" }, "downloads": -1, "filename": "pyA20-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b4115859834f09ebd389f810f2ffefb9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14433, "upload_time": "2014-09-04T10:34:05", "url": "https://files.pythonhosted.org/packages/73/8b/b15a0b201b105c85ee0cf33fc485618fcd6c9e1bd91f432cf02d6e74b2d5/pyA20-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "2290066bbe274000c53693959a8005b4", "sha256": "b15e4ee1016b7eb52001cbccde3751868624a88d2adbb9adc5404628f7e59e7e" }, "downloads": -1, "filename": "pyA20-0.2.1.tar.gz", "has_sig": false, "md5_digest": "2290066bbe274000c53693959a8005b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14520, "upload_time": "2015-06-30T08:20:57", "url": "https://files.pythonhosted.org/packages/8e/a5/8169ac07290b7d7dfff96dbf68707a2154171e48294e78eb7623758a299f/pyA20-0.2.1.tar.gz" } ], "0.2.10": [ { "comment_text": "", "digests": { "md5": "c6ea5dfd914e1cd6841f804e504ac55a", "sha256": "2b91d1c9d4ab15a37814169617729e24e1c6e48a64624e8ce778031b07de2493" }, "downloads": -1, "filename": "pyA20-0.2.10.tar.gz", "has_sig": false, "md5_digest": "c6ea5dfd914e1cd6841f804e504ac55a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13463, "upload_time": "2017-11-21T07:31:10", "url": "https://files.pythonhosted.org/packages/50/9b/e0d66d27536fe7a1f558a1ae2b7d5c00af5bf5905182b5cb513dfa1e5194/pyA20-0.2.10.tar.gz" } ], "0.2.11": [ { "comment_text": "", "digests": { "md5": "a7eed0379b8faf15f85c9524e0f6656b", "sha256": "3e834683c07b2e6163fb8184e1409cb63fc34dca810cc7fac06a0ea7d12e574b" }, "downloads": -1, "filename": "pyA20-0.2.11.tar.gz", "has_sig": false, "md5_digest": "a7eed0379b8faf15f85c9524e0f6656b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13500, "upload_time": "2017-11-21T08:02:06", "url": "https://files.pythonhosted.org/packages/4c/a4/724ef69b2b618b99c57ce266f8f48a05401628c492c1960791c229cd7815/pyA20-0.2.11.tar.gz" } ], "0.2.12": [ { "comment_text": "", "digests": { "md5": "cab03b4931199804603d1074f6d8f48f", "sha256": "4bef559a9c5a4d648d9834bad996cf2805b20d6063b8051029ffdf9deda2b536" }, "downloads": -1, "filename": "pyA20-0.2.12.tar.gz", "has_sig": false, "md5_digest": "cab03b4931199804603d1074f6d8f48f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12678, "upload_time": "2017-12-08T09:46:36", "url": "https://files.pythonhosted.org/packages/dd/c2/ec7b33d0aacd1037635a50c5b6d238453415de2fd417de13d5d1545cb6d8/pyA20-0.2.12.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "28dfe58f2ccb23b819d35cf5d554ddc3", "sha256": "e5cf7c3461cc774f155ada9cd2e7e46f1a22fc508150c7dc17f1f2b4f0fa0701" }, "downloads": -1, "filename": "pyA20-0.2.6.tar.gz", "has_sig": false, "md5_digest": "28dfe58f2ccb23b819d35cf5d554ddc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13940, "upload_time": "2017-11-21T06:50:07", "url": "https://files.pythonhosted.org/packages/53/4b/b74a5b8560b3fd32e22d8abc44243054bfa04e8ff802c7158fa2d7c08c91/pyA20-0.2.6.tar.gz" } ], "0.2.7": [ { "comment_text": "", "digests": { "md5": "9d7707ce347e7eee2e2a1d03ece92c04", "sha256": "633b5208ca3f1363760515a4350eb102adefcfae8a572f25952001c1b523e5c8" }, "downloads": -1, "filename": "pyA20-0.2.7.tar.gz", "has_sig": false, "md5_digest": "9d7707ce347e7eee2e2a1d03ece92c04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13821, "upload_time": "2017-11-21T06:59:03", "url": "https://files.pythonhosted.org/packages/d9/02/9737f9d734f57873bf165067dd186e6838eb13af5f12671e9966a0da7649/pyA20-0.2.7.tar.gz" } ], "0.2.8": [ { "comment_text": "", "digests": { "md5": "a1850afa763df42be5c63da95901ead2", "sha256": "b76aff6246c313215c8442d1faac75ab358acf986338ba07ea7544d2d626f799" }, "downloads": -1, "filename": "pyA20-0.2.8.tar.gz", "has_sig": false, "md5_digest": "a1850afa763df42be5c63da95901ead2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13562, "upload_time": "2017-11-21T07:10:37", "url": "https://files.pythonhosted.org/packages/45/5a/894ebdda13a962e320fff2f2bb4bf20d9dbe0c43d9e8580ba71956f04604/pyA20-0.2.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cab03b4931199804603d1074f6d8f48f", "sha256": "4bef559a9c5a4d648d9834bad996cf2805b20d6063b8051029ffdf9deda2b536" }, "downloads": -1, "filename": "pyA20-0.2.12.tar.gz", "has_sig": false, "md5_digest": "cab03b4931199804603d1074f6d8f48f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12678, "upload_time": "2017-12-08T09:46:36", "url": "https://files.pythonhosted.org/packages/dd/c2/ec7b33d0aacd1037635a50c5b6d238453415de2fd417de13d5d1545cb6d8/pyA20-0.2.12.tar.gz" } ] }