Skip to content

Commit b61fc0b

Browse files
author
caternuson
committed
changed arg order in __init__
1 parent 5a7d5f8 commit b61fc0b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adafruit_tsl2561.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@
4949
class TSL2561():
5050
"""Class which provides interface to TSL2561 light sensor."""
5151

52-
def __init__(self, address=TSL2561_DEFAULT_ADDRESS, i2c=None, **kwargs):
52+
def __init__(self, i2c=None, address=TSL2561_DEFAULT_ADDRESS, **kwargs):
5353
self.buf = bytearray(3)
5454
if i2c is None:
5555
import board
5656
import busio
5757
i2c = busio.I2C(board.SCL, board.SDA)
5858
self.i2c_device = I2CDevice(i2c, address)
59+
self.enabled = True
5960

6061
@property
6162
def id(self):
@@ -68,7 +69,7 @@ def id(self):
6869
@property
6970
def enabled(self):
7071
"""The state of the sensor."""
71-
return bool(self._read_register(TSL2561_REGISTER_CONTROL) & 0x03)
72+
return (self._read_register(TSL2561_REGISTER_CONTROL) & 0x03) != 0
7273

7374
@enabled.setter
7475
def enabled(self, enable):

0 commit comments

Comments
 (0)