Source code for pyupm_tcs37727

# 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_tcs37727', [dirname(__file__)])
        except ImportError:
            import _pyupm_tcs37727
            return _pyupm_tcs37727
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_tcs37727', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_tcs37727 = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_tcs37727
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_tcs37727.getVersion()
getVersion = _pyupm_tcs37727.getVersion

_pyupm_tcs37727.TCS37727_NAME_swigconstant(_pyupm_tcs37727)
TCS37727_NAME = _pyupm_tcs37727.TCS37727_NAME

_pyupm_tcs37727.TCS37727_I2C_ADDRESS_swigconstant(_pyupm_tcs37727)
TCS37727_I2C_ADDRESS = _pyupm_tcs37727.TCS37727_I2C_ADDRESS

_pyupm_tcs37727.TCS37727_DEVICE_ID_swigconstant(_pyupm_tcs37727)
TCS37727_DEVICE_ID = _pyupm_tcs37727.TCS37727_DEVICE_ID

_pyupm_tcs37727.TCS37727_DEVICE_ID_REG_swigconstant(_pyupm_tcs37727)
TCS37727_DEVICE_ID_REG = _pyupm_tcs37727.TCS37727_DEVICE_ID_REG

_pyupm_tcs37727.TCS37727_ATIME_DEFAULT_swigconstant(_pyupm_tcs37727)
TCS37727_ATIME_DEFAULT = _pyupm_tcs37727.TCS37727_ATIME_DEFAULT

_pyupm_tcs37727.TCS37727_AG_THRESHOLD_LOW_swigconstant(_pyupm_tcs37727)
TCS37727_AG_THRESHOLD_LOW = _pyupm_tcs37727.TCS37727_AG_THRESHOLD_LOW

_pyupm_tcs37727.TCS37727_AG_THRESHOLD_HIGH_swigconstant(_pyupm_tcs37727)
TCS37727_AG_THRESHOLD_HIGH = _pyupm_tcs37727.TCS37727_AG_THRESHOLD_HIGH

_pyupm_tcs37727.TCS37727_ENABLE_swigconstant(_pyupm_tcs37727)
TCS37727_ENABLE = _pyupm_tcs37727.TCS37727_ENABLE

_pyupm_tcs37727.TCS37727_ATIME_swigconstant(_pyupm_tcs37727)
TCS37727_ATIME = _pyupm_tcs37727.TCS37727_ATIME

_pyupm_tcs37727.TCS37727_PTIME_swigconstant(_pyupm_tcs37727)
TCS37727_PTIME = _pyupm_tcs37727.TCS37727_PTIME

_pyupm_tcs37727.TCS37727_WTIME_swigconstant(_pyupm_tcs37727)
TCS37727_WTIME = _pyupm_tcs37727.TCS37727_WTIME

_pyupm_tcs37727.TCS37727_AILTL_swigconstant(_pyupm_tcs37727)
TCS37727_AILTL = _pyupm_tcs37727.TCS37727_AILTL

_pyupm_tcs37727.TCS37727_AILTH_swigconstant(_pyupm_tcs37727)
TCS37727_AILTH = _pyupm_tcs37727.TCS37727_AILTH

_pyupm_tcs37727.TCS37727_AIHTL_swigconstant(_pyupm_tcs37727)
TCS37727_AIHTL = _pyupm_tcs37727.TCS37727_AIHTL

_pyupm_tcs37727.TCS37727_AIHTH_swigconstant(_pyupm_tcs37727)
TCS37727_AIHTH = _pyupm_tcs37727.TCS37727_AIHTH

_pyupm_tcs37727.TCS37727_PILTL_swigconstant(_pyupm_tcs37727)
TCS37727_PILTL = _pyupm_tcs37727.TCS37727_PILTL

_pyupm_tcs37727.TCS37727_PILTH_swigconstant(_pyupm_tcs37727)
TCS37727_PILTH = _pyupm_tcs37727.TCS37727_PILTH

_pyupm_tcs37727.TCS37727_PIHTL_swigconstant(_pyupm_tcs37727)
TCS37727_PIHTL = _pyupm_tcs37727.TCS37727_PIHTL

