vpaeder / pymcp2221

A python driver for the Microchip MCP2221/MCP2221A USB 2.0 to I2C/UART protocol converters
https://pypi.org/project/pymcp2221
MIT License
5 stars 2 forks source link
hid microchip python

pymcp2221

This is a python driver for the Microchip MCP2221/MCP2221A USB 2.0 to I2C/UART protocol converters (manufacturer's page).

First and foremost, there are python packages for the same chip available here and here. 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

Every feature marked ok is implemented, but some of them, like I2C, haven't been tested in real conditions.

Requirements

Setup

From command line, use:

python setup.py install

or for Linux/OSX:

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.

Examples

See examples folder.

Tests

The tests folder contains unit tests for most of the aspects of this package. To run them, use:

python -m unittest

API

You can find docs in the docs folder (generated from python docstrings). Alternatively, you can rely on python docstrings

1) either from the command line, use pydoc:

pydoc mcp2221

2) or from within python:

import mcp2221; help(mcp2221)