# 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_am2315', [dirname(__file__)])
except ImportError:
import _pyupm_am2315
return _pyupm_am2315
if fp is not None:
try:
_mod = imp.load_module('_pyupm_am2315', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_am2315 = swig_import_helper()
del swig_import_helper
else:
import _pyupm_am2315
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_am2315.getVersion()
getVersion = _pyupm_am2315.getVersion
_pyupm_am2315.AM2315_NAME_swigconstant(_pyupm_am2315)
AM2315_NAME = _pyupm_am2315.AM2315_NAME
_pyupm_am2315.AM2315_I2C_ADDRESS_swigconstant(_pyupm_am2315)
AM2315_I2C_ADDRESS = _pyupm_am2315.AM2315_I2C_ADDRESS
_pyupm_am2315.AM2315_READ_swigconstant(_pyupm_am2315)
AM2315_READ = _pyupm_am2315.AM2315_READ
_pyupm_am2315.AM2315_WRITE_swigconstant(_pyupm_am2315)
AM2315_WRITE = _pyupm_am2315.AM2315_WRITE
_pyupm_am2315.AM2315_HUMIDITY_swigconstant(_pyupm_am2315)
AM2315_HUMIDITY = _pyupm_am2315.AM2315_HUMIDITY
_pyupm_am2315.AM2315_TEMP_swigconstant(_pyupm_am2315)
AM2315_TEMP = _pyupm_am2315.AM2315_TEMP
_pyupm_am2315.AM2315_MODEL_swigconstant(_pyupm_am2315)
AM2315_MODEL = _pyupm_am2315.AM2315_MODEL
_pyupm_am2315.AM2315_VERSION_swigconstant(_pyupm_am2315)
AM2315_VERSION = _pyupm_am2315.AM2315_VERSION
_pyupm_am2315.AM2315_ID_swigconstant(_pyupm_am2315)
AM2315_ID = _pyupm_am2315.AM2315_ID
_pyupm_am2315.AM2315_STATUS_swigconstant(_pyupm_am2315)
AM2315_STATUS = _pyupm_am2315.AM2315_STATUS
_pyupm_am2315.AM2315_USER_A_swigconstant(_pyupm_am2315)
AM2315_USER_A = _pyupm_am2315.AM2315_USER_A
_pyupm_am2315.AM2315_USER_B_swigconstant(_pyupm_am2315)
AM2315_USER_B = _pyupm_am2315.AM2315_USER_B
_pyupm_am2315.AM2315_SAMPLE_swigconstant(_pyupm_am2315)
AM2315_SAMPLE = _pyupm_am2315.AM2315_SAMPLE
_pyupm_am2315.HIGH_PRIORITY_swigconstant(_pyupm_am2315)
HIGH_PRIORITY = _pyupm_am2315.HIGH_PRIORITY
[docs]class AM2315(_object):
"""
API for the AM2315 Temperature & Humidity Sensor.
ID: am2315
Name: Digital Temperature and Humidity Sensor
Category: temp
Manufacturer: adafruit
Link:http://www.adafruit.com/products/1293
Connection: i2c AM2315 by Measurement Specialties
(http://www.aosong.com/asp_bin/Products/en/AM2315.pdf) is a digital
humidity sensor with temperature output. RH reports between 0 and
100%, and the temperature range is -40 to +125 degC. The sampling
period of this sensor is 2 seconds. Reads occurring more often than
that return cached data.
C++ includes: am2315.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, AM2315, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, AM2315, name)
__repr__ = _swig_repr
def __init__(self, bus, devAddr=0x5c):
"""
AM2315(int bus, int
devAddr=AM2315_I2C_ADDRESS)
Instantiates an AM2315 object
Parameters:
-----------
bus: Number of the used bus
devAddr: Address of the used I2C device
"""
this = _pyupm_am2315.new_AM2315(bus, devAddr)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_am2315.delete_AM2315
__del__ = lambda self: None
[docs] def getHumidity(self):
"""
float
getHumidity(void)
Gets the current measured humidity [RH]
Data is updated every 2 seconds - accesses occurring more often than
that return cached data
"""
return _pyupm_am2315.AM2315_getHumidity(self)
[docs] def getTemperature(self):
"""
float
getTemperature(void)
Gets the humidity cell temperature [degC]
Data is updated every 2 seconds - accesses occurring more often than
that return cached data
"""
return _pyupm_am2315.AM2315_getTemperature(self)
[docs] def getTemperatureF(self):
"""
float
getTemperatureF(void)
Gets the humidity cell temperature [degF]
Data is updated every 2 seconds - accesses occurring more often than
that return cached data
"""
return _pyupm_am2315.AM2315_getTemperatureF(self)
[docs] def testSensor(self):
"""
int testSensor(void)
Function intended to test the device and verify it is operating
correctly.
"""
return _pyupm_am2315.AM2315_testSensor(self)
[docs] def i2cWriteReg_32(self, reg, ival):
"""
int
i2cWriteReg_32(int reg, uint32_t ival)
Writes a four-byte (32b) register
Note: these access routines are not the normal accesses to an I2C
device. AM2315 contains a microcontroller that manages the actual
readings. These handlers then make requests over I2C using a protocol
defined by AM2315.
Parameters:
-----------
reg: Address of the register
ival: 32b value
"""
return _pyupm_am2315.AM2315_i2cWriteReg_32(self, reg, ival)
[docs] def i2cWriteReg_16(self, reg, ival):
"""
int
i2cWriteReg_16(int reg, uint16_t ival)
Writes a two-byte (16b) register
Parameters:
-----------
reg: Address of the register
ival: 16b value
"""
return _pyupm_am2315.AM2315_i2cWriteReg_16(self, reg, ival)
[docs] def i2cWriteReg_8(self, reg, ival):
"""
int
i2cWriteReg_8(int reg, uint8_t ival)
Writes a one-byte (8b) register
Parameters:
-----------
reg: Address of the register
ival: 8b value
"""
return _pyupm_am2315.AM2315_i2cWriteReg_8(self, reg, ival)
[docs] def i2cReadReg_32(self, reg):
"""
uint32_t
i2cReadReg_32(int reg)
Reads a four-byte register
Parameters:
-----------
reg: Address of the register
"""
return _pyupm_am2315.AM2315_i2cReadReg_32(self, reg)
[docs] def i2cReadReg_16(self, reg):
"""
uint16_t
i2cReadReg_16(int reg)
Reads a two-byte register
Parameters:
-----------
reg: Address of the register
"""
return _pyupm_am2315.AM2315_i2cReadReg_16(self, reg)
[docs] def i2cReadReg_8(self, reg):
"""
uint8_t
i2cReadReg_8(int reg)
Reads a one-byte register
Parameters:
-----------
reg: Address of the register
"""
return _pyupm_am2315.AM2315_i2cReadReg_8(self, reg)
AM2315_swigregister = _pyupm_am2315.AM2315_swigregister
AM2315_swigregister(AM2315)
# This file is compatible with both classic and new-style classes.