_pyupm_tcs37727.TCS37727_PIHTH_swigconstant(_pyupm_tcs37727)
TCS37727_PIHTH = _pyupm_tcs37727.TCS37727_PIHTH

_pyupm_tcs37727.TCS37727_PERS_swigconstant(_pyupm_tcs37727)
TCS37727_PERS = _pyupm_tcs37727.TCS37727_PERS

_pyupm_tcs37727.TCS37727_CONFIG_swigconstant(_pyupm_tcs37727)
TCS37727_CONFIG = _pyupm_tcs37727.TCS37727_CONFIG

_pyupm_tcs37727.TCS37727_PPULSE_swigconstant(_pyupm_tcs37727)
TCS37727_PPULSE = _pyupm_tcs37727.TCS37727_PPULSE

_pyupm_tcs37727.TCS37727_CONTROL_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL = _pyupm_tcs37727.TCS37727_CONTROL

_pyupm_tcs37727.TCS37727_STATUS_swigconstant(_pyupm_tcs37727)
TCS37727_STATUS = _pyupm_tcs37727.TCS37727_STATUS

_pyupm_tcs37727.TCS37727_CDATA_swigconstant(_pyupm_tcs37727)
TCS37727_CDATA = _pyupm_tcs37727.TCS37727_CDATA

_pyupm_tcs37727.TCS37727_CDATAH_swigconstant(_pyupm_tcs37727)
TCS37727_CDATAH = _pyupm_tcs37727.TCS37727_CDATAH

_pyupm_tcs37727.TCS37727_RDATA_swigconstant(_pyupm_tcs37727)
TCS37727_RDATA = _pyupm_tcs37727.TCS37727_RDATA

_pyupm_tcs37727.TCS37727_RDATAH_swigconstant(_pyupm_tcs37727)
TCS37727_RDATAH = _pyupm_tcs37727.TCS37727_RDATAH

_pyupm_tcs37727.TCS37727_GDATA_swigconstant(_pyupm_tcs37727)
TCS37727_GDATA = _pyupm_tcs37727.TCS37727_GDATA

_pyupm_tcs37727.TCS37727_GDATAH_swigconstant(_pyupm_tcs37727)
TCS37727_GDATAH = _pyupm_tcs37727.TCS37727_GDATAH

_pyupm_tcs37727.TCS37727_BDATA_swigconstant(_pyupm_tcs37727)
TCS37727_BDATA = _pyupm_tcs37727.TCS37727_BDATA

_pyupm_tcs37727.TCS37727_BDATAH_swigconstant(_pyupm_tcs37727)
TCS37727_BDATAH = _pyupm_tcs37727.TCS37727_BDATAH

_pyupm_tcs37727.TCS37727_PDATA_swigconstant(_pyupm_tcs37727)
TCS37727_PDATA = _pyupm_tcs37727.TCS37727_PDATA

_pyupm_tcs37727.TCS37727_PDATAH_swigconstant(_pyupm_tcs37727)
TCS37727_PDATAH = _pyupm_tcs37727.TCS37727_PDATAH

_pyupm_tcs37727.TCS37727_BYTE_TRANS_swigconstant(_pyupm_tcs37727)
TCS37727_BYTE_TRANS = _pyupm_tcs37727.TCS37727_BYTE_TRANS

_pyupm_tcs37727.TCS37727_INC_TRANS_swigconstant(_pyupm_tcs37727)
TCS37727_INC_TRANS = _pyupm_tcs37727.TCS37727_INC_TRANS

_pyupm_tcs37727.TCS37727_SF_PICLR_swigconstant(_pyupm_tcs37727)
TCS37727_SF_PICLR = _pyupm_tcs37727.TCS37727_SF_PICLR

_pyupm_tcs37727.TCS37727_SF_CICLR_swigconstant(_pyupm_tcs37727)
TCS37727_SF_CICLR = _pyupm_tcs37727.TCS37727_SF_CICLR

