Source code for pyupm_tsl2561

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.





from sys import version_info
if version_info >= (2, 6, 0):
    def swig_import_helper():
        from os.path import dirname
        import imp
        fp = None
        try:
            fp, pathname, description = imp.find_module('_pyupm_tsl2561', [dirname(__file__)])
        except ImportError:
            import _pyupm_tsl2561
            return _pyupm_tsl2561
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_tsl2561', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_tsl2561 = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_tsl2561
del version_info
try:
    _swig_property = property
except NameError:
    pass  # Python < 2.2 doesn't have 'property'.


def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
    if (name == "thisown"):
        return self.this.own(value)
    if (name == "this"):
        if type(value).__name__ == 'SwigPyObject':
            self.__dict__[name] = value
            return
    method = class_type.__swig_setmethods__.get(name, None)
    if method:
        return method(self, value)
    if (not static):
        if _newclass:
            object.__setattr__(self, name, value)
        else:
            self.__dict__[name] = value
    else:
        raise AttributeError("You cannot add attributes to %s" % self)


def _swig_setattr(self, class_type, name, value):
    return _swig_setattr_nondynamic(self, class_type, name, value, 0)


def _swig_getattr_nondynamic(self, class_type, name, static=1):
    if (name == "thisown"):
        return self.this.own()
    method = class_type.__swig_getmethods__.get(name, None)
    if method:
        return method(self)
    if (not static):
        return object.__getattr__(self, name)
    else:
        raise AttributeError(name)

def _swig_getattr(self, class_type, name):
    return _swig_getattr_nondynamic(self, class_type, name, 0)


def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)

try:
    _object = object
    _newclass = 1
except AttributeError:
    class _object:
        pass
    _newclass = 0



def getVersion():
    return _pyupm_tsl2561.getVersion()
getVersion = _pyupm_tsl2561.getVersion

_pyupm_tsl2561.TSL2561_Address_swigconstant(_pyupm_tsl2561)
TSL2561_Address = _pyupm_tsl2561.TSL2561_Address

_pyupm_tsl2561.INTEGRATION_TIME0_13MS_swigconstant(_pyupm_tsl2561)
INTEGRATION_TIME0_13MS = _pyupm_tsl2561.INTEGRATION_TIME0_13MS

_pyupm_tsl2561.INTEGRATION_TIME1_101MS_swigconstant(_pyupm_tsl2561)
INTEGRATION_TIME1_101MS = _pyupm_tsl2561.INTEGRATION_TIME1_101MS

_pyupm_tsl2561.INTEGRATION_TIME2_402MS_swigconstant(_pyupm_tsl2561)
INTEGRATION_TIME2_402MS = _pyupm_tsl2561.INTEGRATION_TIME2_402MS

_pyupm_tsl2561.GAIN_0X_swigconstant(_pyupm_tsl2561)
GAIN_0X = _pyupm_tsl2561.GAIN_0X

_pyupm_tsl2561.GAIN_16X_swigconstant(_pyupm_tsl2561)
GAIN_16X = _pyupm_tsl2561.GAIN_16X

_pyupm_tsl2561.CONTROL_POWERON_swigconstant(_pyupm_tsl2561)
CONTROL_POWERON = _pyupm_tsl2561.CONTROL_POWERON

_pyupm_tsl2561.CONTROL_POWEROFF_swigconstant(_pyupm_tsl2561)
CONTROL_POWEROFF = _pyupm_tsl2561.CONTROL_POWEROFF

_pyupm_tsl2561.REGISTER_Control_swigconstant(_pyupm_tsl2561)
REGISTER_Control = _pyupm_tsl2561.REGISTER_Control

_pyupm_tsl2561.REGISTER_Timing_swigconstant(_pyupm_tsl2561)
REGISTER_Timing = _pyupm_tsl2561.REGISTER_Timing

_pyupm_tsl2561.REGISTER_Interrupt_swigconstant(_pyupm_tsl2561)
REGISTER_Interrupt = _pyupm_tsl2561.REGISTER_Interrupt

_pyupm_tsl2561.REGISTER_Channal0L_swigconstant(_pyupm_tsl2561)
REGISTER_Channal0L = _pyupm_tsl2561.REGISTER_Channal0L

_pyupm_tsl2561.REGISTER_Channal0H_swigconstant(_pyupm_tsl2561)
REGISTER_Channal0H = _pyupm_tsl2561.REGISTER_Channal0H

_pyupm_tsl2561.REGISTER_Channal1L_swigconstant(_pyupm_tsl2561)
REGISTER_Channal1L = _pyupm_tsl2561.REGISTER_Channal1L

_pyupm_tsl2561.REGISTER_Channal1H_swigconstant(_pyupm_tsl2561)
REGISTER_Channal1H = _pyupm_tsl2561.REGISTER_Channal1H

_pyupm_tsl2561.LUX_SCALE_swigconstant(_pyupm_tsl2561)
LUX_SCALE = _pyupm_tsl2561.LUX_SCALE

_pyupm_tsl2561.LUX_RATIOSCALE_swigconstant(_pyupm_tsl2561)
LUX_RATIOSCALE = _pyupm_tsl2561.LUX_RATIOSCALE

_pyupm_tsl2561.LUX_CHSCALE_swigconstant(_pyupm_tsl2561)
LUX_CHSCALE = _pyupm_tsl2561.LUX_CHSCALE

_pyupm_tsl2561.LUX_CHSCALE_TINT0_swigconstant(_pyupm_tsl2561)
LUX_CHSCALE_TINT0 = _pyupm_tsl2561.LUX_CHSCALE_TINT0

