Source code for pyupm_tmp006

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

_pyupm_tmp006.TMP006_NAME_swigconstant(_pyupm_tmp006)
TMP006_NAME = _pyupm_tmp006.TMP006_NAME

_pyupm_tmp006.TMP006_I2C_ADDRESS_swigconstant(_pyupm_tmp006)
TMP006_I2C_ADDRESS = _pyupm_tmp006.TMP006_I2C_ADDRESS

_pyupm_tmp006.TMP006_MANUFACTURER_ID_swigconstant(_pyupm_tmp006)
TMP006_MANUFACTURER_ID = _pyupm_tmp006.TMP006_MANUFACTURER_ID

_pyupm_tmp006.TMP006_DEVICE_ID_swigconstant(_pyupm_tmp006)
TMP006_DEVICE_ID = _pyupm_tmp006.TMP006_DEVICE_ID

_pyupm_tmp006.TMP007_I2C_ADDRESS_swigconstant(_pyupm_tmp006)
TMP007_I2C_ADDRESS = _pyupm_tmp006.TMP007_I2C_ADDRESS

_pyupm_tmp006.TMP007_DEVICE_ID_swigconstant(_pyupm_tmp006)
TMP007_DEVICE_ID = _pyupm_tmp006.TMP007_DEVICE_ID

_pyupm_tmp006.TMP006_CONVERSION_TIME_swigconstant(_pyupm_tmp006)
TMP006_CONVERSION_TIME = _pyupm_tmp006.TMP006_CONVERSION_TIME

_pyupm_tmp006.TMP006_SENSOR_VOLTAGE_swigconstant(_pyupm_tmp006)
TMP006_SENSOR_VOLTAGE = _pyupm_tmp006.TMP006_SENSOR_VOLTAGE

_pyupm_tmp006.TMP006_LOCAL_TEMPERATURE_swigconstant(_pyupm_tmp006)
TMP006_LOCAL_TEMPERATURE = _pyupm_tmp006.TMP006_LOCAL_TEMPERATURE

_pyupm_tmp006.TMP006_CONFIGURATION_swigconstant(_pyupm_tmp006)
TMP006_CONFIGURATION = _pyupm_tmp006.TMP006_CONFIGURATION

_pyupm_tmp006.TMP006_MANUFACTURER_ID_REG_swigconstant(_pyupm_tmp006)
TMP006_MANUFACTURER_ID_REG = _pyupm_tmp006.TMP006_MANUFACTURER_ID_REG

_pyupm_tmp006.TMP006_DEVICE_ID_REG_swigconstant(_pyupm_tmp006)
TMP006_DEVICE_ID_REG = _pyupm_tmp006.TMP006_DEVICE_ID_REG

_pyupm_tmp006.TMP007_DEVICE_ID_REG_swigconstant(_pyupm_tmp006)
TMP007_DEVICE_ID_REG = _pyupm_tmp006.TMP007_DEVICE_ID_REG

_pyupm_tmp006.TMP006_RST_SOFT_swigconstant(_pyupm_tmp006)
TMP006_RST_SOFT = _pyupm_tmp006.TMP006_RST_SOFT

_pyupm_tmp006.TMP006_CONFIG_MOD_SHIFT_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_MOD_SHIFT = _pyupm_tmp006.TMP006_CONFIG_MOD_SHIFT

_pyupm_tmp006.TMP006_CONFIG_MOD_MASK_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_MOD_MASK = _pyupm_tmp006.TMP006_CONFIG_MOD_MASK

_pyupm_tmp006.TMP006_CONFIG_MOD_CC_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_MOD_CC = _pyupm_tmp006.TMP006_CONFIG_MOD_CC

_pyupm_tmp006.TMP006_CONFIG_MOD_OFF_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_MOD_OFF = _pyupm_tmp006.TMP006_CONFIG_MOD_OFF

_pyupm_tmp006.TMP006_CONFIG_CR_SHIFT_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_CR_SHIFT = _pyupm_tmp006.TMP006_CONFIG_CR_SHIFT

_pyupm_tmp006.TMP006_CONFIG_CR_MASK_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_CR_MASK = _pyupm_tmp006.TMP006_CONFIG_CR_MASK

_pyupm_tmp006.TMP006_CONFIG_CR_AS1_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_CR_AS1 = _pyupm_tmp006.TMP006_CONFIG_CR_AS1

_pyupm_tmp006.TMP006_CONFIG_CR_AS2_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_CR_AS2 = _pyupm_tmp006.TMP006_CONFIG_CR_AS2

_pyupm_tmp006.TMP006_CONFIG_CR_AS4_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_CR_AS4 = _pyupm_tmp006.TMP006_CONFIG_CR_AS4

_pyupm_tmp006.TMP006_CONFIG_CR_AS8_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_CR_AS8 = _pyupm_tmp006.TMP006_CONFIG_CR_AS8

_pyupm_tmp006.TMP006_CONFIG_CR_AS16_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_CR_AS16 = _pyupm_tmp006.TMP006_CONFIG_CR_AS16

_pyupm_tmp006.TMP006_CONFIG_CR_DEF_swigconstant(_pyupm_tmp006)
TMP006_CONFIG_CR_DEF = _pyupm_tmp006.TMP006_CONFIG_CR_DEF

_pyupm_tmp006.TMP006_DRDY_EN_swigconstant(_pyupm_tmp006)
TMP006_DRDY_EN = _pyupm_tmp006.TMP006_DRDY_EN

_pyupm_tmp006.TMP006_DRDY_DATA_RDY_swigconstant(_pyupm_tmp006)
TMP006_DRDY_DATA_RDY = _pyupm_tmp006.TMP006_DRDY_DATA_RDY

