Skip to main content

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

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)
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymcp2221-1.0.1.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

pymcp2221-1.0.1-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

Details for the file pymcp2221-1.0.1.tar.gz.

File metadata

  • Download URL: pymcp2221-1.0.1.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.63.0 importlib-metadata/4.10.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for pymcp2221-1.0.1.tar.gz
Algorithm Hash digest
SHA256 3babd7ad89566186ea8f273f737d6015ccfaf8c20e733b9473c10f7d02d08f0c
MD5 c50aa2c1ddd3a7832a3222d5ac1c802e
BLAKE2b-256 a8f318224fe47944bafca51f071a954b61642a13dd2e27f90e1f5a7840421d7e

See more details on using hashes here.

File details

Details for the file pymcp2221-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pymcp2221-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.63.0 importlib-metadata/4.10.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for pymcp2221-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 83117ff59552364a5a3f10db08e3b4a77023e8fd5c9f37329d8de9198e8c6991
MD5 43acd785acc8430cd2185cb9ca1ffd45
BLAKE2b-256 26e40daf8e063884bdf91390b92fd2158f63002389873c14258968daa7f9609d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page