Skip to content

Commit 1a86e3c

Browse files
committed
added Iterable and other changes per review comments
1 parent 4b2ec3f commit 1a86e3c

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

adafruit_lps2x.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,10 @@ class LPS2X: # pylint: disable=too-many-instance-attributes
149149
_raw_pressure = ROBits(24, _LPS2X_PRESS_OUT_XL, 0, 3)
150150

151151
def __init__(
152-
self,
153-
i2c_bus: I2C,
154-
address: int = _LPS2X_DEFAULT_ADDRESS,
155-
chip_id: Optional[int] = None,
152+
self, i2c_bus: I2C, address: int = _LPS2X_DEFAULT_ADDRESS, chip_id: int = -1
156153
) -> None:
154+
if chip_id == -1:
155+
raise ValueError("Must set the chip_id argument")
157156
self.i2c_device = i2cdevice.I2CDevice(i2c_bus, address)
158157
if not self._chip_id in [chip_id]:
159158
raise RuntimeError(
@@ -223,9 +222,7 @@ class LPS25(LPS2X):
223222
_reset = RWBit(_LPS25_CTRL_REG2, 2)
224223
_data_rate = RWBits(3, _LPS25_CTRL_REG1, 4)
225224

226-
def __init__(
227-
self, i2c_bus: I2C, address: Literal[0x5C, 0x5D] = _LPS2X_DEFAULT_ADDRESS
228-
) -> None:
225+
def __init__(self, i2c_bus: I2C, address: int = _LPS2X_DEFAULT_ADDRESS) -> None:
229226

230227
Rate.add_values(
231228
(

0 commit comments

Comments
 (0)