Source code for mraa

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.0
#
# 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 as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
    raise RuntimeError('Python 2.7 or later required')
def swig_import_helper():
    import importlib
    pkg = __name__.rpartition('.')[0]
    mname = '.'.join((pkg, '_mraa')).lstrip('.')
    try:
        return importlib.import_module(mname)
    except ImportError:
        return importlib.import_module('_mraa')
_mraa = swig_import_helper()
del swig_import_helper
del _swig_python_version_info

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

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:
        object.__setattr__(self, 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(self, class_type, name):
    if name == "thisown":
        return self.this.own()
    method = class_type.__swig_getmethods__.get(name, None)
    if method:
        return method(self)
    raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))


def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "thisown":
            self.this.own(value)
        elif name == "this":
            set(self, name, value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


class uint8Array(object):
    r"""Proxy of C++ uint8Array class."""

    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
    __repr__ = _swig_repr

    def __init__(self, nelements):
        r"""
        __init__(uint8Array self, size_t nelements) -> uint8Array

        Parameters
        ----------
        nelements: size_t

        """
        _mraa.uint8Array_swiginit(self, _mraa.new_uint8Array(nelements))
    __swig_destroy__ = _mraa.delete_uint8Array

    def __getitem__(self, index):
        r"""
        __getitem__(uint8Array self, size_t index) -> uint8_t

        Parameters
        ----------
        index: size_t

        """
        return _mraa.uint8Array___getitem__(self, index)


    def __setitem__(self, index, value):
        r"""
        __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):
        r"""
        cast(uint8Array self) -> uint8_t *

        Parameters
        ----------
        self: uint8Array *

        """
        return _mraa.uint8Array_cast(self)


    def frompointer(t):
        r"""
        frompointer(uint8_t * t) -> uint8Array

        Parameters
        ----------
        t: uint8_t *

        """
        return _mraa.uint8Array_frompointer(t)

    frompointer = staticmethod(frompointer)

# Register uint8Array in _mraa:
_mraa.uint8Array_swigregister(uint8Array)

def uint8Array_frompointer(t):
    r"""
    uint8Array_frompointer(uint8_t * t) -> uint8Array

    Parameters
    ----------
    t: uint8_t *

    """
    return _mraa.uint8Array_frompointer(t)

INTEL_GALILEO_GEN1 = _mraa.INTEL_GALILEO_GEN1

INTEL_GALILEO_GEN2 = _mraa.INTEL_GALILEO_GEN2

INTEL_EDISON_FAB_C = _mraa.INTEL_EDISON_FAB_C

INTEL_DE3815 = _mraa.INTEL_DE3815

INTEL_MINNOWBOARD_MAX = _mraa.INTEL_MINNOWBOARD_MAX

RASPBERRY_PI = _mraa.RASPBERRY_PI

BEAGLEBONE = _mraa.BEAGLEBONE

BANANA = _mraa.BANANA

INTEL_NUC5 = _mraa.INTEL_NUC5

A96BOARDS = _mraa.A96BOARDS

INTEL_SOFIA_3GR = _mraa.INTEL_SOFIA_3GR

INTEL_CHERRYHILLS = _mraa.INTEL_CHERRYHILLS

INTEL_UP = _mraa.INTEL_UP

INTEL_JOULE_EXPANSION = _mraa.INTEL_JOULE_EXPANSION

PHYBOARD_WEGA = _mraa.PHYBOARD_WEGA

DE_NANO_SOC = _mraa.DE_NANO_SOC

INTEL_UP2 = _mraa.INTEL_UP2

MTK_LINKIT = _mraa.MTK_LINKIT

MTK_OMEGA2 = _mraa.MTK_OMEGA2

IEI_TANK = _mraa.IEI_TANK

FTDI_FT4222 = _mraa.FTDI_FT4222

GROVEPI = _mraa.GROVEPI

GENERIC_FIRMATA = _mraa.GENERIC_FIRMATA

ANDROID_PERIPHERALMANAGER = _mraa.ANDROID_PERIPHERALMANAGER

MOCK_PLATFORM = _mraa.MOCK_PLATFORM

NULL_PLATFORM = _mraa.NULL_PLATFORM

UNKNOWN_PLATFORM = _mraa.UNKNOWN_PLATFORM

INTEL_EDISON_MINIBOARD_J17_1 = _mraa.INTEL_EDISON_MINIBOARD_J17_1

INTEL_EDISON_MINIBOARD_J17_5 = _mraa.INTEL_EDISON_MINIBOARD_J17_5

INTEL_EDISON_MINIBOARD_J17_7 = _mraa.INTEL_EDISON_MINIBOARD_J17_7

INTEL_EDISON_MINIBOARD_J17_8 = _mraa.INTEL_EDISON_MINIBOARD_J17_8

INTEL_EDISON_MINIBOARD_J17_9 = _mraa.INTEL_EDISON_MINIBOARD_J17_9

INTEL_EDISON_MINIBOARD_J17_10 = _mraa.INTEL_EDISON_MINIBOARD_J17_10

INTEL_EDISON_MINIBOARD_J17_11 = _mraa.INTEL_EDISON_MINIBOARD_J17_11

INTEL_EDISON_MINIBOARD_J17_12 = _mraa.INTEL_EDISON_MINIBOARD_J17_12

INTEL_EDISON_MINIBOARD_J17_14 = _mraa.INTEL_EDISON_MINIBOARD_J17_14

INTEL_EDISON_MINIBOARD_J18_1 = _mraa.INTEL_EDISON_MINIBOARD_J18_1

INTEL_EDISON_MINIBOARD_J18_2 = _mraa.INTEL_EDISON_MINIBOARD_J18_2

INTEL_EDISON_MINIBOARD_J18_6 = _mraa.INTEL_EDISON_MINIBOARD_J18_6

INTEL_EDISON_MINIBOARD_J18_7 = _mraa.INTEL_EDISON_MINIBOARD_J18_7

INTEL_EDISON_MINIBOARD_J18_8 = _mraa.INTEL_EDISON_MINIBOARD_J18_8

INTEL_EDISON_MINIBOARD_J18_10 = _mraa.INTEL_EDISON_MINIBOARD_J18_10

INTEL_EDISON_MINIBOARD_J18_11 = _mraa.INTEL_EDISON_MINIBOARD_J18_11

INTEL_EDISON_MINIBOARD_J18_12 = _mraa.INTEL_EDISON_MINIBOARD_J18_12

INTEL_EDISON_MINIBOARD_J18_13 = _mraa.INTEL_EDISON_MINIBOARD_J18_13

INTEL_EDISON_MINIBOARD_J19_4 = _mraa.INTEL_EDISON_MINIBOARD_J19_4

INTEL_EDISON_MINIBOARD_J19_5 = _mraa.INTEL_EDISON_MINIBOARD_J19_5

INTEL_EDISON_MINIBOARD_J19_6 = _mraa.INTEL_EDISON_MINIBOARD_J19_6

INTEL_EDISON_MINIBOARD_J19_8 = _mraa.INTEL_EDISON_MINIBOARD_J19_8

INTEL_EDISON_MINIBOARD_J19_9 = _mraa.INTEL_EDISON_MINIBOARD_J19_9

INTEL_EDISON_MINIBOARD_J19_10 = _mraa.INTEL_EDISON_MINIBOARD_J19_10

INTEL_EDISON_MINIBOARD_J19_11 = _mraa.INTEL_EDISON_MINIBOARD_J19_11

INTEL_EDISON_MINIBOARD_J19_12 = _mraa.INTEL_EDISON_MINIBOARD_J19_12

INTEL_EDISON_MINIBOARD_J19_13 = _mraa.INTEL_EDISON_MINIBOARD_J19_13

INTEL_EDISON_MINIBOARD_J19_14 = _mraa.INTEL_EDISON_MINIBOARD_J19_14

INTEL_EDISON_MINIBOARD_J20_3 = _mraa.INTEL_EDISON_MINIBOARD_J20_3

INTEL_EDISON_MINIBOARD_J20_4 = _mraa.INTEL_EDISON_MINIBOARD_J20_4

INTEL_EDISON_MINIBOARD_J20_5 = _mraa.INTEL_EDISON_MINIBOARD_J20_5

INTEL_EDISON_MINIBOARD_J20_6 = _mraa.INTEL_EDISON_MINIBOARD_J20_6

INTEL_EDISON_MINIBOARD_J20_7 = _mraa.INTEL_EDISON_MINIBOARD_J20_7

INTEL_EDISON_MINIBOARD_J20_8 = _mraa.INTEL_EDISON_MINIBOARD_J20_8

INTEL_EDISON_MINIBOARD_J20_9 = _mraa.INTEL_EDISON_MINIBOARD_J20_9

INTEL_EDISON_MINIBOARD_J20_10 = _mraa.INTEL_EDISON_MINIBOARD_J20_10

INTEL_EDISON_MINIBOARD_J20_11 = _mraa.INTEL_EDISON_MINIBOARD_J20_11

INTEL_EDISON_MINIBOARD_J20_12 = _mraa.INTEL_EDISON_MINIBOARD_J20_12

INTEL_EDISON_MINIBOARD_J20_13 = _mraa.INTEL_EDISON_MINIBOARD_J20_13

INTEL_EDISON_MINIBOARD_J20_14 = _mraa.INTEL_EDISON_MINIBOARD_J20_14

INTEL_EDISON_GP182 = _mraa.INTEL_EDISON_GP182

INTEL_EDISON_GP135 = _mraa.INTEL_EDISON_GP135

INTEL_EDISON_GP27 = _mraa.INTEL_EDISON_GP27

INTEL_EDISON_GP20 = _mraa.INTEL_EDISON_GP20

INTEL_EDISON_GP28 = _mraa.INTEL_EDISON_GP28

INTEL_EDISON_GP111 = _mraa.INTEL_EDISON_GP111

INTEL_EDISON_GP109 = _mraa.INTEL_EDISON_GP109

INTEL_EDISON_GP115 = _mraa.INTEL_EDISON_GP115

INTEL_EDISON_GP128 = _mraa.INTEL_EDISON_GP128

INTEL_EDISON_GP13 = _mraa.INTEL_EDISON_GP13

INTEL_EDISON_GP165 = _mraa.INTEL_EDISON_GP165

INTEL_EDISON_GP19 = _mraa.INTEL_EDISON_GP19

INTEL_EDISON_GP12 = _mraa.INTEL_EDISON_GP12

INTEL_EDISON_GP183 = _mraa.INTEL_EDISON_GP183

INTEL_EDISON_GP110 = _mraa.INTEL_EDISON_GP110

INTEL_EDISON_GP114 = _mraa.INTEL_EDISON_GP114

INTEL_EDISON_GP129 = _mraa.INTEL_EDISON_GP129

INTEL_EDISON_GP130 = _mraa.INTEL_EDISON_GP130

INTEL_EDISON_GP44 = _mraa.INTEL_EDISON_GP44

INTEL_EDISON_GP46 = _mraa.INTEL_EDISON_GP46

INTEL_EDISON_GP48 = _mraa.INTEL_EDISON_GP48

INTEL_EDISON_GP131 = _mraa.INTEL_EDISON_GP131

INTEL_EDISON_GP14 = _mraa.INTEL_EDISON_GP14

INTEL_EDISON_GP40 = _mraa.INTEL_EDISON_GP40

INTEL_EDISON_GP43 = _mraa.INTEL_EDISON_GP43

INTEL_EDISON_GP77 = _mraa.INTEL_EDISON_GP77

INTEL_EDISON_GP82 = _mraa.INTEL_EDISON_GP82

INTEL_EDISON_GP83 = _mraa.INTEL_EDISON_GP83

INTEL_EDISON_GP134 = _mraa.INTEL_EDISON_GP134

INTEL_EDISON_GP45 = _mraa.INTEL_EDISON_GP45

INTEL_EDISON_GP47 = _mraa.INTEL_EDISON_GP47

INTEL_EDISON_GP49 = _mraa.INTEL_EDISON_GP49

INTEL_EDISON_GP15 = _mraa.INTEL_EDISON_GP15

INTEL_EDISON_GP84 = _mraa.INTEL_EDISON_GP84

INTEL_EDISON_GP42 = _mraa.INTEL_EDISON_GP42

INTEL_EDISON_GP41 = _mraa.INTEL_EDISON_GP41

INTEL_EDISON_GP78 = _mraa.INTEL_EDISON_GP78

INTEL_EDISON_GP79 = _mraa.INTEL_EDISON_GP79

INTEL_EDISON_GP80 = _mraa.INTEL_EDISON_GP80

INTEL_EDISON_GP81 = _mraa.INTEL_EDISON_GP81

RASPBERRY_WIRING_PIN8 = _mraa.RASPBERRY_WIRING_PIN8

RASPBERRY_WIRING_PIN9 = _mraa.RASPBERRY_WIRING_PIN9

RASPBERRY_WIRING_PIN7 = _mraa.RASPBERRY_WIRING_PIN7

RASPBERRY_WIRING_PIN15 = _mraa.RASPBERRY_WIRING_PIN15

RASPBERRY_WIRING_PIN16 = _mraa.RASPBERRY_WIRING_PIN16

RASPBERRY_WIRING_PIN0 = _mraa.RASPBERRY_WIRING_PIN0

RASPBERRY_WIRING_PIN1 = _mraa.RASPBERRY_WIRING_PIN1

RASPBERRY_WIRING_PIN2 = _mraa.RASPBERRY_WIRING_PIN2

RASPBERRY_WIRING_PIN3 = _mraa.RASPBERRY_WIRING_PIN3

RASPBERRY_WIRING_PIN4 = _mraa.RASPBERRY_WIRING_PIN4

RASPBERRY_WIRING_PIN5 = _mraa.RASPBERRY_WIRING_PIN5

RASPBERRY_WIRING_PIN12 = _mraa.RASPBERRY_WIRING_PIN12

RASPBERRY_WIRING_PIN13 = _mraa.RASPBERRY_WIRING_PIN13

RASPBERRY_WIRING_PIN6 = _mraa.RASPBERRY_WIRING_PIN6

RASPBERRY_WIRING_PIN14 = _mraa.RASPBERRY_WIRING_PIN14

RASPBERRY_WIRING_PIN10 = _mraa.RASPBERRY_WIRING_PIN10

RASPBERRY_WIRING_PIN11 = _mraa.RASPBERRY_WIRING_PIN11

RASPBERRY_WIRING_PIN17 = _mraa.RASPBERRY_WIRING_PIN17

RASPBERRY_WIRING_PIN21 = _mraa.RASPBERRY_WIRING_PIN21

RASPBERRY_WIRING_PIN18 = _mraa.RASPBERRY_WIRING_PIN18

RASPBERRY_WIRING_PIN19 = _mraa.RASPBERRY_WIRING_PIN19

RASPBERRY_WIRING_PIN22 = _mraa.RASPBERRY_WIRING_PIN22

RASPBERRY_WIRING_PIN20 = _mraa.RASPBERRY_WIRING_PIN20

RASPBERRY_WIRING_PIN26 = _mraa.RASPBERRY_WIRING_PIN26

RASPBERRY_WIRING_PIN23 = _mraa.RASPBERRY_WIRING_PIN23

RASPBERRY_WIRING_PIN24 = _mraa.RASPBERRY_WIRING_PIN24

RASPBERRY_WIRING_PIN27 = _mraa.RASPBERRY_WIRING_PIN27

RASPBERRY_WIRING_PIN25 = _mraa.RASPBERRY_WIRING_PIN25

RASPBERRY_WIRING_PIN28 = _mraa.RASPBERRY_WIRING_PIN28

RASPBERRY_WIRING_PIN29 = _mraa.RASPBERRY_WIRING_PIN29

SUCCESS = _mraa.SUCCESS

ERROR_FEATURE_NOT_IMPLEMENTED = _mraa.ERROR_FEATURE_NOT_IMPLEMENTED

ERROR_FEATURE_NOT_SUPPORTED = _mraa.ERROR_FEATURE_NOT_SUPPORTED

ERROR_INVALID_VERBOSITY_LEVEL = _mraa.ERROR_INVALID_VERBOSITY_LEVEL

ERROR_INVALID_PARAMETER = _mraa.ERROR_INVALID_PARAMETER

ERROR_INVALID_HANDLE = _mraa.ERROR_INVALID_HANDLE

ERROR_NO_RESOURCES = _mraa.ERROR_NO_RESOURCES

ERROR_INVALID_RESOURCE = _mraa.ERROR_INVALID_RESOURCE

ERROR_INVALID_QUEUE_TYPE = _mraa.ERROR_INVALID_QUEUE_TYPE

ERROR_NO_DATA_AVAILABLE = _mraa.ERROR_NO_DATA_AVAILABLE

ERROR_INVALID_PLATFORM = _mraa.ERROR_INVALID_PLATFORM

ERROR_PLATFORM_NOT_INITIALISED = _mraa.ERROR_PLATFORM_NOT_INITIALISED

ERROR_UART_OW_SHORTED = _mraa.ERROR_UART_OW_SHORTED

ERROR_UART_OW_NO_DEVICES = _mraa.ERROR_UART_OW_NO_DEVICES

ERROR_UART_OW_DATA_ERROR = _mraa.ERROR_UART_OW_DATA_ERROR

ERROR_UNSPECIFIED = _mraa.ERROR_UNSPECIFIED

PIN_VALID = _mraa.PIN_VALID

PIN_GPIO = _mraa.PIN_GPIO

PIN_PWM = _mraa.PIN_PWM

PIN_FAST_GPIO = _mraa.PIN_FAST_GPIO

PIN_SPI = _mraa.PIN_SPI

PIN_I2C = _mraa.PIN_I2C

PIN_AIO = _mraa.PIN_AIO

PIN_UART = _mraa.PIN_UART

I2C_STD = _mraa.I2C_STD

I2C_FAST = _mraa.I2C_FAST

I2C_HIGH = _mraa.I2C_HIGH

UART_PARITY_NONE = _mraa.UART_PARITY_NONE

UART_PARITY_EVEN = _mraa.UART_PARITY_EVEN

UART_PARITY_ODD = _mraa.UART_PARITY_ODD

UART_PARITY_MARK = _mraa.UART_PARITY_MARK

UART_PARITY_SPACE = _mraa.UART_PARITY_SPACE


[docs]def init(): r"""init() -> mraa::Result""" return _mraa.init()
[docs]def getVersion(): r"""getVersion() -> std::string""" return _mraa.getVersion()
[docs]def setPriority(priority): r""" setPriority(int const priority) -> int Parameters ---------- priority: int const """ return _mraa.setPriority(priority)
[docs]def getPlatformType(): r"""getPlatformType() -> mraa::Platform""" return _mraa.getPlatformType()
[docs]def printError(result): r""" printError(mraa::Result result) Parameters ---------- result: enum mraa::Result """ return _mraa.printError(result)
[docs]def pinModeTest(pin, mode): r""" pinModeTest(int pin, mraa::Pinmodes mode) -> bool Parameters ---------- pin: int mode: enum mraa::Pinmodes """ return _mraa.pinModeTest(pin, mode)
[docs]def adcRawBits(): r"""adcRawBits() -> unsigned int""" return _mraa.adcRawBits()
[docs]def adcSupportedBits(): r"""adcSupportedBits() -> unsigned int""" return _mraa.adcSupportedBits()
[docs]def getPlatformName(): r"""getPlatformName() -> std::string""" return _mraa.getPlatformName()
[docs]def getPlatformVersion(*args): r""" getPlatformVersion(int platform_offset) -> std::string Parameters ---------- platform_offset: int getPlatformVersion() -> std::string """ return _mraa.getPlatformVersion(*args)
[docs]def getPinCount(): r"""getPinCount() -> unsigned int""" return _mraa.getPinCount()
[docs]def getUartCount(): r"""getUartCount() -> int""" return _mraa.getUartCount()
[docs]def getI2cBusCount(): r"""getI2cBusCount() -> int""" return _mraa.getI2cBusCount()
[docs]def getI2cBusId(i2c_bus): r""" getI2cBusId(int i2c_bus) -> int Parameters ---------- i2c_bus: int """ return _mraa.getI2cBusId(i2c_bus)
[docs]def getPinName(pin): r""" getPinName(int pin) -> std::string Parameters ---------- pin: int """ return _mraa.getPinName(pin)
[docs]def getGpioLookup(pin_name): r""" getGpioLookup(std::string pin_name) -> int Parameters ---------- pin_name: std::string """ return _mraa.getGpioLookup(pin_name)
[docs]def getI2cLookup(i2c_name): r""" getI2cLookup(std::string i2c_name) -> int Parameters ---------- i2c_name: std::string """ return _mraa.getI2cLookup(i2c_name)
[docs]def getSpiLookup(spi_name): r""" getSpiLookup(std::string spi_name) -> int Parameters ---------- spi_name: std::string """ return _mraa.getSpiLookup(spi_name)
[docs]def getPwmLookup(pwm_name): r""" getPwmLookup(std::string pwm_name) -> int Parameters ---------- pwm_name: std::string """ return _mraa.getPwmLookup(pwm_name)
[docs]def getUartLookup(uart_name): r""" getUartLookup(std::string uart_name) -> int Parameters ---------- uart_name: std::string """ return _mraa.getUartLookup(uart_name)
[docs]def setLogLevel(level): r""" setLogLevel(int level) -> mraa::Result Parameters ---------- level: int """ return _mraa.setLogLevel(level)
[docs]def hasSubPlatform(): r"""hasSubPlatform() -> bool""" return _mraa.hasSubPlatform()
[docs]def isSubPlatformId(pin_or_bus_id): r""" isSubPlatformId(int pin_or_bus_id) -> bool Parameters ---------- pin_or_bus_id: int """ return _mraa.isSubPlatformId(pin_or_bus_id)
[docs]def getSubPlatformId(pin_or_bus_index): r""" getSubPlatformId(int pin_or_bus_index) -> int Parameters ---------- pin_or_bus_index: int """ return _mraa.getSubPlatformId(pin_or_bus_index)
[docs]def getSubPlatformIndex(pin_or_bus_id): r""" getSubPlatformIndex(int pin_or_bus_id) -> int Parameters ---------- pin_or_bus_id: int """ return _mraa.getSubPlatformIndex(pin_or_bus_id)
[docs]def getDefaultI2cBus(*args): r""" getDefaultI2cBus(int platform_offset) -> int Parameters ---------- platform_offset: int getDefaultI2cBus() -> int """ return _mraa.getDefaultI2cBus(*args)
[docs]def addSubplatform(subplatformtype, dev): r""" addSubplatform(mraa::Platform subplatformtype, std::string dev) -> mraa::Result Parameters ---------- subplatformtype: enum mraa::Platform dev: std::string """ return _mraa.addSubplatform(subplatformtype, dev)
[docs]def removeSubplatform(subplatformtype): r""" removeSubplatform(mraa::Platform subplatformtype) -> mraa::Result Parameters ---------- subplatformtype: enum mraa::Platform """ return _mraa.removeSubplatform(subplatformtype)
[docs]def initJsonPlatform(path): r""" initJsonPlatform(std::string path) -> mraa::Result Parameters ---------- path: std::string """ return _mraa.initJsonPlatform(path)
[docs]def gpioFromDesc(desc): r""" gpioFromDesc(std::string desc) -> Gpio Parameters ---------- desc: std::string """ return _mraa.gpioFromDesc(desc)
[docs]def aioFromDesc(desc): r""" aioFromDesc(std::string desc) -> Aio Parameters ---------- desc: std::string """ return _mraa.aioFromDesc(desc)
[docs]def uartFromDesc(desc): r""" uartFromDesc(std::string desc) -> Uart Parameters ---------- desc: std::string """ return _mraa.uartFromDesc(desc)
[docs]def spiFromDesc(desc): r""" spiFromDesc(std::string desc) -> Spi Parameters ---------- desc: std::string """ return _mraa.spiFromDesc(desc)
[docs]def i2cFromDesc(desc): r""" i2cFromDesc(std::string desc) -> I2c Parameters ---------- desc: std::string """ return _mraa.i2cFromDesc(desc)
[docs]def pwmFromDesc(desc): r""" pwmFromDesc(std::string desc) -> Pwm Parameters ---------- desc: std::string """ return _mraa.pwmFromDesc(desc)
[docs]def ledFromDesc(desc): r""" ledFromDesc(std::string desc) -> Led Parameters ---------- desc: std::string """ return _mraa.ledFromDesc(desc)
MODE_STRONG = _mraa.MODE_STRONG MODE_PULLUP = _mraa.MODE_PULLUP MODE_PULLDOWN = _mraa.MODE_PULLDOWN MODE_HIZ = _mraa.MODE_HIZ DIR_OUT = _mraa.DIR_OUT DIR_IN = _mraa.DIR_IN DIR_OUT_HIGH = _mraa.DIR_OUT_HIGH DIR_OUT_LOW = _mraa.DIR_OUT_LOW EDGE_NONE = _mraa.EDGE_NONE EDGE_BOTH = _mraa.EDGE_BOTH EDGE_RISING = _mraa.EDGE_RISING EDGE_FALLING = _mraa.EDGE_FALLING MODE_IN_ACTIVE_HIGH = _mraa.MODE_IN_ACTIVE_HIGH MODE_IN_ACTIVE_LOW = _mraa.MODE_IN_ACTIVE_LOW MODE_OUT_OPEN_DRAIN = _mraa.MODE_OUT_OPEN_DRAIN MODE_OUT_PUSH_PULL = _mraa.MODE_OUT_PUSH_PULL
[docs]class Gpio(object): r""" API to General Purpose IO. This file defines the gpio interface for libmraa C++ includes: gpio.hpp """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, pin, owner=True, raw=False): r""" __init__(Gpio self, int pin, bool owner=True, bool raw=False) -> Gpio Parameters ---------- pin: int owner: bool raw: bool __init__(Gpio self, int pin, bool owner=True) -> Gpio Parameters ---------- pin: int owner: bool __init__(Gpio self, int pin) -> Gpio Parameters ---------- pin: int Gpio Constructor, takes a pointer to the GPIO context and initialises the GPIO class Parameters: ----------- gpio_context: void * to GPIO context """ _mraa.Gpio_swiginit(self, _mraa.new_Gpio(pin, owner, raw)) __swig_destroy__ = _mraa.delete_Gpio
[docs] def edge(self, mode): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" read(Gpio self) -> int Parameters ---------- self: mraa::Gpio * Read value from Gpio Gpio value """ return _mraa.Gpio_read(self)
[docs] def write(self, value): r""" 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): r""" 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): r""" 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)
[docs] def inputMode(self, mode): r""" inputMode(Gpio self, mraa::InputMode mode) -> mraa::Result Parameters ---------- mode: enum mraa::InputMode Change Gpio input mode Parameters: ----------- mode: The mode to change the gpio input Result of operation """ return _mraa.Gpio_inputMode(self, mode)
[docs] def outputMode(self, mode): r""" outputMode(Gpio self, mraa::OutputMode mode) -> mraa::Result Parameters ---------- mode: enum mraa::OutputMode Change Gpio output driver mode Parameters: ----------- mode: Set output driver mode Result of operation """ return _mraa.Gpio_outputMode(self, mode)
# Register Gpio in _mraa: _mraa.Gpio_swigregister(Gpio)
[docs]class I2c(object): r""" 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 """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, bus, raw=False): r""" __init__(I2c self, int bus, bool raw=False) -> I2c Parameters ---------- bus: int raw: bool __init__(I2c self, int bus) -> I2c Parameters ---------- bus: int I2C constructor, takes a pointer to a I2C context and initialises the I2C class Parameters: ----------- i2c_context: void * to an I2C context """ _mraa.I2c_swiginit(self, _mraa.new_I2c(bus, raw)) __swig_destroy__ = _mraa.delete_I2c
[docs] def frequency(self, mode): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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)
# Register I2c in _mraa: _mraa.I2c_swigregister(I2c)
[docs]class Pwm(object): r""" API to Pulse Width Modulation. This file defines the PWM interface for libmraa C++ includes: pwm.hpp """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, pin, owner=True, chipid=-1): r""" __init__(Pwm self, int pin, bool owner=True, int chipid=-1) -> Pwm Parameters ---------- pin: int owner: bool chipid: int __init__(Pwm self, int pin, bool owner=True) -> Pwm Parameters ---------- pin: int owner: bool __init__(Pwm self, int pin) -> Pwm Parameters ---------- pin: int Pwm constructor, takes a pointer to the PWM context and initialises the class Parameters: ----------- pwm_context: void * to a PWM context """ _mraa.Pwm_swiginit(self, _mraa.new_Pwm(pin, owner, chipid)) __swig_destroy__ = _mraa.delete_Pwm
[docs] def write(self, percentage): r""" 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 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): r""" 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 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): r""" 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): r""" 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): r""" 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): r""" pulsewidth(Pwm self, float seconds) -> mraa::Result Parameters ---------- seconds: float Set pulsewidth, as represented 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): r""" 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): r""" 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): r""" 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): r""" max_period(Pwm self) -> int Parameters ---------- self: mraa::Pwm * Get the maximum PWM period in us max PWM period in us """ return _mraa.Pwm_max_period(self)
[docs] def min_period(self): r""" min_period(Pwm self) -> int Parameters ---------- self: mraa::Pwm * Get the minimum PWM period in us min PWM period in us """ return _mraa.Pwm_min_period(self)
# Register Pwm in _mraa: _mraa.Pwm_swigregister(Pwm) SPI_MODE0 = _mraa.SPI_MODE0 SPI_MODE1 = _mraa.SPI_MODE1 SPI_MODE2 = _mraa.SPI_MODE2 SPI_MODE3 = _mraa.SPI_MODE3
[docs]class Spi(object): r""" API to Serial Peripheral Interface. This file defines the SPI interface for libmraa C++ includes: spi.hpp """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): r""" __init__(Spi self, int bus) -> Spi Parameters ---------- bus: int __init__(Spi self, int bus, int cs) -> Spi Parameters ---------- bus: int cs: int Spi Constructor, takes a pointer to a SPI context and initialises the SPI class Parameters: ----------- spi_context: void * to SPI context """ _mraa.Spi_swiginit(self, _mraa.new_Spi(*args)) __swig_destroy__ = _mraa.delete_Spi
[docs] def mode(self, mode): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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): r""" 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)
# Register Spi in _mraa: _mraa.Spi_swigregister(Spi)
[docs]class Aio(object): r""" API to Analog IO. This file defines the aio interface for libmraa C++ includes: aio.hpp """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, pin): r""" __init__(Aio self, int pin) -> Aio Parameters ---------- pin: int Aio Constructor, takes a pointer to the AIO context and initialises the AIO class. Aio pins are always 0 indexed reguardless of their position. Check your board mapping for details. An arduino style layout will have A0 as pin14 but AIO0. Parameters: ----------- aio_context: void * to an AIO context """ _mraa.Aio_swiginit(self, _mraa.new_Aio(pin)) __swig_destroy__ = _mraa.delete_Aio
[docs] def read(self): r""" 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): r""" 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): r""" 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): r""" 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)
# Register Aio in _mraa: _mraa.Aio_swigregister(Aio)
[docs]class Uart(object): r""" API to UART (enabling only) This file defines the UART interface for libmraa C++ includes: uart.hpp """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): r""" __init__(Uart self, int uart) -> Uart Parameters ---------- uart: int __init__(Uart self, std::string path) -> Uart Parameters ---------- path: std::string Uart Constructor, takes a pointer to the UART context and initialises the UART class Parameters: ----------- uart_context: void * to a UART context """ _mraa.Uart_swiginit(self, _mraa.new_Uart(*args)) __swig_destroy__ = _mraa.delete_Uart
[docs] def getDevicePath(self): r""" 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): r""" 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): r""" write(Uart self, char const * data) -> int Parameters ---------- data: char const * Write bytes in char* buffer 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): r""" 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): r""" writeStr(Uart self, std::string data) -> int Parameters ---------- data: std::string Write bytes in String object to a device Parameters: ----------- data: 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): r""" 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): r""" 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 sendBreak(self, duration): r""" sendBreak(Uart self, int duration) -> mraa::Result Parameters ---------- duration: int Send a break to the device. Blocks until complete. Parameters: ----------- duration: When 0, send a break lasting at least 250 milliseconds, and not more than 500 milliseconds. When non zero, the break duration is implementation specific. Result of operation """ return _mraa.Uart_sendBreak(self, duration)
[docs] def setBaudRate(self, baud): r""" 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): r""" 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): r""" 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): r""" 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): r""" setNonBlocking(Uart self, bool nonblock) -> mraa::Result Parameters ---------- nonblock: bool Set the blocking state for write operations Parameters: ----------- nonblock: new nonblocking state Result of operation """ return _mraa.Uart_setNonBlocking(self, nonblock)
# Register Uart in _mraa: _mraa.Uart_swigregister(Uart)
[docs]class Led(object): r"""Proxy of C++ mraa::Led class.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): r""" __init__(Led self, int led) -> Led Parameters ---------- led: int __init__(Led self, std::string led_dev) -> Led Parameters ---------- led_dev: std::string """ _mraa.Led_swiginit(self, _mraa.new_Led(*args)) __swig_destroy__ = _mraa.delete_Led
[docs] def setBrightness(self, value): r""" setBrightness(Led self, int value) -> mraa::Result Parameters ---------- value: int """ return _mraa.Led_setBrightness(self, value)
[docs] def readBrightness(self): r""" readBrightness(Led self) -> int Parameters ---------- self: mraa::Led * """ return _mraa.Led_readBrightness(self)
[docs] def readMaxBrightness(self): r""" readMaxBrightness(Led self) -> int Parameters ---------- self: mraa::Led * """ return _mraa.Led_readMaxBrightness(self)
[docs] def trigger(self, trigger): r""" trigger(Led self, char const * trigger) -> mraa::Result Parameters ---------- trigger: char const * """ return _mraa.Led_trigger(self, trigger)
[docs] def clearTrigger(self): r""" clearTrigger(Led self) -> mraa::Result Parameters ---------- self: mraa::Led * """ return _mraa.Led_clearTrigger(self)
# Register Led in _mraa: _mraa.Led_swigregister(Led)