Source code for pyupm_rsc

# 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_rsc', [dirname(__file__)])
        except ImportError:
            import _pyupm_rsc
            return _pyupm_rsc
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_rsc', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_rsc = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_rsc
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_rsc.getVersion()
getVersion = _pyupm_rsc.getVersion
[docs]class RSC(_object): """ Description for the RSC TruStability line. ID: rsc Name: Honeywell RSC TruStability Pressure and Temperature Sensors Other Names: Honeywell RSC TruStability Boardmount Pressure Sensors Category: pressure temp Manufacturer: honeywell Connection: spi Link:https://sensing.honeywell.com/honeywell-sensing-trustability-rsc- series-data-sheet-32321348-b-en.pdf The RSC Series is a piezoresistive silicon pressure sensor offering a digital output for reading pressure over the specified full scale pressure span and temperature range. It is calibrated and temperature compensated for sensor offset, sensitivity, temperature effects, and non-linearity using a 24-bit analog-todigital converter with integrated EEPROM. Pressure data may be acquired at rates between 20 and 2000 samples per second over an SPI interface. It is intended for use with non- corrosive, non-ionic gases, such as air and other dry gases, designed and manufactured according to ISO 9001 standards, and is REACH and RoHS compliant. Most of the functionality available on this chip has been implemented. The driver calculates the compensated pressure and temperature values based on the information provided in the datasheet. The user must not mess around with the coefficient and adc init value readings from the EEPROM as these are used to calculate the compensated pressure and temperature values. In order to get the sensor to work properly on an Edison, you would need to turn off the Edison SPI power management, this can be done with the command: echo on > /sys/devices/pci0000\\:00/0000\\:00\\:07.1/power/control You might have to use external pull up resistors on all the lines. More info about this has been provided in the datasheet with a table and a diagram. C++ includes: rsc.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, RSC, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, RSC, name) __repr__ = _swig_repr def __init__(self, bus, cs_ee_pin, cs_adc_pin): """ RSC(uint8_t bus, uint8_t cs_ee_pin, uint8_t cs_adc_pin) Default constructor for rsc. This device supports SPI. The sensor has two chip select pins since there are two ways to access content on the sensor - EEPROM/ADC. We will not be using the SPI CS here because that would work for all SPI operations. Hence, you are expected to initialize any 2 gpio pins for CS by providing the pin numbers. Parameters: ----------- bus: SPI bus to use. cs_ee_pin: The CS pin for accessing the EEPROM cs_adc_pin: The CS pin for accessing the ADC """ this = _pyupm_rsc.new_RSC(bus, cs_ee_pin, cs_adc_pin) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_rsc.delete_RSC __del__ = lambda self: None
[docs] def getSensorName(self): """ string getSensorName() This function provides the sensor name as a string to the user. std::string sensor name """ return _pyupm_rsc.RSC_getSensorName(self)
[docs] def getSensorSerialNumber(self): """ string getSensorSerialNumber() This function provides the sensor serial number as a string to the user. std::string sensor serial number """ return _pyupm_rsc.RSC_getSensorSerialNumber(self)
[docs] def getPressureRange(self): """ float getPressureRange() This function provides the pressure range which the sensor can read out. This will vary for the different kinds of RSC sensors. This value is read from the EEPROM float Total sensor pressure range """ return _pyupm_rsc.RSC_getPressureRange(self)
[docs] def getMinimumPressure(self): """ float getMinimumPressure() This function provides the minimum pressure which the sensor can read out. This will vary for the different kinds of RSC sensors. This value is read from the EEPROM float Sensor minimum pressure """ return _pyupm_rsc.RSC_getMinimumPressure(self)
[docs] def getPressureUnit(self): """ string getPressureUnit() This function gets the units that the particular RSC sensor being used reads out the pressure data in. Following are the possible units data can be read out in: Pascal Kilo Pascal Mega Pascal PSI inH2O Bar milli Bar This info can be retrieved from the EEPROM std::string pressure units """ return _pyupm_rsc.RSC_getPressureUnit(self)
[docs] def getPressureType(self): """ string getPressureType() Function returns the type of RSC pressure sensor being used. This info is available in the EEPROM. Types: Differential Absolute Gauge std::string sensor type """ return _pyupm_rsc.RSC_getPressureType(self)
[docs] def getInitialADCState(self): """ uint8_t * getInitialADCState() Function returns the initial state that the ADC registers need to be set to. This info is retrieved from the EEPROM. std::string sensor type """ return _pyupm_rsc.RSC_getInitialADCState(self)
[docs] def updateCoefficients(self): """ void updateCoefficients() Function used to update the coefficients. This function doesn't return the coefficent values. Intstead, it updates the 2-D array with the coefficient values read from the EEPROM. This function is mostly for internal use only. """ return _pyupm_rsc.RSC_updateCoefficients(self)
[docs] def setupADC(self, adc_init_values): """ void setupADC(uint8_t *adc_init_values) Function used to set up the ADC with the initial values of the ADC registers read from the EEPROM. Parameters: ----------- adc_init_values: pointer to uint8_t array containing the initial ADC values """ return _pyupm_rsc.RSC_setupADC(self, adc_init_values)
[docs] def getTemperature(self): """ float getTemperature() Function to get the compensated temperature value. float compensated temperature value """ return _pyupm_rsc.RSC_getTemperature(self)
[docs] def getPressure(self): """ float getPressure() Function to get the compensated pressure value float compensated pressure value """ return _pyupm_rsc.RSC_getPressure(self)
[docs] def setMode(self, mode): """ void setMode(RSC_MODE mode) Function to set the mode for the RSC sensor: There are 2 types of modes available: Normal Mode - 256 KHz Fast Mode - 512 KHz mode enum of type RSC_MODE """ return _pyupm_rsc.RSC_setMode(self, mode)
[docs] def setDataRate(self, dr): """ void setDataRate(RSC_DATA_RATE dr) Function to set the data rate for the RSC sensor: Following are the different data rates available: In Normal Mode 20 SPS 45 SPS 90 SPS 175 SPS 330 SPS 600 SPS 1000 SPS In Fast Mode 40 SPS 90 SPS 180 SPS 350 SPS 660 SPS 1200 SPS 2000 SPS SPS - Samples per Second dr enum of type RSC_DATA_RATE """ return _pyupm_rsc.RSC_setDataRate(self, dr)
RSC_swigregister = _pyupm_rsc.RSC_swigregister RSC_swigregister(RSC) # This file is compatible with both classic and new-style classes.