{ "info": { "author": "Philip Howard", "author_email": "phil@pimoroni.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development", "Topic :: System :: Hardware" ], "description": "i2cdevice\n=========\n\n|Build Status| |Coverage Status| |PyPi Package| |Python Versions|\n\ni2cdevice is a python domain-specific language aimed at dealing with\ncommon SMBus/i2c device interaction patterns.\n\nThis project aims to make group-up implementations of Python libraries\nfor i2c devices easier, simpler and inherently self-documenting.\n\nIt does this by separating a detailed description of the hardware\nregisters and how they should be manipulated into a stuctured definition\nlanguage.\n\nThis project does not aim to help you make a public API for Python\ndevices- that should be built on top of the fundamentals presented here.\n\nUsing This Library\n==================\n\nYou should generally aim for a 1:1 representation of the hardware\nregisters in the device you're implementing, even if you don't plan to\nuse all the functionality. Having the full register set implemented\nallows for the easy addition of new features in future.\n\nCheckout the libraries listed below for real-world examples.\n\nFeatures\n========\n\n- Classes for describing devices, registers and individual bit fields\n within registers in a fashion which maps closely with the datasheet\n- Value translation from real world numbers (such as ``512ms``) to\n register values (such as ``0b111``) and back again\n- Read registers into a namedtuple of fields using ``get``\n- Write multiple register fields in a transaction using ``set`` with\n keyword arguments\n- Support for treating multiple-bytes as a single value, or single\n register with multiple values\n\nBuilt With i2cdevice\n====================\n\n- bme280 - https://github.com/pimoroni/bme280-python\n- bmp280 - https://github.com/pimoroni/bmp280-python\n- bh1745 - https://github.com/pimoroni/bh1745-python\n- as7262 - https://github.com/pimoroni/as7262-python\n- lsm303d - https://github.com/pimoroni/lsm303d-python\n- ltr559 - https://github.com/pimoroni/ltr559-python\n\nExamples\n========\n\nThe below example defines the ``ALS_CONTROL`` register on an ltr559,\nwith register address ``0x80``.\n\nIt has 3 fields; gain - which is mapped to real world values - and\nsw\\_reset/mode which are single bit flags.\n\n.. code:: python\n\n ALS_CONTROL = Register('ALS_CONTROL', 0x80, fields=(\n BitField('gain', 0b00011100, values_map={1: 0b000, 2: 0b001, 4: 0b011, 8:0b011, 48:0b110, 96:0b111}),\n BitField('sw_reset', 0b00000010),\n BitField('mode', 0b00000001)\n ))\n\nA lookup table is not required for values, however, a function can be\nused to translate values from and to a format that the device\nunderstands.\n\nThe below example uses ``i2cdevice._byte_swap`` to change the endianness\nof two 16bit values before they are stored/retrieved.\n\n.. code:: python\n\n # This will address 0x88, 0x89, 0x8A and 0x8B as a continuous 32bit register\n ALS_DATA = Register('ALS_DATA', 0x88, fields=(\n BitField('ch1', 0xFFFF0000, bitwidth=16, values_in=_byte_swap, values_out=_byte_swap),\n BitField('ch0', 0x0000FFFF, bitwidth=16, values_in=_byte_swap, values_out=_byte_swap)\n ), read_only=True, bitwidth=32)\n\nA \"Register\" and its \"BitField\"s define a set of rules and logic for\ndetailing with the hardware register which is intepreted by the device\nclass. Registers are declared on a device using the ``registers=()``\nkeyword argument:\n\n.. code:: python\n\n I2C_ADDR = 0x23\n ltr559 = Device(I2C_ADDR, bit_width=8, registers=(\n ALS_CONTROL,\n ALS_DATA\n ))\n\nReading Registers\n-----------------\n\nOne configured a register's fields can be read into a namedtuple using\nthe ``get`` method:\n\n.. code:: python\n\n register_values = ltr559.get('ALS_CONTROL')\n gain = register_values.gain\n sw_reset = register_values.sw_reset\n mode = register_values.mode\n\nWriting Registers\n-----------------\n\nThe namedtuple returned from ``get`` is immutable and does not attempt\nto map values back to the hardware, in order to write one or more fields\nto a register you must use ``set`` with a keyword argument for each\nfield:\n\n.. code:: python\n\n ltr559.set('ALS_CONTROL',\n gain=4,\n sw_reset=1)\n\nThis will read the register state from the device, update the bitfields\naccordingly and write the result back.\n\n.. |Build Status| image:: https://travis-ci.com/pimoroni/i2cdevice-python.svg?branch=master\n :target: https://travis-ci.com/pimoroni/i2cdevice-python\n.. |Coverage Status| image:: https://coveralls.io/repos/github/pimoroni/i2cdevice-python/badge.svg?branch=master\n :target: https://coveralls.io/github/pimoroni/i2cdevice-python?branch=master\n.. |PyPi Package| image:: https://img.shields.io/pypi/v/i2cdevice.svg\n :target: https://pypi.python.org/pypi/i2cdevice\n.. |Python Versions| image:: https://img.shields.io/pypi/pyversions/i2cdevice.svg\n :target: https://pypi.python.org/pypi/i2cdevice\n\n0.0.6\n-----\n\n* New API methods set and get\n\n0.0.5\n-----\n\n* Bump to stable release\n\n0.0.4\n-----\n\n* Bugfixes\n\n0.0.3\n-----\n\n* Added License\n\n0.0.2\n-----\n\n* Major Refactor\n\n0.0.1\n-----\n\n* Initial Release\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.pimoroni.com", "keywords": "Raspberry Pi,SMBUS,i2c", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "i2cdevice", "package_url": "https://pypi.org/project/i2cdevice/", "platform": "", "project_url": "https://pypi.org/project/i2cdevice/", "project_urls": { "GitHub": "https://www.github.com/pimoroni/i2cdevice-python", "Homepage": "http://www.pimoroni.com" }, "release_url": "https://pypi.org/project/i2cdevice/0.0.6/", "requires_dist": null, "requires_python": "", "summary": "Python DSL for interacting with SMBus-compatible i2c devices", "version": "0.0.6" }, "last_serial": 5802904, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "b9e3938b448f122ee58328607315dd80", "sha256": "e8506cd94aa0a2ca6bb45d999100f68f551c6eab2259ff8d923fd6a00a003f36" }, "downloads": -1, "filename": "i2cdevice-0.0.1.tar.gz", "has_sig": false, "md5_digest": "b9e3938b448f122ee58328607315dd80", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3430, "upload_time": "2018-07-16T11:14:02", "url": "https://files.pythonhosted.org/packages/b7/9a/37f8bc4a371e92d36a7a4f9efc0437ddbc4b955ef9c2dc684edc015f4136/i2cdevice-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "2fa55a6f9874ada5bd47d754e288892c", "sha256": "404f126f01ee56510a9529f7215702c32ab03d6499aecafc7f7a84ac0de1eb37" }, "downloads": -1, "filename": "i2cdevice-0.0.2-py2-none-any.whl", "has_sig": false, "md5_digest": "2fa55a6f9874ada5bd47d754e288892c", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4879, "upload_time": "2018-07-18T13:54:18", "url": "https://files.pythonhosted.org/packages/dd/b3/a3ab13bd3877b3edbd32c5f32cc0589d7d7a5b2c332f9d08c697da234f5d/i2cdevice-0.0.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c6764117b7a468c11dca106671d3a341", "sha256": "cde049e5c849efc46ffae01104cf0f69878d6801c7714140ed70534f2957d8b6" }, "downloads": -1, "filename": "i2cdevice-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "c6764117b7a468c11dca106671d3a341", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4877, "upload_time": "2018-07-18T13:54:19", "url": "https://files.pythonhosted.org/packages/8e/f0/1a7faee2ceab074140a029e973565d9b17759df315d1d0e810b8ca540054/i2cdevice-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bacdb8717d8548e8fe5d2ede38229d65", "sha256": "58f7a6e29ee8fecf38daff119b0334ec2bb79a89e063c1f0f7ab3dd7314585f2" }, "downloads": -1, "filename": "i2cdevice-0.0.2.tar.gz", "has_sig": false, "md5_digest": "bacdb8717d8548e8fe5d2ede38229d65", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4156, "upload_time": "2018-07-18T13:54:20", "url": "https://files.pythonhosted.org/packages/3e/1c/eb14ee6c7b193c09b1a50e31d2ecb029f2046fe6423a679fbf96ce1b79d5/i2cdevice-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "100966190bd03209688a5c20c6d20d28", "sha256": "aa65a5d45320825576ad6ad48fd443b5f0e00297b00e95468b2928508fb4df57" }, "downloads": -1, "filename": "i2cdevice-0.0.3.linux-armv7l.tar.gz", "has_sig": false, "md5_digest": "100966190bd03209688a5c20c6d20d28", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6979, "upload_time": "2018-08-08T14:58:58", "url": "https://files.pythonhosted.org/packages/72/a9/00a3a8ea1fe1b55c6adee80f984735a07824928b8f84bb6b833d678fe7db/i2cdevice-0.0.3.linux-armv7l.tar.gz" }, { "comment_text": "", "digests": { "md5": "4a73ca9d3e6b717ad35314c9de14c189", "sha256": "3dc8794cdd3471a2524c8ffc57cf5c9d48cfc464bb5d43105726555ae5b00f76" }, "downloads": -1, "filename": "i2cdevice-0.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "4a73ca9d3e6b717ad35314c9de14c189", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4876, "upload_time": "2018-08-08T14:58:56", "url": "https://files.pythonhosted.org/packages/57/00/f0983369be6f77379a675c8a94ababc5a9647972224aea7a40624ac88bc9/i2cdevice-0.0.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9b0bf6429a50e9250c80d67ec8c4471", "sha256": "020b45df838af2b3d0d64e01a398c4e37187fc1bf590dcb1dabbe01ebdd8c713" }, "downloads": -1, "filename": "i2cdevice-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "b9b0bf6429a50e9250c80d67ec8c4471", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4876, "upload_time": "2018-08-08T14:58:57", "url": "https://files.pythonhosted.org/packages/a1/46/4e4a1cba84a39ddc879a0c0990990000105a4121dc998dcfea99cfabde44/i2cdevice-0.0.3-py3-none-any.whl" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "1c11237748b063cb4cdc9a6e95f1ad65", "sha256": "ab12e558a72c6c95ca3501c1ae5c53d66ea7d94f27e3e7573cd83e18c2990d2a" }, "downloads": -1, "filename": "i2cdevice-0.0.4-py2-none-any.whl", "has_sig": false, "md5_digest": "1c11237748b063cb4cdc9a6e95f1ad65", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 4876, "upload_time": "2018-08-15T10:02:07", "url": "https://files.pythonhosted.org/packages/76/30/986fed5b71d996e4f697cd68e78e5f4ea85bffb9f8dc4f6e1fa0d7231482/i2cdevice-0.0.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "29c0f42aa5093652c889f0057f64c715", "sha256": "3eec8e8ded026528af217ce633a5146849a9cb76f035f34b003be033b288bdc9" }, "downloads": -1, "filename": "i2cdevice-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "29c0f42aa5093652c889f0057f64c715", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4876, "upload_time": "2018-08-15T10:02:08", "url": "https://files.pythonhosted.org/packages/0d/b8/12d1fdf4b80f1e1d912039fd1713f8f3ea32a2a66259b5ad6ce218b0ec08/i2cdevice-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bf0c5239b0bfc0e56cb6af1510675487", "sha256": "b1ff908b1ccc1c6756ff14f5bdee90bd5081e1f6a6d28329632eaf15ba37e8e7" }, "downloads": -1, "filename": "i2cdevice-0.0.4.tar.gz", "has_sig": false, "md5_digest": "bf0c5239b0bfc0e56cb6af1510675487", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4325, "upload_time": "2018-08-15T10:02:10", "url": "https://files.pythonhosted.org/packages/17/bb/826e98605f393aa1be0a3ebcb8029a009f8721d3c3a96bf45f1fafa7b1c7/i2cdevice-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "f6604434fe057cc03de08f29b3af1ff5", "sha256": "8df1fb3bebe0344b160809d1515cc63ad3ffaabd7d5a5e4b1d124316ab758ad1" }, "downloads": -1, "filename": "i2cdevice-0.0.5-py2-none-any.whl", "has_sig": false, "md5_digest": "f6604434fe057cc03de08f29b3af1ff5", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 8327, "upload_time": "2019-06-07T14:04:53", "url": "https://files.pythonhosted.org/packages/66/c4/97312e4798b9c39fdb0952e177b890c634fcad946701f529b56dbb991b28/i2cdevice-0.0.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e0701af8a302ccc5650c3dfc185fc1e4", "sha256": "507543c744e88e60dbfb9e13740350ac2f95962949ee961aac57f2a1e7718651" }, "downloads": -1, "filename": "i2cdevice-0.0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "e0701af8a302ccc5650c3dfc185fc1e4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8328, "upload_time": "2019-06-07T14:04:54", "url": "https://files.pythonhosted.org/packages/54/4e/c15240b95c8d6e27a4a701195c5574b96b72abad244ee2e198f6788b5d08/i2cdevice-0.0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b744d40ad3ffdb7c7d1294f3eea5fcfc", "sha256": "27b130a2e3187118cc69636352bd497f7bab7d0d9ae214d17cc4ca1c493e88ac" }, "downloads": -1, "filename": "i2cdevice-0.0.5.tar.gz", "has_sig": false, "md5_digest": "b744d40ad3ffdb7c7d1294f3eea5fcfc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6432, "upload_time": "2019-06-07T14:04:56", "url": "https://files.pythonhosted.org/packages/b0/86/72986b1d769365664592dedf5dbc2af11e7df8c80f9603dec079952531c3/i2cdevice-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "a92d0bc98009048735ddf4441b679d4b", "sha256": "1cfcb8f5dccb49c5e56c0c3e35af11a906beb188831b5126f494c79951483a4c" }, "downloads": -1, "filename": "i2cdevice-0.0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "a92d0bc98009048735ddf4441b679d4b", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7105, "upload_time": "2019-09-09T10:18:33", "url": "https://files.pythonhosted.org/packages/96/69/48acd5fd69c275605801c44f65270ba92ee66da09e4edca432d32783af5a/i2cdevice-0.0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5146d7e9def07ccd51fd4c5a014c16e8", "sha256": "c46977340ea69e51955b5650de300576a50a551fa0d2badc91ed7540f4893287" }, "downloads": -1, "filename": "i2cdevice-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "5146d7e9def07ccd51fd4c5a014c16e8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6282, "upload_time": "2019-09-09T10:18:35", "url": "https://files.pythonhosted.org/packages/b5/aa/a4f39fd59e4fd7915a65ce17e1b1653a47d61912d516ae6bf9c62cdb7e2d/i2cdevice-0.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0939e667482267bb36f0cae434f44168", "sha256": "369f772b481786fb5783f70a280c87d55ea05ef924bbda4b25eccd05ccc84523" }, "downloads": -1, "filename": "i2cdevice-0.0.6.tar.gz", "has_sig": false, "md5_digest": "0939e667482267bb36f0cae434f44168", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7143, "upload_time": "2019-09-09T10:18:37", "url": "https://files.pythonhosted.org/packages/28/92/123dc0508b2a2049c4e7dd8865339c634cc559c4c07e5882251d268cfda6/i2cdevice-0.0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a92d0bc98009048735ddf4441b679d4b", "sha256": "1cfcb8f5dccb49c5e56c0c3e35af11a906beb188831b5126f494c79951483a4c" }, "downloads": -1, "filename": "i2cdevice-0.0.6-py2-none-any.whl", "has_sig": false, "md5_digest": "a92d0bc98009048735ddf4441b679d4b", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7105, "upload_time": "2019-09-09T10:18:33", "url": "https://files.pythonhosted.org/packages/96/69/48acd5fd69c275605801c44f65270ba92ee66da09e4edca432d32783af5a/i2cdevice-0.0.6-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5146d7e9def07ccd51fd4c5a014c16e8", "sha256": "c46977340ea69e51955b5650de300576a50a551fa0d2badc91ed7540f4893287" }, "downloads": -1, "filename": "i2cdevice-0.0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "5146d7e9def07ccd51fd4c5a014c16e8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6282, "upload_time": "2019-09-09T10:18:35", "url": "https://files.pythonhosted.org/packages/b5/aa/a4f39fd59e4fd7915a65ce17e1b1653a47d61912d516ae6bf9c62cdb7e2d/i2cdevice-0.0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0939e667482267bb36f0cae434f44168", "sha256": "369f772b481786fb5783f70a280c87d55ea05ef924bbda4b25eccd05ccc84523" }, "downloads": -1, "filename": "i2cdevice-0.0.6.tar.gz", "has_sig": false, "md5_digest": "0939e667482267bb36f0cae434f44168", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7143, "upload_time": "2019-09-09T10:18:37", "url": "https://files.pythonhosted.org/packages/28/92/123dc0508b2a2049c4e7dd8865339c634cc559c4c07e5882251d268cfda6/i2cdevice-0.0.6.tar.gz" } ] }