This is a library for interfacing with the HID features of the MCP2221 USB to UART and I2C/SMBus serial converter from Microchip. The converter includes 4 GPIO pins, 3x 10-bit ADCs, 1x 5-bit DAC and more.
Microchip does provide a library for interfacing with the chip, however it is supplied as proprietary DLLs. This project aims to be an open-source and multi-platform alternative.
This library also makes use of HIDAPI.
Feature | Status |
---|---|
ADC | Supported |
DAC | Supported |
GPIO | Supported |
Interrupt input | Supported |
Clock reference output | Supported |
USB Descriptors (Manufacturer, product, serial, VID, PID) | Supported |
I2C/SMB | Limited support, WIP |
Flash password protection | Not yet implemented |
C++ and C# wrappers | Not yet implemented |
Hint:
Function prefix | Description |
---|---|
mcp2221_set* | Set SRAM config, this takes immediate effect |
mcp2221_get* | Get SRAM config |
mcp2221_save* | Writes to flash, this setting is used at startup |
mcp2221_load* | Read from flash |
mcp2221_read* | Read ADC/GPIO/interrupt values |
libmcp2221.h
to your compilers include directory (/usr/include/
on Linux)./lib/win/libmcp2221.dll
to your compilers lib directory. Each program that uses libmcp2221 will need a copy of libmcp2221.dll
in the same directory../lib/unix/libmcp2221.so
and ./lib/unix/libmcp2221.a
to /usr/lib/
(these were compiled on Debian 8.4 x64 using the HIDRAW version of HIDAPI)hid.c
and hidapi.h
files into the libmcp2221 directoryapt-get install libudev-dev libusb-1.0-0-dev
make
libmcp2221.h
to your compilers include directory (/usr/include/
on Linux)libmcp2221.dll
from the bin folder to your compilers lib directory. Each program that uses libmcp2221 will need a copy of libmcp2221.dll
in the same directory.libmcp2221.so
and libmcp2221.a
from the bin folder to /usr/lib/
Third party contents are copyrighted by their respective authors.
My productions are published under GNU GPL v3 (see License.txt).
Zak Kemble
contact@zakkemble.co.uk