Python driver for the Microchip MCP2221/MCP2221A USB 2.0 to I2C/UART protocol converters.
Project description
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
- 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
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
- either from the command line, use pydoc:
pydoc mcp2221
- or from within python:
import mcp2221; help(mcp2221)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pymcp2221-1.0.7.tar.gz
.
File metadata
- Download URL: pymcp2221-1.0.7.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ccbb6b1e97480014b604e691a36bb20b67e06b4d671eb68841b6403372a7cd6 |
|
MD5 | e01f8a828afc9bb2385da3709d79a770 |
|
BLAKE2b-256 | 7449affe199c269aa3002df7c0d8bbced4d20004af2f5a061c515c20015b1904 |
File details
Details for the file pymcp2221-1.0.7-py3-none-any.whl
.
File metadata
- Download URL: pymcp2221-1.0.7-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8189c4d98612d37428653c08840f63cbc9804f2cb9a228d6de29493634ec49b |
|
MD5 | b450eee1556669db1fa4159d9d3d8fac |
|
BLAKE2b-256 | 0ef1c1b63631414b9cd57e0fd0c74fd1194274036cd5d273cbd3d4792bcbaad2 |