Source code for pyupm_ms5803

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

def new_floatp():
    return _pyupm_ms5803.new_floatp()
new_floatp = _pyupm_ms5803.new_floatp

def copy_floatp(value):
    return _pyupm_ms5803.copy_floatp(value)
copy_floatp = _pyupm_ms5803.copy_floatp

def delete_floatp(obj):
    return _pyupm_ms5803.delete_floatp(obj)
delete_floatp = _pyupm_ms5803.delete_floatp

def floatp_assign(obj, value):
    return _pyupm_ms5803.floatp_assign(obj, value)
floatp_assign = _pyupm_ms5803.floatp_assign

def floatp_value(obj):
    return _pyupm_ms5803.floatp_value(obj)
floatp_value = _pyupm_ms5803.floatp_value

_pyupm_ms5803.MS5803_DEFAULT_I2C_ADDR_swigconstant(_pyupm_ms5803)
MS5803_DEFAULT_I2C_ADDR = _pyupm_ms5803.MS5803_DEFAULT_I2C_ADDR

_pyupm_ms5803.MS5803_MAX_COEFFICIENTS_swigconstant(_pyupm_ms5803)
MS5803_MAX_COEFFICIENTS = _pyupm_ms5803.MS5803_MAX_COEFFICIENTS

_pyupm_ms5803.MS5803_CMD_RESET_swigconstant(_pyupm_ms5803)
MS5803_CMD_RESET = _pyupm_ms5803.MS5803_CMD_RESET

_pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_256_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D1_OSR_256 = _pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_256

_pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_512_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D1_OSR_512 = _pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_512

_pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_1024_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D1_OSR_1024 = _pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_1024

_pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_2048_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D1_OSR_2048 = _pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_2048

_pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_4096_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D1_OSR_4096 = _pyupm_ms5803.MS5803_CMD_CONVERT_D1_OSR_4096

_pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_256_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D2_OSR_256 = _pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_256

_pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_512_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D2_OSR_512 = _pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_512

_pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_1024_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D2_OSR_1024 = _pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_1024

_pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_2048_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D2_OSR_2048 = _pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_2048

_pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_4096_swigconstant(_pyupm_ms5803)
MS5803_CMD_CONVERT_D2_OSR_4096 = _pyupm_ms5803.MS5803_CMD_CONVERT_D2_OSR_4096

_pyupm_ms5803.MS5803_CMD_ADC_READ_swigconstant(_pyupm_ms5803)
MS5803_CMD_ADC_READ = _pyupm_ms5803.MS5803_CMD_ADC_READ

_pyupm_ms5803.MS5803_CMD_PROM_READ_swigconstant(_pyupm_ms5803)
MS5803_CMD_PROM_READ = _pyupm_ms5803.MS5803_CMD_PROM_READ

_pyupm_ms5803.MS5803_OSR_256_swigconstant(_pyupm_ms5803)
MS5803_OSR_256 = _pyupm_ms5803.MS5803_OSR_256

_pyupm_ms5803.MS5803_OSR_512_swigconstant(_pyupm_ms5803)
MS5803_OSR_512 = _pyupm_ms5803.MS5803_OSR_512

_pyupm_ms5803.MS5803_OSR_1024_swigconstant(_pyupm_ms5803)
MS5803_OSR_1024 = _pyupm_ms5803.MS5803_OSR_1024

_pyupm_ms5803.MS5803_OSR_2048_swigconstant(_pyupm_ms5803)
MS5803_OSR_2048 = _pyupm_ms5803.MS5803_OSR_2048

_pyupm_ms5803.MS5803_OSR_4096_swigconstant(_pyupm_ms5803)
MS5803_OSR_4096 = _pyupm_ms5803.MS5803_OSR_4096
[docs]class MS5803(_object): """ UPM API for the MS5803 Pressure and Temperature sensor. ID: ms5803 Name: I2C Barometric Pressure and Temperature Sensor Category: temperature pressure Manufacturer: sparkfun Connection: i2c spi Link:https://www.sparkfun.com/products/12909 The MS5803-14BA is a new generation of high resolution pressure sensors with SPI and I2C bus interface. It is optimized for depth measurement systems with a water depth resolution of 1cm and below. The sensor module includes a high linear pressure sensor and an ultra low power 24 bit delta-sigma ADC with internal factory calibrated coefficients. It provides a precise digital 24 bit pressure and temperature value and different operation modes that allow the user to optimize for conversion speed and current consumption. A high resolution temperature output allows the implementation of a depth measurement systems and thermometer function without any additional sensor. The device is driven at 3.3vdc, and has a pressure range of between 0 and 14 Bar, and a temperature range of between -40 and +85C. C++ includes: ms5803.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, MS5803, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, MS5803, name) __repr__ = _swig_repr def __init__(self, bus, address=0x76, csPin=-1): """ MS5803(int bus, int address=MS5803_DEFAULT_I2C_ADDR, int csPin=-1) MS5803 constructor. The default arguments inititialize I2C operation and the default I2C address. Parameters: ----------- bus: i2c/spi bus to use address: The address for this device if using I2C. If using SPI, supply -1 for this parameter. csPin: The GPIO pin to use for Chip Select (CS). This is only needed for SPI, and only if your SPI implementation requires it. Otherwise, just pass -1 if not using SPI, or your CS is handled automatically by your SPI implementation. """ this = _pyupm_ms5803.new_MS5803(bus, address, csPin) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_ms5803.delete_MS5803 __del__ = lambda self: None
[docs] def reset(self): """ void reset() Reset the device. """ return _pyupm_ms5803.MS5803_reset(self)
[docs] def update(self): """ void update() Take a measurement and store the current sensor values internally. This function must be called prior to retrieving any sensor values, for example getTemperature(). """ return _pyupm_ms5803.MS5803_update(self)
[docs] def setTemperatureOSR(self, osr): """ void setTemperatureOSR(MS5803_OSR_T osr) Set the output sampling resolution of the temperature measurement. Higher values provide a more precise value. In addition, more precise values require more time to measure. The default set at device intialization is the highest precision supported: MS5803_OSR_4096 Parameters: ----------- osr: One of the MS5803_OSR_T values. """ return _pyupm_ms5803.MS5803_setTemperatureOSR(self, osr)
[docs] def setPressureOSR(self, osr): """ void setPressureOSR(MS5803_OSR_T osr) Set the output sampling resolution of the pressure measurement. Higher values provide a more precise value. In addition, more precise values require more time to measure. The default set at device intialization is the highest precision supported: MS5803_OSR_4096 Parameters: ----------- osr: One of the MS5803_OSR_T values. """ return _pyupm_ms5803.MS5803_setPressureOSR(self, osr)
[docs] def getTemperature(self): """ float getTemperature() Return the latest measured temperature. update() must have been called prior to calling this function. The returned value is in degrees Celsius. Temperature in degrees C """ return _pyupm_ms5803.MS5803_getTemperature(self)
[docs] def getPressure(self): """ float getPressure() Return the latest measured pressure. update() must have been called prior to calling this function. The returned value is in millibars. Pressure in mbar """ return _pyupm_ms5803.MS5803_getPressure(self)
MS5803_swigregister = _pyupm_ms5803.MS5803_swigregister MS5803_swigregister(MS5803) # This file is compatible with both classic and new-style classes.