_pyupm_tcs37727.TCS37727_SF_PCICLR_swigconstant(_pyupm_tcs37727)
TCS37727_SF_PCICLR = _pyupm_tcs37727.TCS37727_SF_PCICLR

_pyupm_tcs37727.TCS37727_ENABLE_PIEN_swigconstant(_pyupm_tcs37727)
TCS37727_ENABLE_PIEN = _pyupm_tcs37727.TCS37727_ENABLE_PIEN

_pyupm_tcs37727.TCS37727_ENABLE_AIEN_swigconstant(_pyupm_tcs37727)
TCS37727_ENABLE_AIEN = _pyupm_tcs37727.TCS37727_ENABLE_AIEN

_pyupm_tcs37727.TCS37727_ENABLE_WEN_swigconstant(_pyupm_tcs37727)
TCS37727_ENABLE_WEN = _pyupm_tcs37727.TCS37727_ENABLE_WEN

_pyupm_tcs37727.TCS37727_ENABLE_PEN_swigconstant(_pyupm_tcs37727)
TCS37727_ENABLE_PEN = _pyupm_tcs37727.TCS37727_ENABLE_PEN

_pyupm_tcs37727.TCS37727_ENABLE_AEN_swigconstant(_pyupm_tcs37727)
TCS37727_ENABLE_AEN = _pyupm_tcs37727.TCS37727_ENABLE_AEN

_pyupm_tcs37727.TCS37727_ENABLE_PON_swigconstant(_pyupm_tcs37727)
TCS37727_ENABLE_PON = _pyupm_tcs37727.TCS37727_ENABLE_PON

_pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_100_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_PDRIVE_100 = _pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_100

_pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_50_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_PDRIVE_50 = _pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_50

_pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_25_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_PDRIVE_25 = _pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_25

_pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_12_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_PDRIVE_12 = _pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_12

_pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_MASK_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_PDRIVE_MASK = _pyupm_tcs37727.TCS37727_CONTROL_PDRIVE_MASK

_pyupm_tcs37727.TCS37727_CONTROL_AGAIN_1_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_AGAIN_1 = _pyupm_tcs37727.TCS37727_CONTROL_AGAIN_1

_pyupm_tcs37727.TCS37727_CONTROL_AGAIN_4_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_AGAIN_4 = _pyupm_tcs37727.TCS37727_CONTROL_AGAIN_4

_pyupm_tcs37727.TCS37727_CONTROL_AGAIN_16_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_AGAIN_16 = _pyupm_tcs37727.TCS37727_CONTROL_AGAIN_16

_pyupm_tcs37727.TCS37727_CONTROL_AGAIN_60_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_AGAIN_60 = _pyupm_tcs37727.TCS37727_CONTROL_AGAIN_60

_pyupm_tcs37727.TCS37727_CONTROL_AGAIN_MASK_swigconstant(_pyupm_tcs37727)
TCS37727_CONTROL_AGAIN_MASK = _pyupm_tcs37727.TCS37727_CONTROL_AGAIN_MASK

_pyupm_tcs37727.TCS37727_ATIME_MIN_swigconstant(_pyupm_tcs37727)
TCS37727_ATIME_MIN = _pyupm_tcs37727.TCS37727_ATIME_MIN

_pyupm_tcs37727.TCS37727_ATIME_MAX_swigconstant(_pyupm_tcs37727)
TCS37727_ATIME_MAX = _pyupm_tcs37727.TCS37727_ATIME_MAX

_pyupm_tcs37727.DGF_IF_swigconstant(_pyupm_tcs37727)
DGF_IF = _pyupm_tcs37727.DGF_IF

_pyupm_tcs37727.R_COEF_IF_swigconstant(_pyupm_tcs37727)
R_COEF_IF = _pyupm_tcs37727.R_COEF_IF

_pyupm_tcs37727.G_COEF_IF_swigconstant(_pyupm_tcs37727)
G_COEF_IF = _pyupm_tcs37727.G_COEF_IF

_pyupm_tcs37727.B_COEF_IF_swigconstant(_pyupm_tcs37727)
B_COEF_IF = _pyupm_tcs37727.B_COEF_IF

