Source code for pyupm_sht1x

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

_pyupm_sht1x.SHT1X_CMD_MEAS_TEMPERATURE_swigconstant(_pyupm_sht1x)
SHT1X_CMD_MEAS_TEMPERATURE = _pyupm_sht1x.SHT1X_CMD_MEAS_TEMPERATURE

_pyupm_sht1x.SHT1X_CMD_MEAS_HUMIDITY_swigconstant(_pyupm_sht1x)
SHT1X_CMD_MEAS_HUMIDITY = _pyupm_sht1x.SHT1X_CMD_MEAS_HUMIDITY

_pyupm_sht1x.SHT1X_CMD_WRITE_STATUS_swigconstant(_pyupm_sht1x)
SHT1X_CMD_WRITE_STATUS = _pyupm_sht1x.SHT1X_CMD_WRITE_STATUS

_pyupm_sht1x.SHT1X_CMD_READ_STATUS_swigconstant(_pyupm_sht1x)
SHT1X_CMD_READ_STATUS = _pyupm_sht1x.SHT1X_CMD_READ_STATUS

_pyupm_sht1x.SHT1X_CMD_SOFT_RESET_swigconstant(_pyupm_sht1x)
SHT1X_CMD_SOFT_RESET = _pyupm_sht1x.SHT1X_CMD_SOFT_RESET

_pyupm_sht1x.SHT1X_STATUS_RESOLUTION_LOW_swigconstant(_pyupm_sht1x)
SHT1X_STATUS_RESOLUTION_LOW = _pyupm_sht1x.SHT1X_STATUS_RESOLUTION_LOW

_pyupm_sht1x.SHT1X_STATUS_NO_RELOAD_FROM_OTP_swigconstant(_pyupm_sht1x)
SHT1X_STATUS_NO_RELOAD_FROM_OTP = _pyupm_sht1x.SHT1X_STATUS_NO_RELOAD_FROM_OTP

_pyupm_sht1x.SHT1X_STATUS_HEATER_EN_swigconstant(_pyupm_sht1x)
SHT1X_STATUS_HEATER_EN = _pyupm_sht1x.SHT1X_STATUS_HEATER_EN

_pyupm_sht1x.SHT1X_STATUS_LOW_VOLT_swigconstant(_pyupm_sht1x)
SHT1X_STATUS_LOW_VOLT = _pyupm_sht1x.SHT1X_STATUS_LOW_VOLT

_pyupm_sht1x.SHT1X_VOLTS_5_swigconstant(_pyupm_sht1x)
SHT1X_VOLTS_5 = _pyupm_sht1x.SHT1X_VOLTS_5

_pyupm_sht1x.SHT1X_VOLTS_4_swigconstant(_pyupm_sht1x)
SHT1X_VOLTS_4 = _pyupm_sht1x.SHT1X_VOLTS_4

_pyupm_sht1x.SHT1X_VOLTS_3_5_swigconstant(_pyupm_sht1x)
SHT1X_VOLTS_3_5 = _pyupm_sht1x.SHT1X_VOLTS_3_5

_pyupm_sht1x.SHT1X_VOLTS_3_swigconstant(_pyupm_sht1x)
SHT1X_VOLTS_3 = _pyupm_sht1x.SHT1X_VOLTS_3

_pyupm_sht1x.SHT1X_VOLTS_2_5_swigconstant(_pyupm_sht1x)
SHT1X_VOLTS_2_5 = _pyupm_sht1x.SHT1X_VOLTS_2_5
[docs]class SHT1X(_object): """ SHT1X Temperature and Humidity Sensor. ID: sht1x Name: Temperature and Humidity Sensor Category: temp Manufacturer: dfrobot Link:https://www.dfrobot.com/wiki/index.php/SHT1x_Humidity_and_Temperature_Sensor_(SKU:_DFR0066) Connection: gpio This driver was tested with a DFRobot SHT10 Temperature and Humidity sensor. This driver should work on all SHT1X devices. It requires a 10K pull-up resistor connected to the data pin. The sensor can be run at differing voltages from 2.5v to 5v. C++ includes: sht1x.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, SHT1X, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, SHT1X, name) __repr__ = _swig_repr def __init__(self, clk_pin, data_pin): """ SHT1X(unsigned int clk_pin, unsigned int data_pin) SHT1X object constructor Parameters: ----------- clk_pin: Specify the GPIO pin to use for the clock. data_pin: Specify the GPIO pin to use for data. """ this = _pyupm_sht1x.new_SHT1X(clk_pin, data_pin) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_sht1x.delete_SHT1X __del__ = lambda self: None
[docs] def reset(self): """ void reset() Perform a soft reset of the device. """ return _pyupm_sht1x.SHT1X_reset(self)
[docs] def update(self): """ void update() Query the device and store the latest values. You must call this function before querying the temperature or the humidity. """ return _pyupm_sht1x.SHT1X_update(self)
[docs] def getTemperature(self): """ float getTemperature() Query the temperature in degrees Celsius. update() must have been called prior to calling this function. The temperature in Celsius """ return _pyupm_sht1x.SHT1X_getTemperature(self)
[docs] def getHumidity(self): """ float getHumidity() Query the relative humidity. update() must have been called prior to calling this function. The relative humidity. """ return _pyupm_sht1x.SHT1X_getHumidity(self)
[docs] def readStatus(self): """ uint8_t readStatus() Read the status register. The contents of the status register. """ return _pyupm_sht1x.SHT1X_readStatus(self)
[docs] def writeStatus(self, status): """ upm_result_t writeStatus(uint8_t status) Write a value to the status register. Parameters: ----------- status: The uint8_t to write to the register. UPM result """ return _pyupm_sht1x.SHT1X_writeStatus(self, status)
[docs] def setVolts(self, volts): """ void setVolts(SHT1X_VOLTS_T volts) The Vdd voltage the sensor is being driven at can affect the temperature measurements. This function allows you to specify a voltage as close as you are using to power the sensor, so that the appropriate compensation can be made. By default, the coefficients are set for 5v operation. Parameters: ----------- volts: One of the SHT1X_VOLTS_T values. """ return _pyupm_sht1x.SHT1X_setVolts(self, volts)
SHT1X_swigregister = _pyupm_sht1x.SHT1X_swigregister SHT1X_swigregister(SHT1X) # This file is compatible with both classic and new-style classes.