diff --git a/README.md b/README.md index 19d25ae..b03bcf5 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Python library for TSL2561 Requirements ------------ - python 2.7.x - - Adafruit I2C library (https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/tree/master/Adafruit_I2C) - - python smbus + - Adafruit GPIO library (https://github.com/adafruit/Adafruit_Python_GPIO) + - Adafruit PureIO library (https://github.com/adafruit/Adafruit_Python_PureIO) Example ------------ @@ -27,7 +27,7 @@ License Copyright (c) 2015 Kevin Townsend for Adafruit Industries. All rights reserved. -Copyright (c) 2015, Georges Toth +Copyright (c) 2016, Georges Toth All rights reserved. diff --git a/setup.py b/setup.py index 0cae85e..59ca9a6 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import sys import os -VERSION = (2, 0) +VERSION = (2, 1) __version__ = VERSION __versionstr__ = '.'.join(map(str, VERSION)) diff --git a/tsl2561/tsl2561.py b/tsl2561/tsl2561.py index cb3b2eb..ccf2512 100644 --- a/tsl2561/tsl2561.py +++ b/tsl2561/tsl2561.py @@ -14,15 +14,16 @@ from __future__ import absolute_import import time -from Adafruit_I2C import Adafruit_I2C +from Adafruit_GPIO import I2C from .constants import * # pylint: disable=unused-wildcard-import __author__ = 'Georges Toth ' __credits__ = ['K.Townsend (Adafruit Industries)'] __license__ = 'BSD' -__version__ = 'v2.0' +__version__ = 'v2.1' '''HISTORY +v2.1 - Minor adaptations required by latest Adafruit pyton libraries v2.0 - Rewrote driver for Adafruit_Sensor and Auto-Gain support, and added lux clipping check (returns 0 lux on sensor saturation) v1.0 - First release (previously TSL2561) @@ -31,7 +32,7 @@ class TSL2561(object): '''Driver for the TSL2561 digital luminosity (light) sensors.''' - def __init__(self, address=None, + def __init__(self, address=None, busnum=None, integration_time=TSL2561_DELAY_INTTIME_402MS, gain=TSL2561_GAIN_1X, autogain=False, debug=False): if address is not None: @@ -39,7 +40,7 @@ def __init__(self, address=None, else: self.address = TSL2561_ADDR_FLOAT - self.i2c = Adafruit_I2C(self.address) + self.i2c = I2C.get_i2c_device(self.address, busnum=busnum) self.debug = debug self.integration_time = integration_time