_pyupm_tcs37727.CT_COEF_IF_swigconstant(_pyupm_tcs37727)
CT_COEF_IF = _pyupm_tcs37727.CT_COEF_IF

_pyupm_tcs37727.CT_OFFSET_IF_swigconstant(_pyupm_tcs37727)
CT_OFFSET_IF = _pyupm_tcs37727.CT_OFFSET_IF
[docs]class tcs37727_data_t(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, tcs37727_data_t, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, tcs37727_data_t, name) __repr__ = _swig_repr __swig_setmethods__["red"] = _pyupm_tcs37727.tcs37727_data_t_red_set __swig_getmethods__["red"] = _pyupm_tcs37727.tcs37727_data_t_red_get if _newclass: red = _swig_property(_pyupm_tcs37727.tcs37727_data_t_red_get, _pyupm_tcs37727.tcs37727_data_t_red_set) __swig_setmethods__["green"] = _pyupm_tcs37727.tcs37727_data_t_green_set __swig_getmethods__["green"] = _pyupm_tcs37727.tcs37727_data_t_green_get if _newclass: green = _swig_property(_pyupm_tcs37727.tcs37727_data_t_green_get, _pyupm_tcs37727.tcs37727_data_t_green_set) __swig_setmethods__["blue"] = _pyupm_tcs37727.tcs37727_data_t_blue_set __swig_getmethods__["blue"] = _pyupm_tcs37727.tcs37727_data_t_blue_get if _newclass: blue = _swig_property(_pyupm_tcs37727.tcs37727_data_t_blue_get, _pyupm_tcs37727.tcs37727_data_t_blue_set) __swig_setmethods__["clear"] = _pyupm_tcs37727.tcs37727_data_t_clear_set __swig_getmethods__["clear"] = _pyupm_tcs37727.tcs37727_data_t_clear_get if _newclass: clear = _swig_property(_pyupm_tcs37727.tcs37727_data_t_clear_get, _pyupm_tcs37727.tcs37727_data_t_clear_set) __swig_setmethods__["lux"] = _pyupm_tcs37727.tcs37727_data_t_lux_set __swig_getmethods__["lux"] = _pyupm_tcs37727.tcs37727_data_t_lux_get if _newclass: lux = _swig_property(_pyupm_tcs37727.tcs37727_data_t_lux_get, _pyupm_tcs37727.tcs37727_data_t_lux_set) __swig_setmethods__["ct"] = _pyupm_tcs37727.tcs37727_data_t_ct_set __swig_getmethods__["ct"] = _pyupm_tcs37727.tcs37727_data_t_ct_get if _newclass: ct = _swig_property(_pyupm_tcs37727.tcs37727_data_t_ct_get, _pyupm_tcs37727.tcs37727_data_t_ct_set) def __init__(self): this = _pyupm_tcs37727.new_tcs37727_data_t() try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_tcs37727.delete_tcs37727_data_t __del__ = lambda self: None
tcs37727_data_t_swigregister = _pyupm_tcs37727.tcs37727_data_t_swigregister tcs37727_data_t_swigregister(tcs37727_data_t)
[docs]class TCS37727(_object): """ API for the TCS37727 Color Light-To-Digital Converter. ID: tcs37727 Name: TCS37727 Color Light-To-Digital Converter Category: color Manufacturer: ams Link:http://ams.com/eng/Products/Light-Sensors Connection: i2c Description in web-link above: The TCS3772 device family provides red, green, blue, and clear (RGBC) light sensing and, when coupled with an external IR LED, proximity detection. These devices detect light intensity under a variety of lighting conditions and through a variety of attenuation materials, including dark glass. The proximity detection feature allows a large dynamic range of operation for accurate short distance detection, such as in a cell phone, for detecting when the user positions the phone close to their ear. An internal state machine provides the ability to put the device into a low power state in between proximity and RGBC measurements providing very low average power consumption. C++ includes: tcs37727.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, TCS37727, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, TCS37727, name) __repr__ = _swig_repr def __init__(self, bus, atime_us=200000, devAddr=0x29): """ TCS37727(int bus, int atime_us=TCS37727_ATIME_DEFAULT, int devAddr=TCS37727_I2C_ADDRESS) Instantiates an TCS37727 object Settings: Gain 4x, Proximity Detection off Parameters: ----------- bus: Number of the used bus atime_us: RGBC integration time devAddr: Address of the used I2C device """ this = _pyupm_tcs37727.new_TCS37727(bus, atime_us, devAddr) try: self.this.append(this) except Exception: self.this = this
[docs] def checkID(self): """ int checkID(void) Check device_id of sensor 0 on success -1 on error """ return _pyupm_tcs37727.TCS37727_checkID(self)
[docs] def setActive(self): """ int setActive(void) Set active mode, this enables periodic RGBC measurements 0 on success -1 on error """ return _pyupm_tcs37727.TCS37727_setActive(self)
[docs] def setStandby(self): """ int setStandby(void) Set standby mode, this disables periodic RGBC measurements Also turns off the sensor when proximity measurement is disabled 0 on success -1 on error """ return _pyupm_tcs37727.TCS37727_setStandby(self)
[docs] def trimGain(self, rawc): """ uint8_t trimGain(int rawc) """ return _pyupm_tcs37727.TCS37727_trimGain(self, rawc)
[docs] def sampleData(self): """ int sampleData(void) Read out data of regs and call further function Also saves converted values to variables 0 on success -1 on error """ return _pyupm_tcs37727.TCS37727_sampleData(self)
[docs] def getChannelRed(self, bSampleData=0): """ uint32_t getChannelRed(int bSampleData=0) Get the calculated channel red color Parameters: ----------- bSampleData: Flag to read sensor The channel red color on success 999 on error """ return _pyupm_tcs37727.TCS37727_getChannelRed(self, bSampleData)
[docs] def getChannelGreen(self, bSampleData=0): """ uint32_t getChannelGreen(int bSampleData=0) Get the calculated channel green color Parameters: ----------- bSampleData: Flag to read sensor The channel green color on success 999 on error """ return _pyupm_tcs37727.TCS37727_getChannelGreen(self, bSampleData)
[docs] def getChannelBlue(self, bSampleData=0): """ uint32_t getChannelBlue(int bSampleData=0) Get the calculated channel blue color Parameters: ----------- bSampleData: Flag to read sensor The channel blue color on success 999 on error """ return _pyupm_tcs37727.TCS37727_getChannelBlue(self, bSampleData)
[docs] def getChannelClear(self, bSampleData=0): """ uint32_t getChannelClear(int bSampleData=0) Get the calculated channel clear color Parameters: ----------- bSampleData: Flag to read sensor The channel clear color on success 999 on error """ return _pyupm_tcs37727.TCS37727_getChannelClear(self, bSampleData)
[docs] def getLux(self, bSampleData=0): """ uint32_t getLux(int bSampleData=0) Get the calculated lux value Parameters: ----------- bSampleData: Flag to read sensor The lux value on success 999 on error """ return _pyupm_tcs37727.TCS37727_getLux(self, bSampleData)
[docs] def getColorTemperature(self, bSampleData=0): """ uint32_t getColorTemperature(int bSampleData=0) Get the calculated color temperature Parameters: ----------- bSampleData: Flag to read sensor The color temperature on success 999 on error """ return _pyupm_tcs37727.TCS37727_getColorTemperature(self, bSampleData)
[docs] def getData(self, data, bSampleData=0): """ int getData(tcs37727_data_t *data, int bSampleData=0) Get calculated sensor values Parameters: ----------- data: Calculated sensor values bSampleData: Flag to read sensor 0 on success -1 on error """ return _pyupm_tcs37727.TCS37727_getData(self, data, bSampleData)
__swig_destroy__ = _pyupm_tcs37727.delete_TCS37727 __del__ = lambda self: None
TCS37727_swigregister = _pyupm_tcs37727.TCS37727_swigregister TCS37727_swigregister(TCS37727) # This file is compatible with both classic and new-style classes.