Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/apds9960/apds9960/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
APDS9960_BIT_AEN = 0b00000010
APDS9960_BIT_PEN = 0b00000100
APDS9960_BIT_WEN = 0b00001000
APSD9960_BIT_AIEN = 0b00010000
APDS9960_BIT_AIEN = 0b00010000
Comment thread
nedseb marked this conversation as resolved.
APDS9960_BIT_PIEN = 0b00100000
APDS9960_BIT_GEN = 0b01000000
APDS9960_BIT_GVALID = 0b00000001
Expand Down
4 changes: 2 additions & 2 deletions lib/apds9960/apds9960/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(self, bus, address=APDS9960_I2C_ADDR, valid_id=APDS9960_DEV_ID):
# check device id
self.dev_id = self._read_byte_data(APDS9960_REG_ID)
if self.dev_id not in valid_id:
raise ADPS9960InvalidDevId(self.dev_id, valid_id)
raise APDS9960InvalidDevId(self.dev_id, valid_id)

# disable all features
self.setMode(APDS9960_MODE_ALL, False)
Expand Down Expand Up @@ -87,7 +87,7 @@ def setMode(self, mode, enable=True):
reg_val = self.getMode()

if mode < 0 or mode > APDS9960_MODE_ALL:
raise ADPS9960InvalidMode(mode)
raise APDS9960InvalidMode(mode)

# change bit(s) in ENABLE register */
if mode == APDS9960_MODE_ALL:
Expand Down
6 changes: 3 additions & 3 deletions lib/apds9960/apds9960/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class ADPS9960InvalidDevId(ValueError):
class APDS9960InvalidDevId(ValueError):
def __init__(self, id, valid_ids):
Exception.__init__(
self,
"Device id 0x{} is not a valied one (valid: {})!".format(
"Device id 0x{} is not a valid one (valid: {})!".format(
Comment thread
nedseb marked this conversation as resolved.
format(id, "02x"),
", ".join(["0x{}".format(format(i, "02x")) for i in valid_ids]),
),
)


class ADPS9960InvalidMode(ValueError):
class APDS9960InvalidMode(ValueError):
def __init__(self, mode):
Exception.__init__(self, "Feature mode {} is invalid!".format(mode))
Comment thread
nedseb marked this conversation as resolved.
Loading