{
"info": {
"author": "Karl-Petter Lindegaard",
"author_email": "kp.lindegaard@gmail.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Utilities"
],
"description": "smbus2\n======\nA drop-in replacement for smbus-cffi/smbus-python in pure Python\n\n|travis| |rtfd|\n\n.. |travis| image:: https://travis-ci.org/kplindegaard/smbus2.svg?branch=master\n :target: https://travis-ci.org/kplindegaard/smbus2\n\n.. |rtfd| image:: https://readthedocs.org/projects/smbus2/badge/?version=latest\n :target: http://smbus2.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/dm/smbus2?label=PyPI%20Downloads\n\nIntroduction\n============\n\nsmbus2 is (yet another) pure Python implementation of the `python-smbus `_ package.\n\nIt was designed from the ground up with two goals in mind:\n\n1. It should be a drop-in replacement of smbus. The syntax shall be the same.\n2. Use the inherent i2c structs and unions to a greater extent than other pure Python implementations like `pysmbus `_ does. By doing so, it will be more feature complete and easier to extend.\n\nCurrently supported features are:\n\n* Get i2c capabilities (I2C_FUNCS)\n* read_byte\n* write_byte\n* read_byte_data\n* write_byte_data\n* read_word_data\n* write_word_data\n* read_i2c_block_data\n* write_i2c_block_data\n* write_quick\n* process_call\n* read_block_data\n* write_block_data\n* block_process_call\n* i2c_rdwr - *combined write/read transactions with repeated start*\n\nIt is developed on Python 2.7 but works without any modifications in Python 3.X too.\n\nSMBus code examples\n===================\n\nsmbus2 installs next to smbus as the package, so it's not really a 100% replacement. You must change the module name.\n\nExample 1a: Read a byte\n-----------------------\n\n.. code:: python\n\n from smbus2 import SMBus\n\n # Open i2c bus 1 and read one byte from address 80, offset 0\n bus = SMBus(1)\n b = bus.read_byte_data(80, 0)\n print(b)\n bus.close()\n\nExample 1b: Read a byte using 'with'\n------------------------------------\n\nThis is the very same example but safer to use since the smbus will be closed automatically when exiting the with block.\n\n.. code:: python\n\n from smbus2 import SMBus\n\n with SMBus(1) as bus:\n b = bus.read_byte_data(80, 0)\n print(b)\n\nExample 2: Read a block of data\n-------------------------------\n\nYou can read up to 32 bytes at once.\n\n.. code:: python\n\n from smbus2 import SMBus\n\n with SMBus(1) as bus:\n # Read a block of 16 bytes from address 80, offset 0\n block = bus.read_i2c_block_data(80, 0, 16)\n # Returned value is a list of 16 bytes\n print(block)\n\nExample 3: Write a byte\n-----------------------\n\n.. code:: python\n\n from smbus2 import SMBus\n\n with SMBus(1) as bus:\n # Write a byte to address 80, offset 0\n data = 45\n bus.write_byte_data(80, 0, data)\n\nExample 4: Write a block of data\n--------------------------------\n\nIt is possible to write 32 bytes at the time, but I have found that error-prone. Write less and add a delay in between if you run into trouble.\n\n.. code:: python\n\n from smbus2 import SMBus\n\n with SMBus(1) as bus:\n # Write a block of 8 bytes to address 80 from offset 0\n data = [1, 2, 3, 4, 5, 6, 7, 8]\n bus.write_i2c_block_data(80, 0, data)\n\n\nI2C\n===\n\nStarting with v0.2, the smbus2 library also has support for combined read and write transactions. *i2c_rdwr* is not really a SMBus feature but comes in handy when the master needs to:\n\n1. read or write bulks of data larger than SMBus' 32 bytes limit.\n\n2. write some data and then read from the slave with a repeated start and no stop bit between.\n\nEach operation is represented by a *i2c_msg* message object.\n\n\nExample 5: Single i2c_rdwr\n--------------------------\n\n.. code:: python\n\n from smbus2 import SMBus, ic_msg\n\n with SMBus(1) as bus:\n # Read 64 bytes from address 80\n msg = i2c_msg.read(80, 64)\n bus.i2c_rdwr(msg)\n\n # Write some bytes to address 80\n msg = i2c_msg.write(80, [65, 66, 67, 68])\n bus.i2c_rdwr(msg)\n\n\nExample 6: Dual i2c_rdwr\n------------------------\n\nTo perform dual operations just add more i2c_msg instances to the bus call:\n\n.. code:: python\n\n from smbus2 import SMBus, ic_msg\n\n # Single transaction writing two bytes then read two at address 80\n write = i2c_msg.write(80, [40, 50])\n read = i2c_msg.read(80, 2)\n with SMBus(1) as bus:\n bus.i2c_rdwr(write, read)\n\n\nExample 7: Access i2c_msg data\n------------------------------\n\nAll data is contained in the i2c_msg instances. Here are some data access alternatives.\n\n.. code:: python\n\n # 1: Convert message content to list\n msg = i2c_msg.write(60, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])\n data = list(msg) # data = [1, 2, 3, ...]\n print(len(data)) # => 10\n\n # 2: i2c_msg is iterable\n for value in msg:\n print(value)\n\n # 3: Through i2c_msg properties\n for k in range(msg.len):\n print(msg.buf[k])\n\n\nInstallation instructions\n=========================\n\nsmbus2 is pure Python code and requires no compilation. Installation is easy:\n\n.. code:: bash\n\n python setup.py install\n\nOr just use pip\n\n.. code:: bash\n\n pip install smbus2",
"description_content_type": "",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/kplindegaard/smbus2",
"keywords": "smbus,smbus2,python,i2c,raspberrypi,linux",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "smbus2",
"package_url": "https://pypi.org/project/smbus2/",
"platform": "",
"project_url": "https://pypi.org/project/smbus2/",
"project_urls": {
"Homepage": "https://github.com/kplindegaard/smbus2"
},
"release_url": "https://pypi.org/project/smbus2/0.3.0/",
"requires_dist": null,
"requires_python": "",
"summary": "smbus2 is a drop-in replacement for smbus-cffi/smbus-python in pure Python",
"version": "0.3.0"
},
"last_serial": 5795758,
"releases": {
"0.1.0": [
{
"comment_text": "",
"digests": {
"md5": "261cefa6723f14dc1874156316a871a1",
"sha256": "a1ef70581a6a68f74791ae283b5888b280f8130ceff1f0d5b93fbba3f8ac7e49"
},
"downloads": -1,
"filename": "smbus2-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "261cefa6723f14dc1874156316a871a1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4801,
"upload_time": "2016-04-04T01:53:42",
"url": "https://files.pythonhosted.org/packages/26/d0/516ddf1898ec1fe4d3206061fef3f0c06abd1f8449e0401b82cd7c874b08/smbus2-0.1.0.tar.gz"
}
],
"0.1.1": [],
"0.1.2": [
{
"comment_text": "",
"digests": {
"md5": "57664d522adc74a902e887c531a10704",
"sha256": "7fc2852dbb0eee939d3733034b20a0975f338056c9a3e5ed25533616f5dad9c1"
},
"downloads": -1,
"filename": "smbus2-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "57664d522adc74a902e887c531a10704",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4920,
"upload_time": "2016-04-19T18:21:21",
"url": "https://files.pythonhosted.org/packages/2c/a3/6260cc8b4555df959b5cc3c1bc2369af7b88a415e31ca4e13451c4b9d431/smbus2-0.1.2.tar.gz"
}
],
"0.1.3": [
{
"comment_text": "",
"digests": {
"md5": "e122148cbb101a068723525ec4e28c59",
"sha256": "bd88307c2fcc096a08d1ea039cc2fa0b020539d8cc5e7ca9899e6cbaabcce00f"
},
"downloads": -1,
"filename": "smbus2-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "e122148cbb101a068723525ec4e28c59",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5402,
"upload_time": "2016-08-14T12:16:52",
"url": "https://files.pythonhosted.org/packages/7a/f0/5ba99ca403638d227eb92948f4acf54eba741e4bbd5b4494e441e39ae1d3/smbus2-0.1.3.tar.gz"
}
],
"0.1.4": [
{
"comment_text": "",
"digests": {
"md5": "bce588244758e6479d522dd691ce856e",
"sha256": "3a5f1e08f2ad1086ca59c624c0558234083d88765e0a6ad3f9268f4f920963af"
},
"downloads": -1,
"filename": "smbus2-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "bce588244758e6479d522dd691ce856e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5450,
"upload_time": "2016-09-18T10:34:54",
"url": "https://files.pythonhosted.org/packages/43/09/63415f94e75e92488d5b9bc6392e41aacb4089623770ade96350f027bd7e/smbus2-0.1.4.tar.gz"
}
],
"0.1.5": [
{
"comment_text": "",
"digests": {
"md5": "509f68ff20f636502c20b052b84bedee",
"sha256": "2b1dbed61bb9e8714b0f1207826e463920aa305474969a80671ecda216863494"
},
"downloads": -1,
"filename": "smbus2-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "509f68ff20f636502c20b052b84bedee",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5522,
"upload_time": "2017-05-12T21:24:51",
"url": "https://files.pythonhosted.org/packages/df/ab/17f0a6a6b3ede9d9938d657ff25341c58c139d8547b83bcad70dc6c7f116/smbus2-0.1.5.tar.gz"
}
],
"0.2.0": [
{
"comment_text": "",
"digests": {
"md5": "40aef6c14627be3eab15ce0fe51d5d0f",
"sha256": "f0b17997e5a0886ca0d5b0d91d0452de68c282f31bdda8aaae1ca80d1531b2f0"
},
"downloads": -1,
"filename": "smbus2-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "40aef6c14627be3eab15ce0fe51d5d0f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7715,
"upload_time": "2017-08-19T19:54:48",
"url": "https://files.pythonhosted.org/packages/97/00/47ed0ae68da93e1186fd45dbed1102469eef490dc20871ab537b69b8bcb7/smbus2-0.2.0.tar.gz"
}
],
"0.2.1": [
{
"comment_text": "",
"digests": {
"md5": "de1f6a4eb5aaef90ae30fb9d3cab5145",
"sha256": "b8d943ffe74670be969b5be79f47df0f597e91e8e0df2bc0d57203b1c2cabf2b"
},
"downloads": -1,
"filename": "smbus2-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "de1f6a4eb5aaef90ae30fb9d3cab5145",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8517,
"upload_time": "2018-06-02T16:21:29",
"url": "https://files.pythonhosted.org/packages/c6/be/6eab4b27693ec2c87f7ff864dfca86c58fbfd1627acbe191dd2f18e0ac3e/smbus2-0.2.1.tar.gz"
}
],
"0.2.2": [
{
"comment_text": "",
"digests": {
"md5": "c4c323b5774998116fc64f0cc9c49a30",
"sha256": "7ada41a2aaec9bf1795b0b8ef0b72c71dcb20e750c909a9ed669cb2cdef7f9f0"
},
"downloads": -1,
"filename": "smbus2-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "c4c323b5774998116fc64f0cc9c49a30",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8678,
"upload_time": "2019-01-03T03:58:52",
"url": "https://files.pythonhosted.org/packages/58/4e/816148dc435d9c46616e972c4b4211b8e133f641ed2551fafd1c5a29de9f/smbus2-0.2.2.tar.gz"
}
],
"0.2.3": [
{
"comment_text": "",
"digests": {
"md5": "9f6cc4ba3fbcf75797bc7c4040d0c27b",
"sha256": "4d5aae2f65d39056bb44e8906d5c503f8ee7e02fadb0a6433f1091a9ce528dde"
},
"downloads": -1,
"filename": "smbus2-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "9f6cc4ba3fbcf75797bc7c4040d0c27b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8690,
"upload_time": "2019-01-13T12:24:19",
"url": "https://files.pythonhosted.org/packages/20/21/fd4e359bd130c09a728c8549fccabf3be70ea08ca7c7c6b5822faf97dcf3/smbus2-0.2.3.tar.gz"
}
],
"0.3.0": [
{
"comment_text": "",
"digests": {
"md5": "d5ed5acc889b4770a84cc932853ed20a",
"sha256": "210e66eebe4d0b1fe836b3ec2751841942e1c4918c0b429b20a0e20a222228b4"
},
"downloads": -1,
"filename": "smbus2-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "d5ed5acc889b4770a84cc932853ed20a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10693,
"upload_time": "2019-09-07T11:19:51",
"url": "https://files.pythonhosted.org/packages/6a/06/80a6928e5cbfd40c77c08e06ae9975c2a50109586ce66435bd8166ce6bb3/smbus2-0.3.0.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d5ed5acc889b4770a84cc932853ed20a",
"sha256": "210e66eebe4d0b1fe836b3ec2751841942e1c4918c0b429b20a0e20a222228b4"
},
"downloads": -1,
"filename": "smbus2-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "d5ed5acc889b4770a84cc932853ed20a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10693,
"upload_time": "2019-09-07T11:19:51",
"url": "https://files.pythonhosted.org/packages/6a/06/80a6928e5cbfd40c77c08e06ae9975c2a50109586ce66435bd8166ce6bb3/smbus2-0.3.0.tar.gz"
}
]
}