# 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_adxl345', [dirname(__file__)])
except ImportError:
import _pyupm_adxl345
return _pyupm_adxl345
if fp is not None:
try:
_mod = imp.load_module('_pyupm_adxl345', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_adxl345 = swig_import_helper()
del swig_import_helper
else:
import _pyupm_adxl345
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_adxl345.getVersion()
getVersion = _pyupm_adxl345.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_adxl345.new_int16Array(nelements)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_adxl345.delete_int16Array
__del__ = lambda self: None
def __getitem__(self, index):
return _pyupm_adxl345.int16Array___getitem__(self, index)
def __setitem__(self, index, value):
return _pyupm_adxl345.int16Array___setitem__(self, index, value)
[docs] def cast(self):
return _pyupm_adxl345.int16Array_cast(self)
__swig_getmethods__["frompointer"] = lambda x: _pyupm_adxl345.int16Array_frompointer
if _newclass:
frompointer = staticmethod(_pyupm_adxl345.int16Array_frompointer)
int16Array_swigregister = _pyupm_adxl345.int16Array_swigregister
int16Array_swigregister(int16Array)
def int16Array_frompointer(t):
return _pyupm_adxl345.int16Array_frompointer(t)
int16Array_frompointer = _pyupm_adxl345.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_adxl345.new_floatArray(nelements)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_adxl345.delete_floatArray
__del__ = lambda self: None
def __getitem__(self, index):
return _pyupm_adxl345.floatArray___getitem__(self, index)
def __setitem__(self, index, value):
return _pyupm_adxl345.floatArray___setitem__(self, index, value)
[docs] def cast(self):
return _pyupm_adxl345.floatArray_cast(self)
__swig_getmethods__["frompointer"] = lambda x: _pyupm_adxl345.floatArray_frompointer
if _newclass:
frompointer = staticmethod(_pyupm_adxl345.floatArray_frompointer)
floatArray_swigregister = _pyupm_adxl345.floatArray_swigregister
floatArray_swigregister(floatArray)
def floatArray_frompointer(t):
return _pyupm_adxl345.floatArray_frompointer(t)
floatArray_frompointer = _pyupm_adxl345.floatArray_frompointer
_pyupm_adxl345.READ_BUFFER_LENGTH_swigconstant(_pyupm_adxl345)
READ_BUFFER_LENGTH = _pyupm_adxl345.READ_BUFFER_LENGTH
[docs]class Adxl345(_object):
"""
API for the ADXL345 3-Axis Digital Accelerometer.
ID: adxl345
Name: 3-axis, +/- 2/4/8/16 g Digital Accelerometer
Other Names: Grove 3-Axis Digital Accelerometer (16g)
Category: accelerometer
Manufacturer: seeed
Connection: i2c
Link:http://www.analog.com/media/en/technical-documentation/data-
sheets/ADXL345.pdf ADXL345 is a 3-axis digital accelerometer.
(http://www.seeedstudio.com/wiki/images/2/2c/ADXL345_datasheet.pdf)
The sensor has configurable resolutions to measure +/- 2g, +/- 4g, +/-
8g, or +/- 16g. Note: The Grove* version of the sensor is incompatible
with and not detected on the I2C bus by the Intel(R) Edison using an
Arduino* breakout board at 5V (3V works fine).
C++ includes: adxl345.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Adxl345, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Adxl345, name)
__repr__ = _swig_repr
def __init__(self, bus):
"""
Adxl345(int bus)
Creates an ADXL345 object
Parameters:
-----------
bus: Number of the used I2C bus
"""
this = _pyupm_adxl345.new_Adxl345(bus)
try:
self.this.append(this)
except Exception:
self.this = this
[docs] def getAcceleration(self):
"""
float *
getAcceleration()
there is no need for a ADXL345 object destructor ~Adxl345(); Returns a
pointer to a float[3] that contains acceleration (g) forces
float* to a float[3]
"""
return _pyupm_adxl345.Adxl345_getAcceleration(self)
[docs] def getRawValues(self):
"""
int16_t *
getRawValues()
Returns a pointer to an int[3] that contains the raw register values
for X, Y, and Z
int* to an int[3]
"""
return _pyupm_adxl345.Adxl345_getRawValues(self)
[docs] def getScale(self):
"""
uint8_t getScale()
Returns the scale the accelerometer is currently set up to: 2, 4, 8,
or 16
uint with the current scale value
"""
return _pyupm_adxl345.Adxl345_getScale(self)
[docs] def update(self):
"""
mraa::Result update()
Updates the acceleration values from the I2C bus
0 if successful
"""
return _pyupm_adxl345.Adxl345_update(self)
__swig_destroy__ = _pyupm_adxl345.delete_Adxl345
__del__ = lambda self: None
Adxl345_swigregister = _pyupm_adxl345.Adxl345_swigregister
Adxl345_swigregister(Adxl345)
# This file is compatible with both classic and new-style classes.