Source code for pyupm_veml6070

# 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_veml6070', [dirname(__file__)])
        except ImportError:
            import _pyupm_veml6070
            return _pyupm_veml6070
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_veml6070', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_veml6070 = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_veml6070
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_veml6070.getVersion()
getVersion = _pyupm_veml6070.getVersion
[docs]class VEML6070(_object): """ API for the Vishay VEML6070 UV Sensor. ID: veml6070 Name: Vishay VEML6070 UV Sensor Category: other Manufacturer: Vishay Link:http://www.vishay.com/docs/84277/veml6070.pdf Connection: i2c Kit: other VEML6070 is an advanced ultraviolet (UV) light sensor with I2C protocol interface and designed by the CMOS process. It is easily operated via a simple I2C command. The active acknowledge (ACK) feature with threshold windows setting allows the UV sensor to send out a UVI alert message. Under a strong solar UVI condition, the smart ACK signal can be easily implemented by the software programming. VEML6070 incorporates a photodiode, amplifiers, and analog / digital circuits into a single chip. VEML6070's adoption of FiltronTM UV technology provides the best spectral sensitivity to cover UV spectrum sensing. It has an excellent temperature compensation and a robust refresh rate setting that does not use an external RC low pass filter. VEML6070 has linear sensitivity to solar UV light and is easily adjusted by an external resistor. Software shutdown mode is provided, which reduces power consumption to be less than 1 uA. VEML6070's operating voltage ranges from 2.7 V to 5.5 V. C++ includes: veml6070.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, VEML6070, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, VEML6070, name) __repr__ = _swig_repr def __init__(self, bus): """ VEML6070(int bus) VEML6070 constructor Parameters: ----------- bus: i2c bus to be used devAddress: i2c address of the sensor """ this = _pyupm_veml6070.new_VEML6070(bus) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_veml6070.delete_VEML6070 __del__ = lambda self: None
[docs] def getUVIntensity(self): """ int getUVIntensity() Function to get the UV value. int16_t UV value """ return _pyupm_veml6070.VEML6070_getUVIntensity(self)
[docs] def setIntegrationTime(self, time): """ void setIntegrationTime(veml6070_integration_time_t time) Function to allow the user to set the intergration time for the sensor. Integration time: Bit Setting | Description | RSet IT1 IT0 | | 300 k-ohms | 600 k-ohms 0 0 | 1/2T | 62.5 ms | 125 ms 0 1 | 1T | 125 ms | 250 ms 1 0 | 2T | 250 ms | 500 ms 1 1 | 4T | 500 ms | 1000 ms Parameters: ----------- time: veml6070_integration_time_t """ return _pyupm_veml6070.VEML6070_setIntegrationTime(self, time)
VEML6070_swigregister = _pyupm_veml6070.VEML6070_swigregister VEML6070_swigregister(VEML6070) # This file is compatible with both classic and new-style classes.