Source code for pyupm_abp

# 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_abp', [dirname(__file__)])
        except ImportError:
            import _pyupm_abp
            return _pyupm_abp
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_abp', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_abp = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_abp
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_abp.getVersion()
getVersion = _pyupm_abp.getVersion
[docs]class ABP(_object): """ API for the ABP Honeywell Pressure Sensor. ID: abp Name: Honeywell ABP Pressure and Temperature Sensor Category: other Manufacturer: Honeywell Link:https://sensing.honeywell.com/honeywell-sensing-basic-board- mount- pressure-sensors-abp-series-datasheet-323005128-c-en.pdf Connection: i2c Kit: other This is the UPM Module for the ABP Honeywell Pressure and Temp sensor. This sensor uses an onboard ASIC to output values of pressure that are updated at approximately 2 KHz. It is capable of detecting pressure in the 0-5 psi range and it has an i2c based interface. Temperature calculation using this driver is possible but not all ABP sensors support that functionality. NOTE: This driver supports only the I2C based ABP sensors, it does not currently support SPI and Analog based sensors. C++ includes: abp.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, ABP, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, ABP, name) __repr__ = _swig_repr def __init__(self, bus, devAddress): """ ABP(int bus, int devAddress) ABP constructor Parameters: ----------- bus: i2c bus to be used devAddress: i2c address of the sensor """ this = _pyupm_abp.new_ABP(bus, devAddress) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_abp.delete_ABP __del__ = lambda self: None
[docs] def getPressure(self): """ float getPressure() Function to get the compensated pressure. The datasheet provides a way to calculate the pressure. In order to know the units take a look at the datasheet. float compensated temperature value """ return _pyupm_abp.ABP_getPressure(self)
[docs] def getTemperature(self): """ float getTemperature() Function to retrieve the compensated temperature values. All ABP seem to calculate temperature in degree Celsius. (The above fact needs to be verified) NOTE: This functionality is not available in all the ABP sensors. float compensated temperature value """ return _pyupm_abp.ABP_getTemperature(self)
[docs] def update(self): """ void update() This functio has to be called before calling either of the get temperature or get pressure functions. This function updates the device context with the latest values. Not calling this function will lead to stale values. """ return _pyupm_abp.ABP_update(self)
[docs] def setMaxPressure(self, max): """ void setMaxPressure(int max) Function to set the max pressure that the sensor can read, can be retrieved from the datasheet, if this function is not explicitly called to the set the min value, then a default max value of 5 will be set. Parameters: ----------- max: int maximum pressure value possible """ return _pyupm_abp.ABP_setMaxPressure(self, max)
[docs] def setMinPressure(self, min): """ void setMinPressure(int min) Function to set the min pressure that the sensor can read, can be retrieved from the datasheet, if this function is not explicitly called to the set the min value, then a default min value of 0 will be set. Parameters: ----------- min: int minimum pressure value possible """ return _pyupm_abp.ABP_setMinPressure(self, min)
ABP_swigregister = _pyupm_abp.ABP_swigregister ABP_swigregister(ABP) # This file is compatible with both classic and new-style classes.