Skip to content

Commit

Permalink
VID,PID BugFix.
Browse files Browse the repository at this point in the history
  • Loading branch information
nonNoise committed Aug 15, 2019
1 parent ddf2927 commit ad417a4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions PyMCP2221A/PyMCP2221A.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) 2017 Yuta KItagami #
#############################################################

from hidapi import hid
import hid
#import hid
# pip install hidapi
# https://github.com/trezor/cython-hidapi
Expand All @@ -13,7 +13,7 @@
class PyMCP2221A:
def __init__(self,VID = 0x04D8,PID = 0x00DD,devnum = 0):
self.mcp2221a = hid.device()
self.mcp2221a.open_path(hid.enumerate(0x04D8, 0x00DD)[devnum]["path"])
self.mcp2221a.open_path(hid.enumerate(VID, PID)[devnum]["path"])
self.CLKDUTY_0 = 0x00
self.CLKDUTY_25 = 0x08
self.CLKDUTY_50 = 0x10
Expand Down
4 changes: 3 additions & 1 deletion PyMCP2221A/SMBus.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ def read_i2c_block_data(self, addrs,cmd,size):
return self.mcp2221.I2C_Read_Repeated(addrs,size)
def write_i2c_block_data(self, addrs,cmd,vals):
self.mcp2221.I2C_Write(addrs,[cmd,vals])

def reset(self):
self.mcp2221.Reset()

4 changes: 2 additions & 2 deletions example/PyMCP2221A/PyMCP2221A.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (c) 2017 Yuta KItagami #
#############################################################

from hidapi import hid
import hid
#import hid
# pip install hidapi
# https://github.com/trezor/cython-hidapi
Expand All @@ -13,7 +13,7 @@
class PyMCP2221A:
def __init__(self,VID = 0x04D8,PID = 0x00DD,devnum = 0):
self.mcp2221a = hid.device()
self.mcp2221a.open_path(hid.enumerate(0x04D8, 0x00DD)[devnum]["path"])
self.mcp2221a.open_path(hid.enumerate(VID, PID)[devnum]["path"])
self.CLKDUTY_0 = 0x00
self.CLKDUTY_25 = 0x08
self.CLKDUTY_50 = 0x10
Expand Down
4 changes: 3 additions & 1 deletion example/PyMCP2221A/SMBus.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ def read_i2c_block_data(self, addrs,cmd,size):
return self.mcp2221.I2C_Read_Repeated(addrs,size)
def write_i2c_block_data(self, addrs,cmd,vals):
self.mcp2221.I2C_Write(addrs,[cmd,vals])

def reset(self):
self.mcp2221.Reset()

0 comments on commit ad417a4

Please sign in to comment.