Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# MCP2221A libraries
Support for user space usage of the [MCP2221A][1] IC from Microchip.
## Linux
To access the USB device you must add the following rule under */etc/udev/rules.d/* (i.e in a file called mcp2221a.rules) :
```bash
SUBSYSTEM=="usb", ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="00dd", GROUP="plugdev", TAG+="uaccess"
```
You must reboot after this.
To access the I2C devices loaded by the [*mcp2221*][2] kernel driver you must add your user to the *i2c* group:
```bash
sudo usermod -aG i2c $USER
```
You must login again in order for the changes to take effect.
To access the Serial device you must add your user to the *dialout* group:
```bash
sudo usermod -aG dialout $USER
```
You must login again in order for the changes to take effect.
## Dependencies
```bash
sudo apt install -y libi2c-dev
```
## Build
Standard **CMAKE**:
```bash
mkdir build && cd build
cmake ..
make
```
## Try it out
Run the test software found in the tests folder. Expected result is:
```bash
./build/tests/test
Testing serial (115200, 1s): Success
Testing serial (9600, 1s): Success
Testing serial (9600, 0.1s): Success
Testing I2C: Success
```
## TODO
- [ ] Add python library
- [ ] Add Windows support
- [ ] Add hidapi support
[1]:http://ww1.microchip.com/downloads/en/devicedoc/20005565b.pdf
[2]:https://github.com/torvalds/linux/blob/master/drivers/hid/hid-mcp2221.c