_pyupm_tmp006.TMP006_CCONST_S0_swigconstant(_pyupm_tmp006)
TMP006_CCONST_S0 = _pyupm_tmp006.TMP006_CCONST_S0

_pyupm_tmp006.TMP006_CCONST_A1_swigconstant(_pyupm_tmp006)
TMP006_CCONST_A1 = _pyupm_tmp006.TMP006_CCONST_A1

_pyupm_tmp006.TMP006_CCONST_A2_swigconstant(_pyupm_tmp006)
TMP006_CCONST_A2 = _pyupm_tmp006.TMP006_CCONST_A2

_pyupm_tmp006.TMP006_CCONST_TREF_swigconstant(_pyupm_tmp006)
TMP006_CCONST_TREF = _pyupm_tmp006.TMP006_CCONST_TREF

_pyupm_tmp006.TMP006_CCONST_B0_swigconstant(_pyupm_tmp006)
TMP006_CCONST_B0 = _pyupm_tmp006.TMP006_CCONST_B0

_pyupm_tmp006.TMP006_CCONST_B1_swigconstant(_pyupm_tmp006)
TMP006_CCONST_B1 = _pyupm_tmp006.TMP006_CCONST_B1

_pyupm_tmp006.TMP006_CCONST_B2_swigconstant(_pyupm_tmp006)
TMP006_CCONST_B2 = _pyupm_tmp006.TMP006_CCONST_B2

_pyupm_tmp006.TMP006_CCONST_C2_swigconstant(_pyupm_tmp006)
TMP006_CCONST_C2 = _pyupm_tmp006.TMP006_CCONST_C2

_pyupm_tmp006.TMP006_CCONST_LSB_SIZE_swigconstant(_pyupm_tmp006)
TMP006_CCONST_LSB_SIZE = _pyupm_tmp006.TMP006_CCONST_LSB_SIZE

_pyupm_tmp006.TMP006_SEN_swigconstant(_pyupm_tmp006)
TMP006_SEN = _pyupm_tmp006.TMP006_SEN

_pyupm_tmp006.TMP007_SEN_swigconstant(_pyupm_tmp006)
TMP007_SEN = _pyupm_tmp006.TMP007_SEN
[docs]class TMP006(_object): """ API for the TMP006 IR-Thermopile Sensor. ID: tmp006 Name: TMP006 IR-Thermopile Sensor Category: temp Manufacturer: ti Link:http://www.ti.com/product/TMP006/datasheet/abstract#SBOS5183423 Connection: i2c Description in web-link above: The TMP006 and TMP006B are fully integrated MEMs thermopile sensors that measure the temperature of an object without having to be in direct contact. The thermopile absorbs passive infrared energy from an object at wavelengths between 4 um to 16 um within the end-user defined field of view. The corresponding change in voltage across the thermopile is digitized and reported with the on-chip die thermal sensor measurement through an I2C- and SMBus-compatible interface. With this data, the target object temperature can be calculated by an external processor. The Infrared thermopile sensor is specified to operate from -40 to +125 [degC]. It is possible to measure an object temperature beyond the device operating range as long as the device itself does not exceed the operating temperature range (-40 to +125 [degC]). C++ includes: tmp006.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, TMP006, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, TMP006, name) __repr__ = _swig_repr def __init__(self, bus, conv_rate=0x02, devAddr=0x41): """ TMP006(int bus, uint8_t conv_rate=TMP006_CONFIG_CR_DEF, int devAddr=TMP006_I2C_ADDRESS) Instantiates an TMP006 object Parameters: ----------- bus: Number of the used bus conv_rate: Conversation rate (allowed between 0 and 4) devAddr: Address of the used I2C device """ this = _pyupm_tmp006.new_TMP006(bus, conv_rate, 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 succes -1 on error """ return _pyupm_tmp006.TMP006_checkID(self)
[docs] def resetSensor(self): """ void resetSensor(void) Performs a soft reset of the TMP006 device to ensure it is in a known state. """ return _pyupm_tmp006.TMP006_resetSensor(self)
[docs] def setActive(self): """ void setActive(void) Set active mode, this enables periodic measurements. """ return _pyupm_tmp006.TMP006_setActive(self)
[docs] def setStandby(self): """ void setStandby(void) Set standby mode, this disables periodic measurements. """ return _pyupm_tmp006.TMP006_setStandby(self)
[docs] def sampleData(self): """ int sampleData(void) Read out data of regs and call further function Also saves converted value to variable """ return _pyupm_tmp006.TMP006_sampleData(self)
[docs] def convert_data(self, rawv, rawt, tamb, tobj): """ void convert_data(int16_t rawv, int16_t rawt, float *tamb, float *tobj) Convert raw sensor values to temperature. Parameters: ----------- rawv: Object voltage value rawt: Raw die temperature value tamb: Converted ambient temperature tobj: Converted object temperature """ return _pyupm_tmp006.TMP006_convert_data(self, rawv, rawt, tamb, tobj)
[docs] def getTemperature(self, bSampleData=0): """ float getTemperature(int bSampleData=0) Get the calculated object temperature [degC] Parameters: ----------- bSampleData: Flag to read sensor The object temp in degC on success and -273.2 on 'conversation in progress' """ return _pyupm_tmp006.TMP006_getTemperature(self, bSampleData)
[docs] def getConfig(self): """ uint16_t getConfig(void) Get value of configuration reg """ return _pyupm_tmp006.TMP006_getConfig(self)
__swig_destroy__ = _pyupm_tmp006.delete_TMP006 __del__ = lambda self: None
TMP006_swigregister = _pyupm_tmp006.TMP006_swigregister TMP006_swigregister(TMP006) # This file is compatible with both classic and new-style classes.