{ "info": { "author": "Stefan Mavrodiev", "author_email": "support@olimex.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Education", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Topic :: Home Automation", "Topic :: Software Development :: Embedded Systems" ], "description": "This package provide methods for controlling GPIO pins, I2C and SPI buses.\nThis is written for A10-Lime, but it can be used with other boards. If you do\nthis we cannot guarantee proper operation of the module. Before using this\npackage we recommend reading the article at olimex wiki:\n\nhttps://www.olimex.com/wiki/A10-OLinuXino-LIME\n\nWhen using GPIO make sure that the desired gpio is not used by another periphery.\n\nGPIO METHODS\n============\n\n init() - Make initialization of the module. Always 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\n\nThe available constants are:\n\n NAME - EQUALS TO\n ==== =========\n HIGH -> 1\n LOW -> 0\n INPUT -> 0\n OUPTUT -> 1\n PULLUP -> 1\n PULLDOWN -> 2\n\n\nThe gpio are named two ways:\n\n By port name: PH0, PG2, PE10, etc.\n These can be imported from port module:\n\n >>> from pyA10Lime.gpio import port\n >>> dir(port)\n\n By connector name and pin number: gpio2p12, gpio3p8, etc.\n These can be imported from connector module:\n\n >>> from pyA10Lime.gpio import connector\n >>> dir(connector)\n\nGenerally these constants are just an offset in the memory from the base GPIO address, so they can\nbe assigned to a number type variable.\n\n >>> led = port.PH2\n >>> print led\n 226\n\n\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\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\n\n\nExamples\n========\n\nGPIO::\n\n #!/usr/bin/env python\n\n from pyA10Lime.gpio import gpio\n from pyA10Lime.gpio import port\n from pyA10Lime.gpio import connector\n\n gpio.init() #Initialize module. Always called first\n\n gpio.setcfg(port.PG9, gpio.OUTPUT) #Configure LED1 as output\n gpio.setcfg(port.PG9, 1) #This is the same as above\n\n gpio.setcfg(port.PE11, gpio.INPUT) #Configure PE11 as input\n gpio.setcfg(port.PE11, 0) #Same as above\n\n gpio.pullup(port.PE11, 0) #Clear pullups\n gpio.pullup(port.PE11, gpio.PULLDOWN) #Enable pull-down\n gpio.pullup(port.PE11, gpio.PULLUP) #Enable pull-up\n\n while True:\n if gpio.input(port.PE11) == 1:\n gpio.output(port.PG9, gpio.LOW)\n gpio.output(port.PG9, 0)\n else:\n gpio.output(port.PG9, gpio.HIGH)\n gpio.output(port.PG9, 1)\n\n\nI2C::\n\n #!/usr/bin/env python\n\n from pyA10Lime import i2c\n\n i2c.init(\"/dev/i2c-2\") #Initialize module to use /dev/i2c-2\n i2c.open(0x55) #The slave device address is 0x55\n\n #If we want to write to some register\n i2c.write([0xAA, 0x20]) #Write 0x20 to register 0xAA\n i2c.write([0xAA, 0x10, 0x11, 0x12]) #Do continuous write with start address 0xAA\n\n #If we want to do write and read\n i2c.write([0xAA]) #Set address at 0xAA register\n value = i2c.read(1) #Read 1 byte with start address 0xAA\n\n i2c.close() #End communication with slave device\n\n\nSPI::\n\n #!/usr/bin/env python\n\n from pyA10Lime import spi\n\n spi.open(\"/dev/spidev2.0\")\n #Open SPI device with default settings\n # mode : 0\n # speed : 100000kHz\n # delay : 0\n # bits-per-word: 8\n\n #Different ways to open device\n spi.open(\"/dev/spidev2.0\", mode=1)\n spi.open(\"/dev/spidev2.0\", mode=2, delay=0)\n spi.open(\"/dev/spidev2.0\", mode=3, delay=0, bits_per_word=8)\n spi.open(\"/dev/spidev2.0\", mode=0, delay=0, bits_per_word=8, speed=100000)\n\n spi.write([0x01, 0x02]) #Write 2 bytes to slave device\n spi.read(2) #Read 2 bytes from slave device\n spi.xfer([0x01, 0x02], 2) #Write 2 byte and then read 2 bytes.\n\n spi.close() #Close SPI bus\n\n\nIt's important that you run your python script as root!\n \n\n Changelog\n=========\n * pyA10Lime 0.2.1 (30 JUN 2015)\n * Fixed issue with SPI xfer function\n\n * pyA10Lime 0.2.0 (02 SEP 2014)\n * Updated to enable SPI and I2C control\n * GPIO constant in separate modules\n * Added example files\n * Added support for Python3\n\n * pyA10Lime 0.1.0 (23 JAN 2014)\n * Initial release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.olimex.com/", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "pyA10Lime", "package_url": "https://pypi.org/project/pyA10Lime/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyA10Lime/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://www.olimex.com/" }, "release_url": "https://pypi.org/project/pyA10Lime/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "Control GPIO, I2C and SPI", "version": "0.2.1" }, "last_serial": 1612810, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e63623ee47ecbbef47211745df0ce323", "sha256": "9004aacf9c5c97e3eeffc7316209c6700c5b0d466988a9447f6c257f20a4321d" }, "downloads": -1, "filename": "pyA10Lime-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e63623ee47ecbbef47211745df0ce323", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6394, "upload_time": "2014-01-24T06:35:32", "url": "https://files.pythonhosted.org/packages/ac/41/d0e7a6d1d653006a86e1bd6ef14012a577582b9eab500a80dd7ff3c63764/pyA10Lime-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "304add3f0643ac31681846b20a84a832", "sha256": "f9b1260ddcf659832c9897e817d06c63b2a86031111243925e650eeacb0fc63e" }, "downloads": -1, "filename": "pyA10Lime-0.1.1.tar.gz", "has_sig": false, "md5_digest": "304add3f0643ac31681846b20a84a832", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6395, "upload_time": "2014-01-24T06:37:29", "url": "https://files.pythonhosted.org/packages/c9/8c/5b156d3f4519788a5f6f8f0e0bb743d694a30e217606ac54edbdc3992ef9/pyA10Lime-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1d8606b5b4cb47c3dde5b5912a343755", "sha256": "16e2c9f84d422e8780ce28e8d7000683f644311293cbc82f244bb6a7d395d1cc" }, "downloads": -1, "filename": "pyA10Lime-0.2.0.tar.gz", "has_sig": false, "md5_digest": "1d8606b5b4cb47c3dde5b5912a343755", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13847, "upload_time": "2014-09-04T10:29:17", "url": "https://files.pythonhosted.org/packages/fb/93/ac8b01c07d8675d86c4af2e4faa3ae9028de7d272114be42fbd7c37ebb33/pyA10Lime-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "be9704a43f4c6a00a3337aa7b1963e7a", "sha256": "45644adc46a25689b70ddbb1aa96036d3ee349b82d8de4c861b83767726eca4b" }, "downloads": -1, "filename": "pyA10Lime-0.2.1.tar.gz", "has_sig": false, "md5_digest": "be9704a43f4c6a00a3337aa7b1963e7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13911, "upload_time": "2015-06-30T08:52:33", "url": "https://files.pythonhosted.org/packages/e6/52/a6b558fd5c8eb11e5de710271d59881769425e61d3adf6d235836ca877cc/pyA10Lime-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "be9704a43f4c6a00a3337aa7b1963e7a", "sha256": "45644adc46a25689b70ddbb1aa96036d3ee349b82d8de4c861b83767726eca4b" }, "downloads": -1, "filename": "pyA10Lime-0.2.1.tar.gz", "has_sig": false, "md5_digest": "be9704a43f4c6a00a3337aa7b1963e7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13911, "upload_time": "2015-06-30T08:52:33", "url": "https://files.pythonhosted.org/packages/e6/52/a6b558fd5c8eb11e5de710271d59881769425e61d3adf6d235836ca877cc/pyA10Lime-0.2.1.tar.gz" } ] }