Skip to content

Commit

Permalink
Minor adaptations required by latest Adafruit pyton libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
sim0nx committed Jun 25, 2016
1 parent 9414b78 commit fe74668
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------
Expand All @@ -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.


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import os

VERSION = (2, 0)
VERSION = (2, 1)
__version__ = VERSION
__versionstr__ = '.'.join(map(str, VERSION))

Expand Down
9 changes: 5 additions & 4 deletions tsl2561/tsl2561.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>'
__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)
Expand All @@ -31,15 +32,15 @@

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:
self.address = address
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
Expand Down

0 comments on commit fe74668

Please sign in to comment.