# 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.
"""Python interface to libmraa"""
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('_mraa', [dirname(__file__)])
except ImportError:
import _mraa
return _mraa
if fp is not None:
try:
_mod = imp.load_module('_mraa', fp, pathname, description)
finally:
fp.close()
return _mod
_mraa = swig_import_helper()
del swig_import_helper
else:
import _mraa
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
class uint8Array(_object):
"""Proxy of C++ uint8Array class."""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, uint8Array, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, uint8Array, name)
__repr__ = _swig_repr
def __init__(self, nelements):
"""
__init__(uint8Array self, size_t nelements) -> uint8Array
Parameters
----------
nelements: size_t
"""
this = _mraa.new_uint8Array(nelements)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _mraa.delete_uint8Array
__del__ = lambda self: None
def __getitem__(self, index):
"""
__getitem__(uint8Array self, size_t index) -> uint8_t
Parameters
----------
index: size_t
"""
return _mraa.uint8Array___getitem__(self, index)
def __setitem__(self, index, value):
"""
__setitem__(uint8Array self, size_t index, uint8_t value)
Parameters
----------
index: size_t
value: uint8_t
"""
return _mraa.uint8Array___setitem__(self, index, value)
def cast(self):
"""
cast(uint8Array self) -> uint8_t *
Parameters
----------
self: uint8Array *
"""
return _mraa.uint8Array_cast(self)
def frompointer(t):
"""
frompointer(uint8_t * t) -> uint8Array
Parameters
----------
t: uint8_t *
"""
return _mraa.uint8Array_frompointer(t)
if _newclass:
frompointer = staticmethod(frompointer)
__swig_getmethods__["frompointer"] = lambda x: frompointer
uint8Array_swigregister = _mraa.uint8Array_swigregister
uint8Array_swigregister(uint8Array)
def uint8Array_frompointer(t):
"""
uint8Array_frompointer(uint8_t * t) -> uint8Array
Parameters
----------
t: uint8_t *
"""
return _mraa.uint8Array_frompointer(t)
_mraa.INTEL_GALILEO_GEN1_swigconstant(_mraa)
INTEL_GALILEO_GEN1 = _mraa.INTEL_GALILEO_GEN1
_mraa.INTEL_GALILEO_GEN2_swigconstant(_mraa)
INTEL_GALILEO_GEN2 = _mraa.INTEL_GALILEO_GEN2
_mraa.INTEL_EDISON_FAB_C_swigconstant(_mraa)
INTEL_EDISON_FAB_C = _mraa.INTEL_EDISON_FAB_C
_mraa.INTEL_DE3815_swigconstant(_mraa)
INTEL_DE3815 = _mraa.INTEL_DE3815
_mraa.INTEL_MINNOWBOARD_MAX_swigconstant(_mraa)
INTEL_MINNOWBOARD_MAX = _mraa.INTEL_MINNOWBOARD_MAX
_mraa.RASPBERRY_PI_swigconstant(_mraa)
RASPBERRY_PI = _mraa.RASPBERRY_PI
_mraa.BEAGLEBONE_swigconstant(_mraa)
BEAGLEBONE = _mraa.BEAGLEBONE
_mraa.BANANA_swigconstant(_mraa)
BANANA = _mraa.BANANA
_mraa.INTEL_NUC5_swigconstant(_mraa)
INTEL_NUC5 = _mraa.INTEL_NUC5
_mraa.A96BOARDS_swigconstant(_mraa)
A96BOARDS = _mraa.A96BOARDS
_mraa.INTEL_SOFIA_3GR_swigconstant(_mraa)
INTEL_SOFIA_3GR = _mraa.INTEL_SOFIA_3GR
_mraa.INTEL_CHERRYHILLS_swigconstant(_mraa)
INTEL_CHERRYHILLS = _mraa.INTEL_CHERRYHILLS
_mraa.FTDI_FT4222_swigconstant(_mraa)
FTDI_FT4222 = _mraa.FTDI_FT4222
_mraa.GENERIC_FIRMATA_swigconstant(_mraa)
GENERIC_FIRMATA = _mraa.GENERIC_FIRMATA
_mraa.NULL_PLATFORM_swigconstant(_mraa)
NULL_PLATFORM = _mraa.NULL_PLATFORM
_mraa.UNKNOWN_PLATFORM_swigconstant(_mraa)
UNKNOWN_PLATFORM = _mraa.UNKNOWN_PLATFORM
_mraa.INTEL_EDISON_MINIBOARD_J17_1_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J17_1 = _mraa.INTEL_EDISON_MINIBOARD_J17_1
_mraa.INTEL_EDISON_MINIBOARD_J17_5_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J17_5 = _mraa.INTEL_EDISON_MINIBOARD_J17_5
_mraa.INTEL_EDISON_MINIBOARD_J17_7_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J17_7 = _mraa.INTEL_EDISON_MINIBOARD_J17_7
_mraa.INTEL_EDISON_MINIBOARD_J17_8_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J17_8 = _mraa.INTEL_EDISON_MINIBOARD_J17_8
_mraa.INTEL_EDISON_MINIBOARD_J17_9_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J17_9 = _mraa.INTEL_EDISON_MINIBOARD_J17_9
_mraa.INTEL_EDISON_MINIBOARD_J17_10_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J17_10 = _mraa.INTEL_EDISON_MINIBOARD_J17_10
_mraa.INTEL_EDISON_MINIBOARD_J17_11_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J17_11 = _mraa.INTEL_EDISON_MINIBOARD_J17_11
_mraa.INTEL_EDISON_MINIBOARD_J17_12_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J17_12 = _mraa.INTEL_EDISON_MINIBOARD_J17_12
_mraa.INTEL_EDISON_MINIBOARD_J17_14_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J17_14 = _mraa.INTEL_EDISON_MINIBOARD_J17_14
_mraa.INTEL_EDISON_MINIBOARD_J18_1_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J18_1 = _mraa.INTEL_EDISON_MINIBOARD_J18_1
_mraa.INTEL_EDISON_MINIBOARD_J18_2_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J18_2 = _mraa.INTEL_EDISON_MINIBOARD_J18_2
_mraa.INTEL_EDISON_MINIBOARD_J18_6_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J18_6 = _mraa.INTEL_EDISON_MINIBOARD_J18_6
_mraa.INTEL_EDISON_MINIBOARD_J18_7_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J18_7 = _mraa.INTEL_EDISON_MINIBOARD_J18_7
_mraa.INTEL_EDISON_MINIBOARD_J18_8_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J18_8 = _mraa.INTEL_EDISON_MINIBOARD_J18_8
_mraa.INTEL_EDISON_MINIBOARD_J18_10_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J18_10 = _mraa.INTEL_EDISON_MINIBOARD_J18_10
_mraa.INTEL_EDISON_MINIBOARD_J18_11_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J18_11 = _mraa.INTEL_EDISON_MINIBOARD_J18_11
_mraa.INTEL_EDISON_MINIBOARD_J18_12_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J18_12 = _mraa.INTEL_EDISON_MINIBOARD_J18_12
_mraa.INTEL_EDISON_MINIBOARD_J18_13_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J18_13 = _mraa.INTEL_EDISON_MINIBOARD_J18_13
_mraa.INTEL_EDISON_MINIBOARD_J19_4_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_4 = _mraa.INTEL_EDISON_MINIBOARD_J19_4
_mraa.INTEL_EDISON_MINIBOARD_J19_5_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_5 = _mraa.INTEL_EDISON_MINIBOARD_J19_5
_mraa.INTEL_EDISON_MINIBOARD_J19_6_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_6 = _mraa.INTEL_EDISON_MINIBOARD_J19_6
_mraa.INTEL_EDISON_MINIBOARD_J19_8_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_8 = _mraa.INTEL_EDISON_MINIBOARD_J19_8
_mraa.INTEL_EDISON_MINIBOARD_J19_9_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_9 = _mraa.INTEL_EDISON_MINIBOARD_J19_9
_mraa.INTEL_EDISON_MINIBOARD_J19_10_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_10 = _mraa.INTEL_EDISON_MINIBOARD_J19_10
_mraa.INTEL_EDISON_MINIBOARD_J19_11_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_11 = _mraa.INTEL_EDISON_MINIBOARD_J19_11
_mraa.INTEL_EDISON_MINIBOARD_J19_12_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_12 = _mraa.INTEL_EDISON_MINIBOARD_J19_12
_mraa.INTEL_EDISON_MINIBOARD_J19_13_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_13 = _mraa.INTEL_EDISON_MINIBOARD_J19_13
_mraa.INTEL_EDISON_MINIBOARD_J19_14_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J19_14 = _mraa.INTEL_EDISON_MINIBOARD_J19_14
_mraa.INTEL_EDISON_MINIBOARD_J20_3_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_3 = _mraa.INTEL_EDISON_MINIBOARD_J20_3
_mraa.INTEL_EDISON_MINIBOARD_J20_4_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_4 = _mraa.INTEL_EDISON_MINIBOARD_J20_4
_mraa.INTEL_EDISON_MINIBOARD_J20_5_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_5 = _mraa.INTEL_EDISON_MINIBOARD_J20_5
_mraa.INTEL_EDISON_MINIBOARD_J20_6_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_6 = _mraa.INTEL_EDISON_MINIBOARD_J20_6
_mraa.INTEL_EDISON_MINIBOARD_J20_7_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_7 = _mraa.INTEL_EDISON_MINIBOARD_J20_7
_mraa.INTEL_EDISON_MINIBOARD_J20_8_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_8 = _mraa.INTEL_EDISON_MINIBOARD_J20_8
_mraa.INTEL_EDISON_MINIBOARD_J20_9_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_9 = _mraa.INTEL_EDISON_MINIBOARD_J20_9
_mraa.INTEL_EDISON_MINIBOARD_J20_10_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_10 = _mraa.INTEL_EDISON_MINIBOARD_J20_10
_mraa.INTEL_EDISON_MINIBOARD_J20_11_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_11 = _mraa.INTEL_EDISON_MINIBOARD_J20_11
_mraa.INTEL_EDISON_MINIBOARD_J20_12_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_12 = _mraa.INTEL_EDISON_MINIBOARD_J20_12
_mraa.INTEL_EDISON_MINIBOARD_J20_13_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_13 = _mraa.INTEL_EDISON_MINIBOARD_J20_13
_mraa.INTEL_EDISON_MINIBOARD_J20_14_swigconstant(_mraa)
INTEL_EDISON_MINIBOARD_J20_14 = _mraa.INTEL_EDISON_MINIBOARD_J20_14
_mraa.INTEL_EDISON_GP182_swigconstant(_mraa)
INTEL_EDISON_GP182 = _mraa.INTEL_EDISON_GP182
_mraa.INTEL_EDISON_GP135_swigconstant(_mraa)
INTEL_EDISON_GP135 = _mraa.INTEL_EDISON_GP135
_mraa.INTEL_EDISON_GP27_swigconstant(_mraa)
INTEL_EDISON_GP27 = _mraa.INTEL_EDISON_GP27
_mraa.INTEL_EDISON_GP20_swigconstant(_mraa)
INTEL_EDISON_GP20 = _mraa.INTEL_EDISON_GP20
_mraa.INTEL_EDISON_GP28_swigconstant(_mraa)
INTEL_EDISON_GP28 = _mraa.INTEL_EDISON_GP28
_mraa.INTEL_EDISON_GP111_swigconstant(_mraa)
INTEL_EDISON_GP111 = _mraa.INTEL_EDISON_GP111
_mraa.INTEL_EDISON_GP109_swigconstant(_mraa)
INTEL_EDISON_GP109 = _mraa.INTEL_EDISON_GP109
_mraa.INTEL_EDISON_GP115_swigconstant(_mraa)
INTEL_EDISON_GP115 = _mraa.INTEL_EDISON_GP115
_mraa.INTEL_EDISON_GP128_swigconstant(_mraa)
INTEL_EDISON_GP128 = _mraa.INTEL_EDISON_GP128
_mraa.INTEL_EDISON_GP13_swigconstant(_mraa)
INTEL_EDISON_GP13 = _mraa.INTEL_EDISON_GP13
_mraa.INTEL_EDISON_GP165_swigconstant(_mraa)
INTEL_EDISON_GP165 = _mraa.INTEL_EDISON_GP165
_mraa.INTEL_EDISON_GP19_swigconstant(_mraa)
INTEL_EDISON_GP19 = _mraa.INTEL_EDISON_GP19
_mraa.INTEL_EDISON_GP12_swigconstant(_mraa)
INTEL_EDISON_GP12 = _mraa.INTEL_EDISON_GP12
_mraa.INTEL_EDISON_GP183_swigconstant(_mraa)
INTEL_EDISON_GP183 = _mraa.INTEL_EDISON_GP183
_mraa.INTEL_EDISON_GP110_swigconstant(_mraa)
INTEL_EDISON_GP110 = _mraa.INTEL_EDISON_GP110
_mraa.INTEL_EDISON_GP114_swigconstant(_mraa)
INTEL_EDISON_GP114 = _mraa.INTEL_EDISON_GP114
_mraa.INTEL_EDISON_GP129_swigconstant(_mraa)
INTEL_EDISON_GP129 = _mraa.INTEL_EDISON_GP129
_mraa.INTEL_EDISON_GP130_swigconstant(_mraa)
INTEL_EDISON_GP130 = _mraa.INTEL_EDISON_GP130
_mraa.INTEL_EDISON_GP44_swigconstant(_mraa)
INTEL_EDISON_GP44 = _mraa.INTEL_EDISON_GP44
_mraa.INTEL_EDISON_GP46_swigconstant(_mraa)
INTEL_EDISON_GP46 = _mraa.INTEL_EDISON_GP46
_mraa.INTEL_EDISON_GP48_swigconstant(_mraa)
INTEL_EDISON_GP48 = _mraa.INTEL_EDISON_GP48
_mraa.INTEL_EDISON_GP131_swigconstant(_mraa)
INTEL_EDISON_GP131 = _mraa.INTEL_EDISON_GP131
_mraa.INTEL_EDISON_GP14_swigconstant(_mraa)
INTEL_EDISON_GP14 = _mraa.INTEL_EDISON_GP14
_mraa.INTEL_EDISON_GP40_swigconstant(_mraa)
INTEL_EDISON_GP40 = _mraa.INTEL_EDISON_GP40
_mraa.INTEL_EDISON_GP43_swigconstant(_mraa)
INTEL_EDISON_GP43 = _mraa.INTEL_EDISON_GP43
_mraa.INTEL_EDISON_GP77_swigconstant(_mraa)
INTEL_EDISON_GP77 = _mraa.INTEL_EDISON_GP77
_mraa.INTEL_EDISON_GP82_swigconstant(_mraa)
INTEL_EDISON_GP82 = _mraa.INTEL_EDISON_GP82
_mraa.INTEL_EDISON_GP83_swigconstant(_mraa)
INTEL_EDISON_GP83 = _mraa.INTEL_EDISON_GP83
_mraa.INTEL_EDISON_GP134_swigconstant(_mraa)
INTEL_EDISON_GP134 = _mraa.INTEL_EDISON_GP134
_mraa.INTEL_EDISON_GP45_swigconstant(_mraa)
INTEL_EDISON_GP45 = _mraa.INTEL_EDISON_GP45
_mraa.INTEL_EDISON_GP47_swigconstant(_mraa)
INTEL_EDISON_GP47 = _mraa.INTEL_EDISON_GP47
_mraa.INTEL_EDISON_GP49_swigconstant(_mraa)
INTEL_EDISON_GP49 = _mraa.INTEL_EDISON_GP49
_mraa.INTEL_EDISON_GP15_swigconstant(_mraa)
INTEL_EDISON_GP15 = _mraa.INTEL_EDISON_GP15
_mraa.INTEL_EDISON_GP84_swigconstant(_mraa)
INTEL_EDISON_GP84 = _mraa.INTEL_EDISON_GP84
_mraa.INTEL_EDISON_GP42_swigconstant(_mraa)
INTEL_EDISON_GP42 = _mraa.INTEL_EDISON_GP42
_mraa.INTEL_EDISON_GP41_swigconstant(_mraa)
INTEL_EDISON_GP41 = _mraa.INTEL_EDISON_GP41
_mraa.INTEL_EDISON_GP78_swigconstant(_mraa)
INTEL_EDISON_GP78 = _mraa.INTEL_EDISON_GP78
_mraa.INTEL_EDISON_GP79_swigconstant(_mraa)
INTEL_EDISON_GP79 = _mraa.INTEL_EDISON_GP79
_mraa.INTEL_EDISON_GP80_swigconstant(_mraa)
INTEL_EDISON_GP80 = _mraa.INTEL_EDISON_GP80
_mraa.INTEL_EDISON_GP81_swigconstant(_mraa)
INTEL_EDISON_GP81 = _mraa.INTEL_EDISON_GP81
_mraa.RASPBERRY_WIRING_PIN8_swigconstant(_mraa)
RASPBERRY_WIRING_PIN8 = _mraa.RASPBERRY_WIRING_PIN8
_mraa.RASPBERRY_WIRING_PIN9_swigconstant(_mraa)
RASPBERRY_WIRING_PIN9 = _mraa.RASPBERRY_WIRING_PIN9
_mraa.RASPBERRY_WIRING_PIN7_swigconstant(_mraa)
RASPBERRY_WIRING_PIN7 = _mraa.RASPBERRY_WIRING_PIN7
_mraa.RASPBERRY_WIRING_PIN15_swigconstant(_mraa)
RASPBERRY_WIRING_PIN15 = _mraa.RASPBERRY_WIRING_PIN15
_mraa.RASPBERRY_WIRING_PIN16_swigconstant(_mraa)
RASPBERRY_WIRING_PIN16 = _mraa.RASPBERRY_WIRING_PIN16
_mraa.RASPBERRY_WIRING_PIN0_swigconstant(_mraa)
RASPBERRY_WIRING_PIN0 = _mraa.RASPBERRY_WIRING_PIN0
_mraa.RASPBERRY_WIRING_PIN1_swigconstant(_mraa)
RASPBERRY_WIRING_PIN1 = _mraa.RASPBERRY_WIRING_PIN1
_mraa.RASPBERRY_WIRING_PIN2_swigconstant(_mraa)
RASPBERRY_WIRING_PIN2 = _mraa.RASPBERRY_WIRING_PIN2
_mraa.RASPBERRY_WIRING_PIN3_swigconstant(_mraa)
RASPBERRY_WIRING_PIN3 = _mraa.RASPBERRY_WIRING_PIN3
_mraa.RASPBERRY_WIRING_PIN4_swigconstant(_mraa)
RASPBERRY_WIRING_PIN4 = _mraa.RASPBERRY_WIRING_PIN4
_mraa.RASPBERRY_WIRING_PIN5_swigconstant(_mraa)
RASPBERRY_WIRING_PIN5 = _mraa.RASPBERRY_WIRING_PIN5
_mraa.RASPBERRY_WIRING_PIN12_swigconstant(_mraa)
RASPBERRY_WIRING_PIN12 = _mraa.RASPBERRY_WIRING_PIN12
_mraa.RASPBERRY_WIRING_PIN13_swigconstant(_mraa)
RASPBERRY_WIRING_PIN13 = _mraa.RASPBERRY_WIRING_PIN13
_mraa.RASPBERRY_WIRING_PIN6_swigconstant(_mraa)
RASPBERRY_WIRING_PIN6 = _mraa.RASPBERRY_WIRING_PIN6
_mraa.RASPBERRY_WIRING_PIN14_swigconstant(_mraa)
RASPBERRY_WIRING_PIN14 = _mraa.RASPBERRY_WIRING_PIN14
_mraa.RASPBERRY_WIRING_PIN10_swigconstant(_mraa)
RASPBERRY_WIRING_PIN10 = _mraa.RASPBERRY_WIRING_PIN10
_mraa.RASPBERRY_WIRING_PIN11_swigconstant(_mraa)
RASPBERRY_WIRING_PIN11 = _mraa.RASPBERRY_WIRING_PIN11
_mraa.RASPBERRY_WIRING_PIN17_swigconstant(_mraa)
RASPBERRY_WIRING_PIN17 = _mraa.RASPBERRY_WIRING_PIN17
_mraa.RASPBERRY_WIRING_PIN21_swigconstant(_mraa)
RASPBERRY_WIRING_PIN21 = _mraa.RASPBERRY_WIRING_PIN21
_mraa.RASPBERRY_WIRING_PIN18_swigconstant(_mraa)
RASPBERRY_WIRING_PIN18 = _mraa.RASPBERRY_WIRING_PIN18
_mraa.RASPBERRY_WIRING_PIN19_swigconstant(_mraa)
RASPBERRY_WIRING_PIN19 = _mraa.RASPBERRY_WIRING_PIN19
_mraa.RASPBERRY_WIRING_PIN22_swigconstant(_mraa)
RASPBERRY_WIRING_PIN22 = _mraa.RASPBERRY_WIRING_PIN22
_mraa.RASPBERRY_WIRING_PIN20_swigconstant(_mraa)
RASPBERRY_WIRING_PIN20 = _mraa.RASPBERRY_WIRING_PIN20
_mraa.RASPBERRY_WIRING_PIN26_swigconstant(_mraa)
RASPBERRY_WIRING_PIN26 = _mraa.RASPBERRY_WIRING_PIN26
_mraa.RASPBERRY_WIRING_PIN23_swigconstant(_mraa)
RASPBERRY_WIRING_PIN23 = _mraa.RASPBERRY_WIRING_PIN23
_mraa.RASPBERRY_WIRING_PIN24_swigconstant(_mraa)
RASPBERRY_WIRING_PIN24 = _mraa.RASPBERRY_WIRING_PIN24
_mraa.RASPBERRY_WIRING_PIN27_swigconstant(_mraa)
RASPBERRY_WIRING_PIN27 = _mraa.RASPBERRY_WIRING_PIN27
_mraa.RASPBERRY_WIRING_PIN25_swigconstant(_mraa)
RASPBERRY_WIRING_PIN25 = _mraa.RASPBERRY_WIRING_PIN25
_mraa.RASPBERRY_WIRING_PIN28_swigconstant(_mraa)
RASPBERRY_WIRING_PIN28 = _mraa.RASPBERRY_WIRING_PIN28
_mraa.RASPBERRY_WIRING_PIN29_swigconstant(_mraa)
RASPBERRY_WIRING_PIN29 = _mraa.RASPBERRY_WIRING_PIN29
_mraa.SUCCESS_swigconstant(_mraa)
SUCCESS = _mraa.SUCCESS
_mraa.ERROR_FEATURE_NOT_IMPLEMENTED_swigconstant(_mraa)
ERROR_FEATURE_NOT_IMPLEMENTED = _mraa.ERROR_FEATURE_NOT_IMPLEMENTED
_mraa.ERROR_FEATURE_NOT_SUPPORTED_swigconstant(_mraa)
ERROR_FEATURE_NOT_SUPPORTED = _mraa.ERROR_FEATURE_NOT_SUPPORTED
_mraa.ERROR_INVALID_VERBOSITY_LEVEL_swigconstant(_mraa)
ERROR_INVALID_VERBOSITY_LEVEL = _mraa.ERROR_INVALID_VERBOSITY_LEVEL
_mraa.ERROR_INVALID_PARAMETER_swigconstant(_mraa)
ERROR_INVALID_PARAMETER = _mraa.ERROR_INVALID_PARAMETER
_mraa.ERROR_INVALID_HANDLE_swigconstant(_mraa)
ERROR_INVALID_HANDLE = _mraa.ERROR_INVALID_HANDLE
_mraa.ERROR_NO_RESOURCES_swigconstant(_mraa)
ERROR_NO_RESOURCES = _mraa.ERROR_NO_RESOURCES
_mraa.ERROR_INVALID_RESOURCE_swigconstant(_mraa)
ERROR_INVALID_RESOURCE = _mraa.ERROR_INVALID_RESOURCE
_mraa.ERROR_INVALID_QUEUE_TYPE_swigconstant(_mraa)
ERROR_INVALID_QUEUE_TYPE = _mraa.ERROR_INVALID_QUEUE_TYPE
_mraa.ERROR_NO_DATA_AVAILABLE_swigconstant(_mraa)
ERROR_NO_DATA_AVAILABLE = _mraa.ERROR_NO_DATA_AVAILABLE
_mraa.ERROR_INVALID_PLATFORM_swigconstant(_mraa)
ERROR_INVALID_PLATFORM = _mraa.ERROR_INVALID_PLATFORM
_mraa.ERROR_PLATFORM_NOT_INITIALISED_swigconstant(_mraa)
ERROR_PLATFORM_NOT_INITIALISED = _mraa.ERROR_PLATFORM_NOT_INITIALISED
_mraa.ERROR_UART_OW_SHORTED_swigconstant(_mraa)
ERROR_UART_OW_SHORTED = _mraa.ERROR_UART_OW_SHORTED
_mraa.ERROR_UART_OW_NO_DEVICES_swigconstant(_mraa)
ERROR_UART_OW_NO_DEVICES = _mraa.ERROR_UART_OW_NO_DEVICES
_mraa.ERROR_UART_OW_DATA_ERROR_swigconstant(_mraa)
ERROR_UART_OW_DATA_ERROR = _mraa.ERROR_UART_OW_DATA_ERROR
_mraa.ERROR_UNSPECIFIED_swigconstant(_mraa)
ERROR_UNSPECIFIED = _mraa.ERROR_UNSPECIFIED
_mraa.PIN_VALID_swigconstant(_mraa)
PIN_VALID = _mraa.PIN_VALID
_mraa.PIN_GPIO_swigconstant(_mraa)
PIN_GPIO = _mraa.PIN_GPIO
_mraa.PIN_PWM_swigconstant(_mraa)
PIN_PWM = _mraa.PIN_PWM
_mraa.PIN_FAST_GPIO_swigconstant(_mraa)
PIN_FAST_GPIO = _mraa.PIN_FAST_GPIO
_mraa.PIN_SPI_swigconstant(_mraa)
PIN_SPI = _mraa.PIN_SPI
_mraa.PIN_I2C_swigconstant(_mraa)
PIN_I2C = _mraa.PIN_I2C
_mraa.PIN_AIO_swigconstant(_mraa)
PIN_AIO = _mraa.PIN_AIO
_mraa.PIN_UART_swigconstant(_mraa)
PIN_UART = _mraa.PIN_UART
_mraa.I2C_STD_swigconstant(_mraa)
I2C_STD = _mraa.I2C_STD
_mraa.I2C_FAST_swigconstant(_mraa)
I2C_FAST = _mraa.I2C_FAST
_mraa.I2C_HIGH_swigconstant(_mraa)
I2C_HIGH = _mraa.I2C_HIGH
_mraa.UART_PARITY_NONE_swigconstant(_mraa)
UART_PARITY_NONE = _mraa.UART_PARITY_NONE
_mraa.UART_PARITY_EVEN_swigconstant(_mraa)
UART_PARITY_EVEN = _mraa.UART_PARITY_EVEN
_mraa.UART_PARITY_ODD_swigconstant(_mraa)
UART_PARITY_ODD = _mraa.UART_PARITY_ODD
_mraa.UART_PARITY_MARK_swigconstant(_mraa)
UART_PARITY_MARK = _mraa.UART_PARITY_MARK
_mraa.UART_PARITY_SPACE_swigconstant(_mraa)
UART_PARITY_SPACE = _mraa.UART_PARITY_SPACE
[docs]def init():
"""init() -> mraa::Result"""
return _mraa.init()
[docs]def getVersion():
"""getVersion() -> std::string"""
return _mraa.getVersion()
[docs]def setPriority(priority):
"""
setPriority(unsigned int const priority) -> int
Parameters
----------
priority: unsigned int const
"""
return _mraa.setPriority(priority)
[docs]def printError(result):
"""
printError(mraa::Result result)
Parameters
----------
result: enum mraa::Result
"""
return _mraa.printError(result)
[docs]def pinModeTest(pin, mode):
"""
pinModeTest(int pin, mraa::Pinmodes mode) -> bool
Parameters
----------
pin: int
mode: enum mraa::Pinmodes
"""
return _mraa.pinModeTest(pin, mode)
[docs]def adcRawBits():
"""adcRawBits() -> unsigned int"""
return _mraa.adcRawBits()
[docs]def adcSupportedBits():
"""adcSupportedBits() -> unsigned int"""
return _mraa.adcSupportedBits()
[docs]def getPinCount():
"""getPinCount() -> unsigned int"""
return _mraa.getPinCount()
[docs]def getI2cBusCount():
"""getI2cBusCount() -> int"""
return _mraa.getI2cBusCount()
[docs]def getI2cBusId(i2c_bus):
"""
getI2cBusId(unsigned int i2c_bus) -> int
Parameters
----------
i2c_bus: unsigned int
"""
return _mraa.getI2cBusId(i2c_bus)
[docs]def getPinName(pin):
"""
getPinName(int pin) -> std::string
Parameters
----------
pin: int
"""
return _mraa.getPinName(pin)
[docs]def setLogLevel(level):
"""
setLogLevel(int level) -> mraa::Result
Parameters
----------
level: int
"""
return _mraa.setLogLevel(level)
[docs]def getDefaultI2cBus(*args):
"""
getDefaultI2cBus(int platform_offset) -> int
Parameters
----------
platform_offset: int
getDefaultI2cBus() -> int
"""
return _mraa.getDefaultI2cBus(*args)
_mraa.MODE_STRONG_swigconstant(_mraa)
MODE_STRONG = _mraa.MODE_STRONG
_mraa.MODE_PULLUP_swigconstant(_mraa)
MODE_PULLUP = _mraa.MODE_PULLUP
_mraa.MODE_PULLDOWN_swigconstant(_mraa)
MODE_PULLDOWN = _mraa.MODE_PULLDOWN
_mraa.MODE_HIZ_swigconstant(_mraa)
MODE_HIZ = _mraa.MODE_HIZ
_mraa.DIR_OUT_swigconstant(_mraa)
DIR_OUT = _mraa.DIR_OUT
_mraa.DIR_IN_swigconstant(_mraa)
DIR_IN = _mraa.DIR_IN
_mraa.DIR_OUT_HIGH_swigconstant(_mraa)
DIR_OUT_HIGH = _mraa.DIR_OUT_HIGH
_mraa.DIR_OUT_LOW_swigconstant(_mraa)
DIR_OUT_LOW = _mraa.DIR_OUT_LOW
_mraa.EDGE_NONE_swigconstant(_mraa)
EDGE_NONE = _mraa.EDGE_NONE
_mraa.EDGE_BOTH_swigconstant(_mraa)
EDGE_BOTH = _mraa.EDGE_BOTH
_mraa.EDGE_RISING_swigconstant(_mraa)
EDGE_RISING = _mraa.EDGE_RISING
_mraa.EDGE_FALLING_swigconstant(_mraa)
EDGE_FALLING = _mraa.EDGE_FALLING
[docs]class Gpio(_object):
"""
API to General Purpose IO.
This file defines the gpio interface for libmraa
C++ includes: gpio.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Gpio, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Gpio, name)
__repr__ = _swig_repr
def __init__(self, pin, owner=True, raw=False):
"""
__init__(mraa::Gpio self, int pin, bool owner=True, bool raw=False) -> Gpio
Parameters
----------
pin: int
owner: bool
raw: bool
__init__(mraa::Gpio self, int pin, bool owner=True) -> Gpio
Parameters
----------
pin: int
owner: bool
__init__(mraa::Gpio self, int pin) -> Gpio
Parameters
----------
pin: int
Instantiates a Gpio object
Parameters:
-----------
pin: pin number to use
owner: (optional) Set pin owner, default behaviour is to 'own' the
pin if we exported it. This means we will close it on destruct.
Otherwise it will get left open. This is only valid in sysfs use cases
raw: (optional) Raw pins will use gpiolibs pin numbering from the
kernel module. Note that you will not get any muxers set up for you so
this may not always work as expected.
"""
this = _mraa.new_Gpio(pin, owner, raw)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _mraa.delete_Gpio
__del__ = lambda self: None
[docs] def edge(self, mode):
"""
edge(Gpio self, mraa::Edge mode) -> mraa::Result
Parameters
----------
mode: enum mraa::Edge
Set the edge mode for ISR
Parameters:
-----------
mode: The edge mode to set
Result of operation
"""
return _mraa.Gpio_edge(self, mode)
[docs] def isr(self, mode, pyfunc, args):
"""
isr(Gpio self, mraa::Edge mode, PyObject * pyfunc, PyObject * args) -> mraa::Result
Parameters
----------
mode: enum mraa::Edge
pyfunc: PyObject *
args: PyObject *
Sets a callback to be called when pin value changes
Parameters:
-----------
mode: The edge mode to set
fptr: Function pointer to function to be called when interrupt is
triggered
args: Arguments passed to the interrupt handler (fptr)
Result of operation
"""
return _mraa.Gpio_isr(self, mode, pyfunc, args)
[docs] def isrExit(self):
"""
isrExit(Gpio self) -> mraa::Result
Parameters
----------
self: mraa::Gpio *
Exits callback - this call will not kill the isr thread immediately
but only when it is out of it's critical section
Result of operation
"""
return _mraa.Gpio_isrExit(self)
[docs] def mode(self, mode):
"""
mode(Gpio self, mraa::Mode mode) -> mraa::Result
Parameters
----------
mode: enum mraa::Mode
Change Gpio mode
Parameters:
-----------
mode: The mode to change the gpio into
Result of operation
"""
return _mraa.Gpio_mode(self, mode)
[docs] def dir(self, dir):
"""
dir(Gpio self, mraa::Dir dir) -> mraa::Result
Parameters
----------
dir: enum mraa::Dir
Change Gpio direction
Parameters:
-----------
dir: The direction to change the gpio into
Result of operation
"""
return _mraa.Gpio_dir(self, dir)
[docs] def readDir(self):
"""
readDir(Gpio self) -> mraa::Dir
Parameters
----------
self: mraa::Gpio *
Read Gpio direction
Exceptions:
-----------
std::runtime_error: in case of failure
Result of operation
"""
return _mraa.Gpio_readDir(self)
[docs] def read(self):
"""
read(Gpio self) -> int
Parameters
----------
self: mraa::Gpio *
Read value from Gpio
Gpio value
"""
return _mraa.Gpio_read(self)
[docs] def write(self, value):
"""
write(Gpio self, int value) -> mraa::Result
Parameters
----------
value: int
Write value to Gpio
Parameters:
-----------
value: Value to write to Gpio
Result of operation
"""
return _mraa.Gpio_write(self, value)
[docs] def useMmap(self, enable):
"""
useMmap(Gpio self, bool enable) -> mraa::Result
Parameters
----------
enable: bool
Enable use of mmap i/o if available.
Parameters:
-----------
enable: true to use mmap
Result of operation
"""
return _mraa.Gpio_useMmap(self, enable)
[docs] def getPin(self, raw=False):
"""
getPin(Gpio self, bool raw=False) -> int
Parameters
----------
raw: bool
getPin(Gpio self) -> int
Parameters
----------
self: mraa::Gpio *
Get pin number of Gpio. If raw param is True will return the number as
used within sysfs. Invalid will return -1.
Parameters:
-----------
raw: (optional) get the raw gpio number.
Pin number
"""
return _mraa.Gpio_getPin(self, raw)
Gpio_swigregister = _mraa.Gpio_swigregister
Gpio_swigregister(Gpio)
[docs]class I2c(_object):
"""
API to Inter-Integrated Circuit.
An I2c object represents an i2c master and can talk multiple i2c
slaves by selecting the correct addressIt is considered best practice
to make sure the address is correct before doing any calls on i2c, in
case another application or even thread changed the addres on that
bus. Multiple instances of the same bus can exist.
C++ includes: i2c.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, I2c, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, I2c, name)
__repr__ = _swig_repr
def __init__(self, bus, raw=False):
"""
__init__(mraa::I2c self, int bus, bool raw=False) -> I2c
Parameters
----------
bus: int
raw: bool
__init__(mraa::I2c self, int bus) -> I2c
Parameters
----------
bus: int
Instantiates an i2c bus. Multiple instances of the same bus can exist
and the bus is not guarranteed to be on the correct address before
read/write.
Parameters:
-----------
bus: The i2c bus to use
raw: Whether to disable pinmapper for your board
"""
this = _mraa.new_I2c(bus, raw)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _mraa.delete_I2c
__del__ = lambda self: None
[docs] def frequency(self, mode):
"""
frequency(I2c self, mraa::I2cMode mode) -> mraa::Result
Parameters
----------
mode: enum mraa::I2cMode
Sets the i2c Frequency for communication. Your board may not support
the set frequency. Anyone can change this at any time and this will
affect every slave on the bus
Parameters:
-----------
mode: Frequency to set the bus to
Result of operation
"""
return _mraa.I2c_frequency(self, mode)
[docs] def address(self, address):
"""
address(I2c self, uint8_t address) -> mraa::Result
Parameters
----------
address: uint8_t
Set the slave to talk to, typically called before every read/write
operation
Parameters:
-----------
address: Communicate to the i2c slave on this address
Result of operation
"""
return _mraa.I2c_address(self, address)
[docs] def readByte(self):
"""
readByte(I2c self) -> uint8_t
Parameters
----------
self: mraa::I2c *
Read exactly one byte from the bus
Exceptions:
-----------
std::invalid_argument: in case of error
char read from the bus
"""
return _mraa.I2c_readByte(self)
[docs] def read(self, data):
"""
read(I2c self, uint8_t * data) -> int
Parameters
----------
data: uint8_t *
Read length bytes from the bus into *data pointer
Parameters:
-----------
data: Data to read into
length: Size of read in bytes to make
length of read, should match length
"""
return _mraa.I2c_read(self, data)
[docs] def readReg(self, reg):
"""
readReg(I2c self, uint8_t reg) -> uint8_t
Parameters
----------
reg: uint8_t
Read byte from an i2c register
Parameters:
-----------
reg: Register to read from
Exceptions:
-----------
std::invalid_argument: in case of error
char read from register
"""
return _mraa.I2c_readReg(self, reg)
[docs] def readWordReg(self, reg):
"""
readWordReg(I2c self, uint8_t reg) -> uint16_t
Parameters
----------
reg: uint8_t
Read word from an i2c register
Parameters:
-----------
reg: Register to read from
Exceptions:
-----------
std::invalid_argument: in case of error
char read from register
"""
return _mraa.I2c_readWordReg(self, reg)
[docs] def readBytesReg(self, reg, data):
"""
readBytesReg(I2c self, uint8_t reg, uint8_t * data) -> int
Parameters
----------
reg: uint8_t
data: uint8_t *
Read length bytes from the bus into *data pointer starting from an i2c
register
Parameters:
-----------
reg: Register to read from
data: pointer to the byte array to read data in to
length: max number of bytes to read
length passed to the function or -1
"""
return _mraa.I2c_readBytesReg(self, reg, data)
[docs] def writeByte(self, data):
"""
writeByte(I2c self, uint8_t data) -> mraa::Result
Parameters
----------
data: uint8_t
Write a byte on the bus
Parameters:
-----------
data: The byte to send on the bus
Result of operation
"""
return _mraa.I2c_writeByte(self, data)
[docs] def write(self, data):
"""
write(I2c self, uint8_t const * data) -> mraa::Result
Parameters
----------
data: uint8_t const *
Write length bytes to the bus, the first byte in the array is the
command/register to write
Parameters:
-----------
data: Buffer to send on the bus, first byte is i2c command
length: Size of buffer to send
Result of operation
"""
return _mraa.I2c_write(self, data)
[docs] def writeReg(self, reg, data):
"""
writeReg(I2c self, uint8_t reg, uint8_t data) -> mraa::Result
Parameters
----------
reg: uint8_t
data: uint8_t
Write a byte to an i2c register
Parameters:
-----------
reg: Register to write to
data: Value to write to register
Result of operation
"""
return _mraa.I2c_writeReg(self, reg, data)
[docs] def writeWordReg(self, reg, data):
"""
writeWordReg(I2c self, uint8_t reg, uint16_t data) -> mraa::Result
Parameters
----------
reg: uint8_t
data: uint16_t
Write a word to an i2c register
Parameters:
-----------
reg: Register to write to
data: Value to write to register
Result of operation
"""
return _mraa.I2c_writeWordReg(self, reg, data)
I2c_swigregister = _mraa.I2c_swigregister
I2c_swigregister(I2c)
[docs]class Pwm(_object):
"""
API to Pulse Width Modulation.
This file defines the PWM interface for libmraa
C++ includes: pwm.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Pwm, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Pwm, name)
__repr__ = _swig_repr
def __init__(self, pin, owner=True, chipid=-1):
"""
__init__(mraa::Pwm self, int pin, bool owner=True, int chipid=-1) -> Pwm
Parameters
----------
pin: int
owner: bool
chipid: int
__init__(mraa::Pwm self, int pin, bool owner=True) -> Pwm
Parameters
----------
pin: int
owner: bool
__init__(mraa::Pwm self, int pin) -> Pwm
Parameters
----------
pin: int
instanciates a PWM object on a pin
Parameters:
-----------
pin: the pin number used on your board
owner: if you are the owner of the pin the destructor will
chipid: the pwmchip to use, use only in raw mode unexport the pin
from sysfs, default behaviour is you are the owner if the pinmapper
exported it
"""
this = _mraa.new_Pwm(pin, owner, chipid)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _mraa.delete_Pwm
__del__ = lambda self: None
[docs] def write(self, percentage):
"""
write(Pwm self, float percentage) -> mraa::Result
Parameters
----------
percentage: float
Set the output duty-cycle percentage, as a float
Parameters:
-----------
percentage: A floating-point value representing percentage of output.
The value should lie between 0.0f (representing on 0%) and 1.0f Values
above or below this range will be set at either 0.0f or 1.0f
Result of operation
"""
return _mraa.Pwm_write(self, percentage)
[docs] def read(self):
"""
read(Pwm self) -> float
Parameters
----------
self: mraa::Pwm *
Read the output duty-cycle percentage, as a float
A floating-point value representing percentage of output. The value
should lie between 0.0f (representing on 0%) and 1.0f Values above or
below this range will be set at either 0.0f or 1.0f
"""
return _mraa.Pwm_read(self)
[docs] def period(self, period):
"""
period(Pwm self, float period) -> mraa::Result
Parameters
----------
period: float
Set the PWM period as seconds represented in a float
Parameters:
-----------
period: Period represented as a float in seconds
Result of operation
"""
return _mraa.Pwm_period(self, period)
[docs] def period_ms(self, ms):
"""
period_ms(Pwm self, int ms) -> mraa::Result
Parameters
----------
ms: int
Set period, milliseconds
Parameters:
-----------
ms: milliseconds for period
Result of operation
"""
return _mraa.Pwm_period_ms(self, ms)
[docs] def period_us(self, us):
"""
period_us(Pwm self, int us) -> mraa::Result
Parameters
----------
us: int
Set period, microseconds
Parameters:
-----------
us: microseconds as period
Result of operation
"""
return _mraa.Pwm_period_us(self, us)
[docs] def pulsewidth(self, seconds):
"""
pulsewidth(Pwm self, float seconds) -> mraa::Result
Parameters
----------
seconds: float
Set pulsewidth, As represnted by seconds in a (float)
Parameters:
-----------
seconds: The duration of a pulse
Result of operation
"""
return _mraa.Pwm_pulsewidth(self, seconds)
[docs] def pulsewidth_ms(self, ms):
"""
pulsewidth_ms(Pwm self, int ms) -> mraa::Result
Parameters
----------
ms: int
Set pulsewidth, milliseconds
Parameters:
-----------
ms: milliseconds for pulsewidth
Result of operation
"""
return _mraa.Pwm_pulsewidth_ms(self, ms)
[docs] def pulsewidth_us(self, us):
"""
pulsewidth_us(Pwm self, int us) -> mraa::Result
Parameters
----------
us: int
The pulsewidth, microseconds
Parameters:
-----------
us: microseconds for pulsewidth
Result of operation
"""
return _mraa.Pwm_pulsewidth_us(self, us)
[docs] def enable(self, enable):
"""
enable(Pwm self, bool enable) -> mraa::Result
Parameters
----------
enable: bool
Set the enable status of the PWM pin. None zero will assume on with
output being driven and 0 will disable the output
Parameters:
-----------
enable: enable status of pin
Result of operation
"""
return _mraa.Pwm_enable(self, enable)
[docs] def max_period(self):
"""
max_period(Pwm self) -> int
Parameters
----------
self: mraa::Pwm *
Get the maximum pwm period in us
max pwm in us
"""
return _mraa.Pwm_max_period(self)
[docs] def min_period(self):
"""
min_period(Pwm self) -> int
Parameters
----------
self: mraa::Pwm *
Get the minimum pwm period in us
min pwm in us
"""
return _mraa.Pwm_min_period(self)
Pwm_swigregister = _mraa.Pwm_swigregister
Pwm_swigregister(Pwm)
_mraa.SPI_MODE0_swigconstant(_mraa)
SPI_MODE0 = _mraa.SPI_MODE0
_mraa.SPI_MODE1_swigconstant(_mraa)
SPI_MODE1 = _mraa.SPI_MODE1
_mraa.SPI_MODE2_swigconstant(_mraa)
SPI_MODE2 = _mraa.SPI_MODE2
_mraa.SPI_MODE3_swigconstant(_mraa)
SPI_MODE3 = _mraa.SPI_MODE3
[docs]class Spi(_object):
"""
API to Serial Peripheral Interface.
This file defines the SPI interface for libmraa
C++ includes: spi.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Spi, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Spi, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
__init__(mraa::Spi self, int bus) -> Spi
Parameters
----------
bus: int
__init__(mraa::Spi self, int bus, int cs) -> Spi
Parameters
----------
bus: int
cs: int
"""
this = _mraa.new_Spi(*args)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _mraa.delete_Spi
__del__ = lambda self: None
[docs] def mode(self, mode):
"""
mode(Spi self, mraa::Spi_Mode mode) -> mraa::Result
Parameters
----------
mode: enum mraa::Spi_Mode
Set the SPI device mode. see spidev0-3
Parameters:
-----------
mode: the mode. See Linux spidev doc
Result of operation
"""
return _mraa.Spi_mode(self, mode)
[docs] def frequency(self, hz):
"""
frequency(Spi self, int hz) -> mraa::Result
Parameters
----------
hz: int
Set the SPI device operating clock frequency
Parameters:
-----------
hz: the frequency to set in hz
Result of operation
"""
return _mraa.Spi_frequency(self, hz)
[docs] def writeByte(self, data):
"""
writeByte(Spi self, uint8_t data) -> int
Parameters
----------
data: uint8_t
Write single byte to the SPI device
Parameters:
-----------
data: the byte to send
data received on the miso line or -1 in case of error
"""
return _mraa.Spi_writeByte(self, data)
[docs] def writeWord(self, data):
"""
writeWord(Spi self, uint16_t data) -> int
Parameters
----------
data: uint16_t
Write buffer of bytes to SPI device The pointer return has to be
free'd by the caller. It will return a NULL pointer in cases of error
Parameters:
-----------
txBuf: buffer to send
length: size of buffer (in bytes) to send
uint8_t* data received on the miso line. Same length as passed in
"""
return _mraa.Spi_writeWord(self, data)
[docs] def write(self, txBuf):
"""
write(Spi self, uint8_t * txBuf) -> uint8_t *
Parameters
----------
txBuf: uint8_t *
Write buffer of bytes to SPI device The pointer return has to be
free'd by the caller. It will return a NULL pointer in cases of error
Parameters:
-----------
txBuf: buffer to send
length: size of buffer to send
uint8_t* data received on the miso line. Same length as passed in
"""
return _mraa.Spi_write(self, txBuf)
[docs] def lsbmode(self, lsb):
"""
lsbmode(Spi self, bool lsb) -> mraa::Result
Parameters
----------
lsb: bool
Change the SPI lsb mode
Parameters:
-----------
lsb: Use least significant bit transmission - 0 for msbi
Result of operation
"""
return _mraa.Spi_lsbmode(self, lsb)
[docs] def bitPerWord(self, bits):
"""
bitPerWord(Spi self, unsigned int bits) -> mraa::Result
Parameters
----------
bits: unsigned int
Set bits per mode on transaction, default is 8
Parameters:
-----------
bits: bits per word
Result of operation
"""
return _mraa.Spi_bitPerWord(self, bits)
Spi_swigregister = _mraa.Spi_swigregister
Spi_swigregister(Spi)
[docs]class Aio(_object):
"""
API to Analog IO.
This file defines the aio interface for libmraa
C++ includes: aio.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Aio, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Aio, name)
__repr__ = _swig_repr
def __init__(self, pin):
"""
__init__(mraa::Aio self, unsigned int pin) -> Aio
Parameters
----------
pin: unsigned int
Aio Constructor, takes a pin number which will map directly to the
board number
Parameters:
-----------
pin: channel number to read ADC inputs
"""
this = _mraa.new_Aio(pin)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _mraa.delete_Aio
__del__ = lambda self: None
[docs] def read(self):
"""
read(Aio self) -> unsigned int
Parameters
----------
self: mraa::Aio *
Read a value from the AIO pin. By default mraa will shift the raw
value up or down to a 10 bit value.
Exceptions:
-----------
std::invalid_argument: in case of error
The current input voltage. By default, a 10bit value
"""
return _mraa.Aio_read(self)
[docs] def readFloat(self):
"""
readFloat(Aio self) -> float
Parameters
----------
self: mraa::Aio *
Read a value from the AIO pin and return it as a normalized float.
Exceptions:
-----------
std::invalid_argument: in case of error
The current input voltage as a normalized float (0.0f-1.0f)
"""
return _mraa.Aio_readFloat(self)
[docs] def setBit(self, bits):
"""
setBit(Aio self, int bits) -> mraa::Result
Parameters
----------
bits: int
Set the bit value which mraa will shift the raw reading from the ADC
to. I.e. 10bits
Parameters:
-----------
bits: the bits the return from read should be i.e 10
mraa::Result type
"""
return _mraa.Aio_setBit(self, bits)
[docs] def getBit(self):
"""
getBit(Aio self) -> int
Parameters
----------
self: mraa::Aio *
Gets the bit value mraa is shifting the analog read to.
bit value mraa is set return from the read function
"""
return _mraa.Aio_getBit(self)
Aio_swigregister = _mraa.Aio_swigregister
Aio_swigregister(Aio)
[docs]class Uart(_object):
"""
API to UART (enabling only)
This file defines the UART interface for libmraa
C++ includes: uart.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, Uart, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, Uart, name)
__repr__ = _swig_repr
def __init__(self, *args):
"""
__init__(mraa::Uart self, int uart) -> Uart
Parameters
----------
uart: int
__init__(mraa::Uart self, std::string path) -> Uart
Parameters
----------
path: std::string
Uart Constructor, takes a string to the path of the serial interface
that is needed.
Parameters:
-----------
uart: the index of the uart set to use
"""
this = _mraa.new_Uart(*args)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _mraa.delete_Uart
__del__ = lambda self: None
[docs] def getDevicePath(self):
"""
getDevicePath(Uart self) -> std::string
Parameters
----------
self: mraa::Uart *
Get string with tty device path within Linux For example. Could point
to "/dev/ttyS0"
char pointer of device path
"""
return _mraa.Uart_getDevicePath(self)
[docs] def read(self, data):
"""
read(Uart self, char * data) -> int
Parameters
----------
data: char *
Read bytes from the device into char* buffer
Parameters:
-----------
data: buffer pointer
length: maximum size of buffer
numbers of bytes read
"""
return _mraa.Uart_read(self, data)
[docs] def write(self, data):
"""
write(Uart self, char const * data) -> int
Parameters
----------
data: char const *
Write bytes in String object to a device
Parameters:
-----------
data: buffer pointer
length: maximum size of buffer
the number of bytes written, or -1 if an error occurred
"""
return _mraa.Uart_write(self, data)
[docs] def readStr(self, length):
"""
readStr(Uart self, int length) -> std::string
Parameters
----------
length: int
Read bytes from the device into a String object
Parameters:
-----------
length: to read
Exceptions:
-----------
std::bad_alloc: If there is no space left for read.
string of data
"""
return _mraa.Uart_readStr(self, length)
[docs] def writeStr(self, data):
"""
writeStr(Uart self, std::string data) -> int
Parameters
----------
data: std::string
Write bytes in String object to a device
Parameters:
-----------
string: to write
the number of bytes written, or -1 if an error occurred
"""
return _mraa.Uart_writeStr(self, data)
[docs] def dataAvailable(self, millis=0):
"""
dataAvailable(Uart self, unsigned int millis=0) -> bool
Parameters
----------
millis: unsigned int
dataAvailable(Uart self) -> bool
Parameters
----------
self: mraa::Uart *
Check to see if data is available on the device for reading
Parameters:
-----------
millis: number of milliseconds to wait, or 0 to return immediately
true if there is data available to read, false otherwise
"""
return _mraa.Uart_dataAvailable(self, millis)
[docs] def flush(self):
"""
flush(Uart self) -> mraa::Result
Parameters
----------
self: mraa::Uart *
Flush the outbound data. Blocks until complete.
Result of operation
"""
return _mraa.Uart_flush(self)
[docs] def setBaudRate(self, baud):
"""
setBaudRate(Uart self, unsigned int baud) -> mraa::Result
Parameters
----------
baud: unsigned int
Set the baudrate. Takes an int and will attempt to decide what
baudrate is to be used on the UART hardware.
Parameters:
-----------
baud: unsigned int of baudrate i.e. 9600
Result of operation
"""
return _mraa.Uart_setBaudRate(self, baud)
[docs] def setMode(self, bytesize, parity, stopbits):
"""
setMode(Uart self, int bytesize, mraa::UartParity parity, int stopbits) -> mraa::Result
Parameters
----------
bytesize: int
parity: enum mraa::UartParity
stopbits: int
Set the transfer mode For example setting the mode to 8N1 would be
"dev.setMode(8,UART_PARITY_NONE , 1)"
Parameters:
-----------
bytesize: data bits
parity: Parity bit setting
stopbits: stop bits
Result of operation
"""
return _mraa.Uart_setMode(self, bytesize, parity, stopbits)
[docs] def setFlowcontrol(self, xonxoff, rtscts):
"""
setFlowcontrol(Uart self, bool xonxoff, bool rtscts) -> mraa::Result
Parameters
----------
xonxoff: bool
rtscts: bool
Set the flowcontrol
Parameters:
-----------
xonxoff: XON/XOFF Software flow control.
rtscts: RTS/CTS out of band hardware flow control
Result of operation
"""
return _mraa.Uart_setFlowcontrol(self, xonxoff, rtscts)
[docs] def setTimeout(self, read, write, interchar):
"""
setTimeout(Uart self, int read, int write, int interchar) -> mraa::Result
Parameters
----------
read: int
write: int
interchar: int
Set the timeout for read and write operations <= 0 will disable that
timeout
Parameters:
-----------
read: read timeout
write: write timeout
interchar: inbetween char timeout
Result of operation
"""
return _mraa.Uart_setTimeout(self, read, write, interchar)
[docs] def SetNonBlocking(self, nonblock):
"""
SetNonBlocking(Uart self, bool nonblock) -> mraa::Result
Parameters
----------
nonblock: bool
Set the blocking state for write operations
Parameters:
-----------
dev: The UART context
nonblock: new nonblocking state
Result of operation
"""
return _mraa.Uart_SetNonBlocking(self, nonblock)
Uart_swigregister = _mraa.Uart_swigregister
Uart_swigregister(Uart)
# This file is compatible with both classic and new-style classes.