Source code for pyupm_itg3200

# 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_itg3200', [dirname(__file__)])
        except ImportError:
            import _pyupm_itg3200
            return _pyupm_itg3200
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_itg3200', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_itg3200 = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_itg3200
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_itg3200.getVersion()
getVersion = _pyupm_itg3200.getVersion
[docs]class int16Array(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, int16Array, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, int16Array, name) __repr__ = _swig_repr def __init__(self, nelements): this = _pyupm_itg3200.new_int16Array(nelements) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_itg3200.delete_int16Array __del__ = lambda self: None def __getitem__(self, index): return _pyupm_itg3200.int16Array___getitem__(self, index) def __setitem__(self, index, value): return _pyupm_itg3200.int16Array___setitem__(self, index, value)
[docs] def cast(self): return _pyupm_itg3200.int16Array_cast(self)
__swig_getmethods__["frompointer"] = lambda x: _pyupm_itg3200.int16Array_frompointer if _newclass: frompointer = staticmethod(_pyupm_itg3200.int16Array_frompointer)
int16Array_swigregister = _pyupm_itg3200.int16Array_swigregister int16Array_swigregister(int16Array) def int16Array_frompointer(t): return _pyupm_itg3200.int16Array_frompointer(t) int16Array_frompointer = _pyupm_itg3200.int16Array_frompointer
[docs]class floatArray(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, floatArray, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, floatArray, name) __repr__ = _swig_repr def __init__(self, nelements): this = _pyupm_itg3200.new_floatArray(nelements) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_itg3200.delete_floatArray __del__ = lambda self: None def __getitem__(self, index): return _pyupm_itg3200.floatArray___getitem__(self, index) def __setitem__(self, index, value): return _pyupm_itg3200.floatArray___setitem__(self, index, value)
[docs] def cast(self): return _pyupm_itg3200.floatArray_cast(self)
__swig_getmethods__["frompointer"] = lambda x: _pyupm_itg3200.floatArray_frompointer if _newclass: frompointer = staticmethod(_pyupm_itg3200.floatArray_frompointer)
floatArray_swigregister = _pyupm_itg3200.floatArray_swigregister floatArray_swigregister(floatArray) def floatArray_frompointer(t): return _pyupm_itg3200.floatArray_frompointer(t) floatArray_frompointer = _pyupm_itg3200.floatArray_frompointer _pyupm_itg3200.READ_BUFFER_LENGTH_swigconstant(_pyupm_itg3200) READ_BUFFER_LENGTH = _pyupm_itg3200.READ_BUFFER_LENGTH
[docs]class Itg3200(_object): """ API for the ITG-3200 3-Axis Digital Gyroscope. ID: itg3200 Name: 3-axis Digital Gyroscope Other Names: Grove 3-Axis Digital Gyroscope Category: compass Manufacturer: seeed Connection: i2c Link:http://wiki.seeed.cc/Grove-3-Axis_Digital_Gyro/ InvenSense* ITG-3200 is a 3-axis digital gyroscope. (https://www.sparkfun.com/datasheets/Sensors/Gyro/PS- ITG-3200-00-01.4.pdf) This sensor has been tested and can run at either 3.3V or 5V on Intel(R) Galileo. However, it is incompatible with and not detected on the I2C bus by Intel(R) Edison using the Arduino* breakout board. C++ includes: itg3200.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, Itg3200, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, Itg3200, name) __repr__ = _swig_repr def __init__(self, bus): """ Itg3200(int bus) Creates an Itg3200 object Parameters: ----------- bus: Number of the used I2C bus """ this = _pyupm_itg3200.new_Itg3200(bus) try: self.this.append(this) except Exception: self.this = this
[docs] def calibrate(self): """ void calibrate() Calibrates the sensor to 0 on all axes. The sensor needs to be resting for accurate calibration. It takes about 3 seconds and is also called by the constructor on object creation. """ return _pyupm_itg3200.Itg3200_calibrate(self)
[docs] def getTemperature(self): """ float getTemperature() Returns the temperature reading, in Celsius, from the integrated temperature sensor float Temperature in Celsius """ return _pyupm_itg3200.Itg3200_getTemperature(self)
[docs] def getRotation(self): """ float * getRotation() Returns a pointer to a float[3] that contains computed rotational speeds (angular velocities) float* to a float[3] """ return _pyupm_itg3200.Itg3200_getRotation(self)
[docs] def getRawValues(self): """ int16_t * getRawValues() Returns a pointer to an int[3] that contains raw register values for X, Y, and Z int* to an int[3] """ return _pyupm_itg3200.Itg3200_getRawValues(self)
[docs] def getRawTemp(self): """ int16_t getRawTemp() Returns an int that contains the raw register value for the temperature int Raw temperature """ return _pyupm_itg3200.Itg3200_getRawTemp(self)
[docs] def update(self): """ mraa::Result update() Updates the rotational values and temperature by reading from the I2C bus 0 if successful """ return _pyupm_itg3200.Itg3200_update(self)
__swig_destroy__ = _pyupm_itg3200.delete_Itg3200 __del__ = lambda self: None
Itg3200_swigregister = _pyupm_itg3200.Itg3200_swigregister Itg3200_swigregister(Itg3200) # This file is compatible with both classic and new-style classes.