Skip to content

Commit e0b2a19

Browse files
committed
Remove smbus support
Reason: No current use case.
1 parent e7839c6 commit e0b2a19

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

PSL/i2c.py

+2-23
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,13 @@ def __init__(self, device: Handler = None):
4949
self._device.get_ack()
5050
self.configure(125e3) # 125 kHz is as low as the PSLab can go.
5151

52-
53-
def configure(self, frequency: float, smbus: bool = False):
54-
"""Configure frequency and bus type.
52+
def configure(self, frequency: float):
53+
"""Configure bus frequency.
5554
5655
Parameters
5756
----------
5857
frequency : float
5958
Frequency of SCL in Hz.
60-
smbus : bool, optional
61-
Use SMBus standard instead of I2C. False by default.
6259
"""
6360
brgval = int((1 / frequency - self._SCL_DELAY) * CLOCK_RATE - 2)
6461

@@ -73,24 +70,6 @@ def configure(self, frequency: float, smbus: bool = False):
7370
e = f"Frequency must be between {min_frequency} and {max_frequency} Hz."
7471
raise ValueError(e)
7572

76-
self._configure_smbus(smbus)
77-
78-
def _configure_smbus(self, enable: bool):
79-
"""Configure bus as SMBus instead of normal I2C.
80-
81-
In normal I2C, V_ILMAX (logic level LOW threshold) is 150 mV, and
82-
V_IHMIN (logic level HIGH threshold) is 3.5 V. The SMBus standard uses
83-
V_ILMAX = 800 mV and V_IHMIN = 2.1 V instead.
84-
"""
85-
self._device.send_byte(CP.I2C_HEADER)
86-
87-
if enable:
88-
self._device.send_byte(CP.I2C_ENABLE_SMBUS)
89-
else:
90-
self._device.send_byte(CP.I2C_DISABLE_SMBUS)
91-
92-
self._device.get_ack()
93-
9473
def _get_i2c_frequency(self, brgval: int) -> float:
9574
return 1 / ((brgval + 2) / CLOCK_RATE + self._SCL_DELAY)
9675

0 commit comments

Comments
 (0)