_pyupm_tsl2561.LUX_CHSCALE_TINT1_swigconstant(_pyupm_tsl2561)
LUX_CHSCALE_TINT1 = _pyupm_tsl2561.LUX_CHSCALE_TINT1

_pyupm_tsl2561.LUX_K1C_swigconstant(_pyupm_tsl2561)
LUX_K1C = _pyupm_tsl2561.LUX_K1C

_pyupm_tsl2561.LUX_B1C_swigconstant(_pyupm_tsl2561)
LUX_B1C = _pyupm_tsl2561.LUX_B1C

_pyupm_tsl2561.LUX_M1C_swigconstant(_pyupm_tsl2561)
LUX_M1C = _pyupm_tsl2561.LUX_M1C

_pyupm_tsl2561.LUX_K2C_swigconstant(_pyupm_tsl2561)
LUX_K2C = _pyupm_tsl2561.LUX_K2C

_pyupm_tsl2561.LUX_B2C_swigconstant(_pyupm_tsl2561)
LUX_B2C = _pyupm_tsl2561.LUX_B2C

_pyupm_tsl2561.LUX_M2C_swigconstant(_pyupm_tsl2561)
LUX_M2C = _pyupm_tsl2561.LUX_M2C

_pyupm_tsl2561.LUX_K3C_swigconstant(_pyupm_tsl2561)
LUX_K3C = _pyupm_tsl2561.LUX_K3C

_pyupm_tsl2561.LUX_B3C_swigconstant(_pyupm_tsl2561)
LUX_B3C = _pyupm_tsl2561.LUX_B3C

_pyupm_tsl2561.LUX_M3C_swigconstant(_pyupm_tsl2561)
LUX_M3C = _pyupm_tsl2561.LUX_M3C

_pyupm_tsl2561.LUX_K4C_swigconstant(_pyupm_tsl2561)
LUX_K4C = _pyupm_tsl2561.LUX_K4C

_pyupm_tsl2561.LUX_B4C_swigconstant(_pyupm_tsl2561)
LUX_B4C = _pyupm_tsl2561.LUX_B4C

_pyupm_tsl2561.LUX_M4C_swigconstant(_pyupm_tsl2561)
LUX_M4C = _pyupm_tsl2561.LUX_M4C

_pyupm_tsl2561.LUX_K5C_swigconstant(_pyupm_tsl2561)
LUX_K5C = _pyupm_tsl2561.LUX_K5C

_pyupm_tsl2561.LUX_B5C_swigconstant(_pyupm_tsl2561)
LUX_B5C = _pyupm_tsl2561.LUX_B5C

_pyupm_tsl2561.LUX_M5C_swigconstant(_pyupm_tsl2561)
LUX_M5C = _pyupm_tsl2561.LUX_M5C

_pyupm_tsl2561.LUX_K6C_swigconstant(_pyupm_tsl2561)
LUX_K6C = _pyupm_tsl2561.LUX_K6C

_pyupm_tsl2561.LUX_B6C_swigconstant(_pyupm_tsl2561)
LUX_B6C = _pyupm_tsl2561.LUX_B6C

_pyupm_tsl2561.LUX_M6C_swigconstant(_pyupm_tsl2561)
LUX_M6C = _pyupm_tsl2561.LUX_M6C

_pyupm_tsl2561.LUX_K7C_swigconstant(_pyupm_tsl2561)
LUX_K7C = _pyupm_tsl2561.LUX_K7C

_pyupm_tsl2561.LUX_B7C_swigconstant(_pyupm_tsl2561)
LUX_B7C = _pyupm_tsl2561.LUX_B7C

_pyupm_tsl2561.LUX_M7C_swigconstant(_pyupm_tsl2561)
LUX_M7C = _pyupm_tsl2561.LUX_M7C

_pyupm_tsl2561.LUX_K8C_swigconstant(_pyupm_tsl2561)
LUX_K8C = _pyupm_tsl2561.LUX_K8C

_pyupm_tsl2561.LUX_B8C_swigconstant(_pyupm_tsl2561)
LUX_B8C = _pyupm_tsl2561.LUX_B8C

_pyupm_tsl2561.LUX_M8C_swigconstant(_pyupm_tsl2561)
LUX_M8C = _pyupm_tsl2561.LUX_M8C
[docs]class TSL2561(_object): """ API for the TSL2561 Digital Light Sensor. ID: tsl2561 Name: Digital Light Sensor Other Names: Grove Digital Light Sensor Category: light Manufacturer: seeed Link:http://www.seeedstudio.com/wiki/Grove_-_Digital_Light_Sensor Connection: i2c Kit: eak TSL2560 and TSL2561 are light-to-digital converters that transform light intensity to a digital signal output capable of a direct I2C ( TSL2561) interface C++ includes: tsl2561.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, TSL2561, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, TSL2561, name) __repr__ = _swig_repr def __init__(self, *args): """ TSL2561(int bus=0, uint8_t devAddr=TSL2561_Address, uint8_t gain=GAIN_0X, uint8_t integrationTime=INTEGRATION_TIME1_101MS) Instantiates a TSL2561 object Parameters: ----------- bus: Number of the used bus devAddr: Address of the used I2C device gain: Correct gain to use integrationTime: Time to keep the shutter open """ this = _pyupm_tsl2561.new_TSL2561(*args) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_tsl2561.delete_TSL2561 __del__ = lambda self: None
[docs] def getLux(self): """ int getLux() Gets the calculated lux reading from TSL2561 Calculated lux value from the sensor """ return _pyupm_tsl2561.TSL2561_getLux(self)
TSL2561_swigregister = _pyupm_tsl2561.TSL2561_swigregister TSL2561_swigregister(TSL2561) # This file is compatible with both classic and new-style classes.