# pymcp2221
This is a python driver for the Microchip MCP2221/MCP2221A USB 2.0 to I2C/UART protocol converters
([manufacturer's page](https://www.microchip.com/en-us/product/MCP2221A)).
First and foremost, there are python packages for the same chip available [here](https://github.com/nonNoise/PyMCP2221A) and [here](https://github.com/pilotak/python-mcp2221). If you use them and are satisfied, you probably won't find improvements in my package. If you're missing some features however, my code is meant to expose every chip feature described in the datasheet in a systematic manner, for python 3.2+.
## Implemented features
- Status/Set Parameters (0x10) - ok
- Read Flash Data (0xB0) - ok
- Write Flash Data (0xB1) - ok
- Send Flash Access Password (0xB2) - ok
- I2C Write Data (0x90) - ok
- I2C Write Data Repeated Start (0x92) - ok
- I2C Write Data No Stop (0x94) - ok
- I2C Read Data (0x91/0x40) - ok
- I2C Read Data Repeated Start (0x93/0x40) - ok
- Set GPIO Output Values (0x50) - ok
- Get GPIO Values (0x51) - ok
- Set SRAM Settings (0x60) - ok, except GPIO directions/values through SRAM (duplicate with 0x50)
- Get SRAM Settings (0x61) - ok, except GPIO directions/values through SRAM (duplicate with 0x51)
- Reset Chip (0x70) - ok
Every feature marked *ok* is implemented, but some of them, like I2C, haven't been tested in real conditions.
## Requirements
- [hidapi](https://pypi.org/project/hidapi)
## Setup
From command line, use:
```bash
python setup.py install
```
or for Linux/OSX:
```bash
sudo python setup.py install
```
On Linux, to access your devices without root privileges, you need to set specific udev rules, as explained in [hidapi documentation](https://github.com/trezor/cython-hidapi#udev-rules).
## Examples
See [examples](examples) folder.
## Tests
The [tests](tests) folder contains unit tests for most of the aspects of this package. To run them, use:
```bash
python -m unittest
```
## API
You can find docs in the [docs](docs) folder (generated from python docstrings). Alternatively, you can rely on python docstrings
1) either from the command line, use pydoc:
```bash
pydoc mcp2221
```
2) or from within python:
```python
import mcp2221; help(mcp2221)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/vpaeder/pymcp2221",
"name": "pymcp2221",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.2",
"maintainer_email": "",
"keywords": "MCP2221,MCP2221A,Microchip",
"author": "Vincent Paeder",
"author_email": "python@paeder.fi",
"download_url": "https://files.pythonhosted.org/packages/e6/f6/a7b90dd6c2de36e2f1581e8154c663dfe601fb5c1da81ba7219494bdb35f/pymcp2221-1.0.12.tar.gz",
"platform": null,
"description": "# pymcp2221\n\nThis is a python driver for the Microchip MCP2221/MCP2221A USB 2.0 to I2C/UART protocol converters\n([manufacturer's page](https://www.microchip.com/en-us/product/MCP2221A)).\n\nFirst and foremost, there are python packages for the same chip available [here](https://github.com/nonNoise/PyMCP2221A) and [here](https://github.com/pilotak/python-mcp2221). If you use them and are satisfied, you probably won't find improvements in my package. If you're missing some features however, my code is meant to expose every chip feature described in the datasheet in a systematic manner, for python 3.2+.\n\n## Implemented features\n\n- Status/Set Parameters (0x10) - ok\n- Read Flash Data (0xB0) - ok\n- Write Flash Data (0xB1) - ok\n- Send Flash Access Password (0xB2) - ok\n- I2C Write Data (0x90) - ok\n- I2C Write Data Repeated Start (0x92) - ok\n- I2C Write Data No Stop (0x94) - ok\n- I2C Read Data (0x91/0x40) - ok\n- I2C Read Data Repeated Start (0x93/0x40) - ok\n- Set GPIO Output Values (0x50) - ok\n- Get GPIO Values (0x51) - ok\n- Set SRAM Settings (0x60) - ok, except GPIO directions/values through SRAM (duplicate with 0x50)\n- Get SRAM Settings (0x61) - ok, except GPIO directions/values through SRAM (duplicate with 0x51)\n- Reset Chip (0x70) - ok\n\nEvery feature marked *ok* is implemented, but some of them, like I2C, haven't been tested in real conditions.\n\n## Requirements\n\n- [hidapi](https://pypi.org/project/hidapi)\n\n## Setup\n\nFrom command line, use:\n\n```bash\npython setup.py install\n```\n\nor for Linux/OSX:\n\n```bash\nsudo python setup.py install\n```\n\nOn Linux, to access your devices without root privileges, you need to set specific udev rules, as explained in [hidapi documentation](https://github.com/trezor/cython-hidapi#udev-rules).\n\n## Examples\n\nSee [examples](examples) folder.\n\n## Tests\n\nThe [tests](tests) folder contains unit tests for most of the aspects of this package. To run them, use:\n\n```bash\npython -m unittest\n```\n\n## API\n\nYou can find docs in the [docs](docs) folder (generated from python docstrings). Alternatively, you can rely on python docstrings\n\n1) either from the command line, use pydoc:\n\n```bash\npydoc mcp2221\n```\n\n2) or from within python:\n\n```python\nimport mcp2221; help(mcp2221)\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Python driver for the Microchip MCP2221/MCP2221A USB 2.0 to I2C/UART protocol converters.",
"version": "1.0.12",
"project_urls": {
"Bug Tracker": "https://github.com/vpaeder/pymcp2221/issues",
"Homepage": "https://github.com/vpaeder/pymcp2221"
},
"split_keywords": [
"mcp2221",
"mcp2221a",
"microchip"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a0273e020412c92cf9162533044ad01dda955acd1925b519645045fe1680ea28",
"md5": "978fa2c2a8fccd782899c2e771b5b8d2",
"sha256": "4e709b8cbc59d5ef2b4471a2a5102e52114f4bf12b4e5e8764292a7dd265177a"
},
"downloads": -1,
"filename": "pymcp2221-1.0.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "978fa2c2a8fccd782899c2e771b5b8d2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.2",
"size": 25866,
"upload_time": "2023-09-19T11:36:26",
"upload_time_iso_8601": "2023-09-19T11:36:26.841328Z",
"url": "https://files.pythonhosted.org/packages/a0/27/3e020412c92cf9162533044ad01dda955acd1925b519645045fe1680ea28/pymcp2221-1.0.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e6f6a7b90dd6c2de36e2f1581e8154c663dfe601fb5c1da81ba7219494bdb35f",
"md5": "20995ec563e405bc7657e6fefbeccd58",
"sha256": "d3366be233849fb08c2f843f0d3dc5d4b17847d1503b05716b65dad73a016fc0"
},
"downloads": -1,
"filename": "pymcp2221-1.0.12.tar.gz",
"has_sig": false,
"md5_digest": "20995ec563e405bc7657e6fefbeccd58",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.2",
"size": 23295,
"upload_time": "2023-09-19T11:36:28",
"upload_time_iso_8601": "2023-09-19T11:36:28.489601Z",
"url": "https://files.pythonhosted.org/packages/e6/f6/a7b90dd6c2de36e2f1581e8154c663dfe601fb5c1da81ba7219494bdb35f/pymcp2221-1.0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-19 11:36:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vpaeder",
"github_project": "pymcp2221",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pymcp2221"
}