Skip to content

Commit ab351d7

Browse files
authored
Streamline device initialization in ch422g.py
Refactor device setting to remove redundant check.
1 parent 7d783f5 commit ab351d7

File tree

1 file changed

+2
-3
lines changed
  • api_drivers/common_api_drivers/io_expander

1 file changed

+2
-3
lines changed

api_drivers/common_api_drivers/io_expander/ch422g.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ class Pin(io_expander_framework.Pin):
3333

3434
@classmethod
3535
def set_device(cls, device):
36-
if cls._device is not None:
37-
raise ValueError('device has already been set')
38-
36+
io_expander_framework.Pin.set_device(device)
37+
3938
cls._device = device
4039

4140
cls._reg_in = i2c.I2C.Device(

0 commit comments

Comments
 (0)