Skip to content

Commit c6e5575

Browse files
Add clock frequency parameter in SMBus class
1 parent 8ceff40 commit c6e5575

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

EasyMCP2221/smbus.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ class SMBus(object):
1616
:type force: boolean
1717
:param VID: Vendor Id (default to ``0x04D8``)
1818
:param PID: Product Id (default to ``0x00DD``)
19+
:param clock: I2C clock frequency (default to ``100kHz``)
1920
"""
2021

21-
def __init__(self, bus=None, force=False, VID=0x04D8, PID=0x00DD, devnum=0):
22+
def __init__(self, bus=None, force=False, VID=0x04D8, PID=0x00DD, devnum=0, clock=100_000):
2223

2324
self.mcp = EasyMCP2221.Device(VID, PID, devnum)
25+
self.mcp.I2C_speed(clock)
2426

2527

2628
def _read_register(self, addr, register, length = 1, reg_bytes = 1, reg_byteorder = 'big'):

docs/source/history.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ V1.7.1
1212

1313
I2C:
1414
* Set I2C default speed to 100kHz. In some chips, the default speed is 500kHz and can cause trouble with some slave devices or noisy buses. You can adjust it with :func:`I2C_speed` function.
15+
* Add clock frequency parameter in SMBus class.
1516

1617
Misc:
1718
* Added function :func:`revision` to get the mayor and minor hardware and firmware revision.
1819
* Fixed test about Interrupt On Change.
20+
* Moved GUI to a separate application on its own repository.
1921

2022

2123
V1.7.0

0 commit comments

Comments
 (0)