Source code for pyupm_max44000

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

_pyupm_max44000.ADDR_swigconstant(_pyupm_max44000)
ADDR = _pyupm_max44000.ADDR

_pyupm_max44000.ISR_swigconstant(_pyupm_max44000)
ISR = _pyupm_max44000.ISR

_pyupm_max44000.MCR_swigconstant(_pyupm_max44000)
MCR = _pyupm_max44000.MCR

_pyupm_max44000.RCR_swigconstant(_pyupm_max44000)
RCR = _pyupm_max44000.RCR

_pyupm_max44000.TCR_swigconstant(_pyupm_max44000)
TCR = _pyupm_max44000.TCR

_pyupm_max44000.ALSDATA_HIGH_swigconstant(_pyupm_max44000)
ALSDATA_HIGH = _pyupm_max44000.ALSDATA_HIGH

_pyupm_max44000.ALSDATA_LOW_swigconstant(_pyupm_max44000)
ALSDATA_LOW = _pyupm_max44000.ALSDATA_LOW

_pyupm_max44000.PRXDATA_swigconstant(_pyupm_max44000)
PRXDATA = _pyupm_max44000.PRXDATA

_pyupm_max44000.ALS_UP_THRESH_HIGH_swigconstant(_pyupm_max44000)
ALS_UP_THRESH_HIGH = _pyupm_max44000.ALS_UP_THRESH_HIGH

_pyupm_max44000.ALS_UP_THRESH_LOW_swigconstant(_pyupm_max44000)
ALS_UP_THRESH_LOW = _pyupm_max44000.ALS_UP_THRESH_LOW

_pyupm_max44000.ALS_LO_THRESH_HIGH_swigconstant(_pyupm_max44000)
ALS_LO_THRESH_HIGH = _pyupm_max44000.ALS_LO_THRESH_HIGH

_pyupm_max44000.ALS_LO_THRESH_LOW_swigconstant(_pyupm_max44000)
ALS_LO_THRESH_LOW = _pyupm_max44000.ALS_LO_THRESH_LOW

_pyupm_max44000.TPTR_swigconstant(_pyupm_max44000)
TPTR = _pyupm_max44000.TPTR

_pyupm_max44000.PROX_THRESH_IND_swigconstant(_pyupm_max44000)
PROX_THRESH_IND = _pyupm_max44000.PROX_THRESH_IND

_pyupm_max44000.PROX_THRESH_swigconstant(_pyupm_max44000)
PROX_THRESH = _pyupm_max44000.PROX_THRESH

_pyupm_max44000.TRIM_GAIN_GREEN_swigconstant(_pyupm_max44000)
TRIM_GAIN_GREEN = _pyupm_max44000.TRIM_GAIN_GREEN

_pyupm_max44000.TRIM_GAIN_IR_swigconstant(_pyupm_max44000)
TRIM_GAIN_IR = _pyupm_max44000.TRIM_GAIN_IR

_pyupm_max44000.HIGH_swigconstant(_pyupm_max44000)
HIGH = _pyupm_max44000.HIGH

_pyupm_max44000.LOW_swigconstant(_pyupm_max44000)
LOW = _pyupm_max44000.LOW
[docs]class MAX44000(_object): """ API for the MAX44000 Ambient and Infrared Proximity Sensor. ID: max44000 Name: Ambient and Infrared Proximity Sensor Category: light Manufacturer: maxim Connection: i2c Link:https://www.maximintegrated.com/en/products/analog/sensors-and- sensor- interface/MAX44000.html Maxim Integrated*MAX44000 is an ambient and infrared proximity sensor. This module was tested on the Maxim IntegratedMAX44000PMB1 PMOD module from the analog PMOD kit. C++ includes: max44000.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, MAX44000, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, MAX44000, name) __repr__ = _swig_repr def __init__(self, bus, devAddr=0x4A): """ MAX44000(int bus, int devAddr=ADDR) Instantiates an MAX44000 object Parameters: ----------- bus: Number of the used bus devAddr: Address of the used I2C device """ this = _pyupm_max44000.new_MAX44000(bus, devAddr) try: self.this.append(this) except Exception: self.this = this
[docs] def getProximity(self): """ uint16_t getProximity() MAX44000 object destructor; basically, it closes the I2C connection. ~MAX44000 (); no need for the destructor - the I2c connection will be closed when m_i2cMaxControlCtx variable will be out of context Reads the proximity value from the sensor (based on ambient data). """ return _pyupm_max44000.MAX44000_getProximity(self)
[docs] def getAmbient(self): """ uint16_t getAmbient() Reads the ambient value from the sensor (based on ambient data). """ return _pyupm_max44000.MAX44000_getAmbient(self)
[docs] def name(self): """ std::string name() Returns the name of the component """ return _pyupm_max44000.MAX44000_name(self)
[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_max44000.MAX44000_i2cReadReg_8(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_max44000.MAX44000_i2cReadReg_16(self, reg)
[docs] def i2cWriteReg(self, reg, value): """ mraa::Result i2cWriteReg(uint8_t reg, uint8_t value) Writes to a one-byte register Parameters: ----------- reg: Address of the register value: Byte to be written """ return _pyupm_max44000.MAX44000_i2cWriteReg(self, reg, value)
__swig_destroy__ = _pyupm_max44000.delete_MAX44000 __del__ = lambda self: None
MAX44000_swigregister = _pyupm_max44000.MAX44000_swigregister MAX44000_swigregister(MAX44000) # This file is compatible with both classic and new-style classes.