Private
Public Access
2
0

mraa: rename from maa to mraa

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
Thomas Ingleby
2014-06-24 17:24:54 +01:00
parent 79d0da4853
commit 6853997a92
74 changed files with 966 additions and 966 deletions

View File

@@ -27,11 +27,11 @@
extern "C" {
#endif
#include "maa/pwm.h"
#include "maa/aio.h"
#include "maa/gpio.h"
#include "maa/spi.h"
#include "maa/i2c.h"
#include "mraa/pwm.h"
#include "mraa/aio.h"
#include "mraa/gpio.h"
#include "mraa/spi.h"
#include "mraa/i2c.h"
#ifdef __cplusplus
}

View File

@@ -24,9 +24,9 @@
#pragma once
#include "maa/common.h"
#include "maa/pwm.hpp"
#include "maa/aio.hpp"
#include "maa/gpio.hpp"
#include "maa/i2c.hpp"
#include "maa/spi.hpp"
#include "mraa/common.h"
#include "mraa/pwm.hpp"
#include "mraa/aio.hpp"
#include "mraa/gpio.hpp"
#include "mraa/i2c.hpp"
#include "mraa/spi.hpp"

View File

@@ -27,7 +27,7 @@
* @file
* @brief Analog input/output
*
* AIO is the anlog input & output interface to libmaa. It is used to read or
* AIO is the anlog input & output interface to libmraa. It is used to read or
* set the voltage applied to an AIO pin.
*
* @snippet analogin_a0.c Interesting
@@ -51,7 +51,7 @@ extern "C" {
* Opaque pointer definition to the internal struct _aio. This context refers
* to one single AIO pin on the board.
*/
typedef struct _aio* maa_aio_context;
typedef struct _aio* mraa_aio_context;
/**
* Initialise an Analog input device, connected to the specified pin
@@ -59,7 +59,7 @@ typedef struct _aio* maa_aio_context;
* @param pin Channel number to read ADC inputs
* @returns aio context or NULL
*/
maa_aio_context maa_aio_init(unsigned int pin);
mraa_aio_context mraa_aio_init(unsigned int pin);
/**
* Read the input voltage
@@ -67,7 +67,7 @@ maa_aio_context maa_aio_init(unsigned int pin);
* @param dev The AIO context
* @returns The current input voltage, normalised to a 16-bit value
*/
uint16_t maa_aio_read(maa_aio_context dev);
uint16_t mraa_aio_read(mraa_aio_context dev);
/**
* Close the analog input context, this will free the memory for the context
@@ -75,7 +75,7 @@ uint16_t maa_aio_read(maa_aio_context dev);
* @param dev The AIO context
* @return Result of operation
*/
maa_result_t maa_aio_close(maa_aio_context dev);
mraa_result_t mraa_aio_close(mraa_aio_context dev);
#ifdef __cplusplus
}

View File

@@ -26,12 +26,12 @@
#include "aio.h"
namespace maa {
namespace mraa {
/**
* @brief C++ API to Analog IO
*
* This file defines the aio C++ interface for libmaa
* This file defines the aio C++ interface for libmraa
*
* @snippet examples/c++/AioA0.cpp Interesting
*/
@@ -44,13 +44,13 @@ class Aio {
* @param pin channel number to read ADC inputs
*/
Aio(unsigned int pin) {
m_aio = maa_aio_init(pin);
m_aio = mraa_aio_init(pin);
}
/**
* Aio destructor
*/
~Aio() {
maa_aio_close(m_aio);
mraa_aio_close(m_aio);
}
/**
* Read a value from the AIO pin. Note this value can never be outside
@@ -60,10 +60,10 @@ class Aio {
*/
int read() {
// Use basic types to make swig code generation simpler
return (int) maa_aio_read(m_aio);
return (int) mraa_aio_read(m_aio);
}
private:
maa_aio_context m_aio;
mraa_aio_context m_aio;
};
}

View File

@@ -28,7 +28,7 @@
/** @file
*
* This file defines the basic shared values for libmaa
* This file defines the basic shared values for libmraa
*/
#ifdef __cplusplus
@@ -36,38 +36,38 @@ extern "C" {
#endif
/**
* MAA boolean type
* MRAA boolean type
* 1 For TRUE
*/
typedef unsigned int maa_boolean_t;
typedef unsigned int mraa_boolean_t;
/**
* Enum representing different possible modes for a pin.
*/
typedef enum {
MAA_PIN_VALID = 0, /**< Pin Valid */
MAA_PIN_GPIO = 1, /**< General Purpose IO */
MAA_PIN_PWM = 2, /**< Pulse Width Modulation */
MAA_PIN_FAST_GPIO = 3, /**< Faster GPIO */
MAA_PIN_SPI = 4, /**< SPI */
MAA_PIN_I2C = 5, /**< I2C */
MAA_PIN_AIO = 6 /**< Analog in */
} maa_pinmodes_t;
MRAA_PIN_VALID = 0, /**< Pin Valid */
MRAA_PIN_GPIO = 1, /**< General Purpose IO */
MRAA_PIN_PWM = 2, /**< Pulse Width Modulation */
MRAA_PIN_FAST_GPIO = 3, /**< Faster GPIO */
MRAA_PIN_SPI = 4, /**< SPI */
MRAA_PIN_I2C = 5, /**< I2C */
MRAA_PIN_AIO = 6 /**< Analog in */
} mraa_pinmodes_t;
/**
* A bitfield representing the capabilities of a pin.
*/
typedef struct {
/*@{*/
maa_boolean_t valid:1; /**< Is the pin valid at all */
maa_boolean_t gpio:1; /**< Is the pin gpio capable */
maa_boolean_t pwm:1; /**< Is the pin pwm capable */
maa_boolean_t fast_gpio:1; /**< Is the pin fast gpio capable */
maa_boolean_t spi:1; /**< Is the pin spi capable */
maa_boolean_t i2c:1; /**< Is the pin i2c capable */
maa_boolean_t aio:1; /**< Is the pin analog input capable */
mraa_boolean_t valid:1; /**< Is the pin valid at all */
mraa_boolean_t gpio:1; /**< Is the pin gpio capable */
mraa_boolean_t pwm:1; /**< Is the pin pwm capable */
mraa_boolean_t fast_gpio:1; /**< Is the pin fast gpio capable */
mraa_boolean_t spi:1; /**< Is the pin spi capable */
mraa_boolean_t i2c:1; /**< Is the pin i2c capable */
mraa_boolean_t aio:1; /**< Is the pin analog input capable */
/*@}*/
} maa_pincapabilities_t;
} mraa_pincapabilities_t;
/**
* A Structure representing a multiplexer and the required value
@@ -77,36 +77,36 @@ typedef struct {
unsigned int pin; /**< Raw GPIO pin id */
unsigned int value; /**< Raw GPIO value */
/*@}*/
} maa_mux_t;
} mraa_mux_t;
typedef struct {
maa_boolean_t complex_pin:1;
maa_boolean_t output_en:1;
maa_boolean_t output_en_high:1;
maa_boolean_t pullup_en:1;
maa_boolean_t pullup_en_hiz:1;
} maa_pin_cap_complex_t;
mraa_boolean_t complex_pin:1;
mraa_boolean_t output_en:1;
mraa_boolean_t output_en_high:1;
mraa_boolean_t pullup_en:1;
mraa_boolean_t pullup_en_hiz:1;
} mraa_pin_cap_complex_t;
typedef struct {
/*@{*/
unsigned int pinmap; /**< sysfs pin */
unsigned int parent_id; /** parent chip id */
unsigned int mux_total; /** Numfer of muxes needed for operation of pin */
maa_mux_t mux[6]; /** Array holding information about mux */
mraa_mux_t mux[6]; /** Array holding information about mux */
unsigned int output_enable; /** Output Enable GPIO, for level shifting */
unsigned int pullup_enable; /** Pull-Up enable GPIO, inputs */
maa_pin_cap_complex_t complex_cap;
mraa_pin_cap_complex_t complex_cap;
/*@}*/
} maa_pin_t;
} mraa_pin_t;
typedef struct {
/*@{*/
char mem_dev[32]; /**< Memory device to use /dev/uio0 etc */
unsigned int mem_sz; /** Size of memory to map */
unsigned int bit_pos; /** Position of value bit */
maa_pin_t gpio; /** GPio context containing none mmap info */
mraa_pin_t gpio; /** GPio context containing none mmap info */
/*@}*/
} maa_mmap_pin_t;
} mraa_mmap_pin_t;
/**
* A Structure representing a physical Pin.
@@ -114,15 +114,15 @@ typedef struct {
typedef struct {
/*@{*/
char name[8]; /**< Pin's real world name */
maa_pincapabilities_t capabilites; /**< Pin Capabiliites */
maa_pin_t gpio; /**< GPIO structure */
maa_pin_t pwm; /**< PWM structure */
maa_pin_t aio; /**< Anaglog Pin */
maa_mmap_pin_t mmap; /**< GPIO through memory */
maa_pin_t i2c; /**< i2c bus/pin */
maa_pin_t spi; /**< spi bus/pin */
mraa_pincapabilities_t capabilites; /**< Pin Capabiliites */
mraa_pin_t gpio; /**< GPIO structure */
mraa_pin_t pwm; /**< PWM structure */
mraa_pin_t aio; /**< Anaglog Pin */
mraa_mmap_pin_t mmap; /**< GPIO through memory */
mraa_pin_t i2c; /**< i2c bus/pin */
mraa_pin_t spi; /**< spi bus/pin */
/*@}*/
} maa_pininfo_t;
} mraa_pininfo_t;
/**
* A Structure representing the physical properties of a i2c bus.
@@ -133,7 +133,7 @@ typedef struct {
unsigned int scl; /**< i2c SCL */
unsigned int sda; /**< i2c SDA */
/*@}*/
} maa_i2c_bus_t;
} mraa_i2c_bus_t;
/**
* A Structure representing the physical properties of a spi bus.
@@ -142,13 +142,13 @@ typedef struct {
/*@{*/
unsigned int bus_id; /**< The Bus ID as exposed to the system. */
unsigned int slave_s; /**< Slave select */
maa_boolean_t three_wire; /**< Is the bus only a three wire system */
mraa_boolean_t three_wire; /**< Is the bus only a three wire system */
unsigned int sclk; /**< Serial Clock */
unsigned int mosi; /**< Master Out, Slave In. */
unsigned int miso; /**< Master In, Slave Out. */
unsigned int cs; /**< Chip Select, used when the board is a spi slave */
/*@}*/
} maa_spi_bus_t;
} mraa_spi_bus_t;
/**
* A Structure representing a platform/board.
@@ -159,29 +159,29 @@ typedef struct {
unsigned int gpio_count; /**< GPIO Count */
unsigned int aio_count; /**< Analog side Count */
unsigned int i2c_bus_count; /**< Usable i2c Count */
maa_i2c_bus_t i2c_bus[6]; /**< Array of i2c */
mraa_i2c_bus_t i2c_bus[6]; /**< Array of i2c */
unsigned int def_i2c_bus; /**< Position in array of default i2c bus */
unsigned int spi_bus_count; /**< Usable spi Count */
maa_spi_bus_t spi_bus[6]; /**< Array of spi */
mraa_spi_bus_t spi_bus[6]; /**< Array of spi */
unsigned int def_spi_bus; /**< Position in array of defult spi bus */
maa_pininfo_t* pins; /**< Pointer to pin array */
mraa_pininfo_t* pins; /**< Pointer to pin array */
/*@}*/
} maa_board_t;
} mraa_board_t;
/**
* Initialise MAA
* Initialise MRAA
*
* Detects running platform and attempts to use included pinmap
*
* @return Result of operation
*/
#ifndef SWIG
// this sets a compiler attribute (supported by GCC & clang) to have maa_init()
// this sets a compiler attribute (supported by GCC & clang) to have mraa_init()
// be called as a constructor make sure your libc supports this! uclibc needs
// to be compiled with UCLIBC_CTOR_DTOR
maa_result_t maa_init() __attribute__((constructor));
mraa_result_t mraa_init() __attribute__((constructor));
#else
maa_result_t maa_init();
mraa_result_t mraa_init();
#endif
/**
@@ -191,7 +191,7 @@ maa_result_t maa_init();
* @param mode the mode to be tested.
* @return boolean if the mode is supported, 0=false.
*/
maa_boolean_t maa_pin_mode_test(int pin, maa_pinmodes_t mode);
mraa_boolean_t mraa_pin_mode_test(int pin, mraa_pinmodes_t mode);
#ifdef __cplusplus
}

View File

@@ -28,7 +28,7 @@
* @file
* @brief General Purpose IO
*
* Gpio is the General Purpose IO interface to libmaa. It's features depends on
* Gpio is the General Purpose IO interface to libmraa. It's features depends on
* the board type used, it can use gpiolibs (exported via a kernel module
* through sysfs), or memory mapped IO via a /dev/uio device or /dev/mem
* depending again on the board configuratio, or memory mapped IO via a
@@ -53,34 +53,34 @@ extern "C" {
/**
* Opaque pointer definition to the internal struct _gpio
*/
typedef struct _gpio* maa_gpio_context;
typedef struct _gpio* mraa_gpio_context;
/**
* Gpio Output modes
*/
typedef enum {
MAA_GPIO_STRONG = 0, /**< Default. Strong high and low */
MAA_GPIO_PULLUP = 1, /**< Resistive High */
MAA_GPIO_PULLDOWN = 2, /**< Resistive Low */
MAA_GPIO_HIZ = 3 /**< High Z State */
MRAA_GPIO_STRONG = 0, /**< Default. Strong high and low */
MRAA_GPIO_PULLUP = 1, /**< Resistive High */
MRAA_GPIO_PULLDOWN = 2, /**< Resistive Low */
MRAA_GPIO_HIZ = 3 /**< High Z State */
} gpio_mode_t;
/**
* Gpio Direction options
*/
typedef enum {
MAA_GPIO_OUT = 0, /**< Output. A Mode can also be set */
MAA_GPIO_IN = 1 /**< Input */
MRAA_GPIO_OUT = 0, /**< Output. A Mode can also be set */
MRAA_GPIO_IN = 1 /**< Input */
} gpio_dir_t;
/**
* Gpio Edge types for interupts
*/
typedef enum {
MAA_GPIO_EDGE_NONE = 0, /**< No interrupt on Gpio */
MAA_GPIO_EDGE_BOTH = 1, /**< Interupt on rising & falling */
MAA_GPIO_EDGE_RISING = 2, /**< Interupt on rising only */
MAA_GPIO_EDGE_FALLING = 3 /**< Interupt on falling only */
MRAA_GPIO_EDGE_NONE = 0, /**< No interrupt on Gpio */
MRAA_GPIO_EDGE_BOTH = 1, /**< Interupt on rising & falling */
MRAA_GPIO_EDGE_RISING = 2, /**< Interupt on rising only */
MRAA_GPIO_EDGE_FALLING = 3 /**< Interupt on falling only */
} gpio_edge_t;
/**
@@ -89,7 +89,7 @@ typedef enum {
* @param pin Pin number read from the board, i.e IO3 is 3
* @returns gpio context or NULL
*/
maa_gpio_context maa_gpio_init(int pin);
mraa_gpio_context mraa_gpio_init(int pin);
/**
* Initialise gpio context without any mapping to a pin
@@ -97,7 +97,7 @@ maa_gpio_context maa_gpio_init(int pin);
* @param gpiopin gpio pin as listed in SYSFS
* @return gpio context or NULL
*/
maa_gpio_context maa_gpio_init_raw(int gpiopin);
mraa_gpio_context mraa_gpio_init_raw(int gpiopin);
/**
* Set the edge mode on the gpio
@@ -106,7 +106,7 @@ maa_gpio_context maa_gpio_init_raw(int gpiopin);
* @param mode The edge mode to set the gpio into
* @return Result of operation
*/
maa_result_t maa_gpio_edge_mode(maa_gpio_context dev, gpio_edge_t mode);
mraa_result_t mraa_gpio_edge_mode(mraa_gpio_context dev, gpio_edge_t mode);
/**
* Set an interupt on pin
@@ -118,16 +118,16 @@ maa_result_t maa_gpio_edge_mode(maa_gpio_context dev, gpio_edge_t mode);
* @param args Arguments passed to the interrupt handler (fptr)
* @return Result of operation
*/
maa_result_t maa_gpio_isr(maa_gpio_context dev, gpio_edge_t edge, void (*fptr)(void *), void * args);
mraa_result_t mraa_gpio_isr(mraa_gpio_context dev, gpio_edge_t edge, void (*fptr)(void *), void * args);
/**
* Stop the current interupt watcher on this Gpio, and set the Gpio edge mode
* to MAA_GPIO_EDGE_NONE
* to MRAA_GPIO_EDGE_NONE
*
* @param dev The Gpio context
* @return Result of operation
*/
maa_result_t maa_gpio_isr_exit(maa_gpio_context dev);
mraa_result_t mraa_gpio_isr_exit(mraa_gpio_context dev);
/**
* Set Gpio Output Mode,
@@ -136,7 +136,7 @@ maa_result_t maa_gpio_isr_exit(maa_gpio_context dev);
* @param mode The Gpio Output Mode
* @return Result of operation
*/
maa_result_t maa_gpio_mode(maa_gpio_context dev, gpio_mode_t mode);
mraa_result_t mraa_gpio_mode(mraa_gpio_context dev, gpio_mode_t mode);
/**
* Set Gpio direction
@@ -145,7 +145,7 @@ maa_result_t maa_gpio_mode(maa_gpio_context dev, gpio_mode_t mode);
* @param dir The direction of the Gpio
* @return Result of operation
*/
maa_result_t maa_gpio_dir(maa_gpio_context dev, gpio_dir_t dir);
mraa_result_t mraa_gpio_dir(mraa_gpio_context dev, gpio_dir_t dir);
/**
* Close the Gpio context
@@ -154,7 +154,7 @@ maa_result_t maa_gpio_dir(maa_gpio_context dev, gpio_dir_t dir);
* @param dev The Gpio context
* @return Result of operation
*/
maa_result_t maa_gpio_close(maa_gpio_context dev);
mraa_result_t mraa_gpio_close(mraa_gpio_context dev);
/**
* Read the Gpio value.
@@ -162,7 +162,7 @@ maa_result_t maa_gpio_close(maa_gpio_context dev);
* @param dev The Gpio context
* @return Result of operation
*/
int maa_gpio_read(maa_gpio_context dev);
int mraa_gpio_read(mraa_gpio_context dev);
/**
* Write to the Gpio Value.
@@ -171,7 +171,7 @@ int maa_gpio_read(maa_gpio_context dev);
* @param value Integer value to write
* @return Result of operation
*/
maa_result_t maa_gpio_write(maa_gpio_context dev, int value);
mraa_result_t mraa_gpio_write(mraa_gpio_context dev, int value);
/**
* Change ownership of the context.
@@ -180,7 +180,7 @@ maa_result_t maa_gpio_write(maa_gpio_context dev, int value);
* @param owner Does this context own the pin
* @return Result of operation
*/
maa_result_t maa_gpio_owner(maa_gpio_context dev, maa_boolean_t owner);
mraa_result_t mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t owner);
/**
* Enable using memory mapped io instead of sysfs
@@ -189,7 +189,7 @@ maa_result_t maa_gpio_owner(maa_gpio_context dev, maa_boolean_t owner);
* @param mmap Use mmap instead of sysfs
* @return Result of operation
*/
maa_result_t maa_gpio_use_mmaped(maa_gpio_context dev, maa_boolean_t mmap);
mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
#ifdef __cplusplus
}

View File

@@ -26,7 +26,7 @@
#include "gpio.h"
namespace maa {
namespace mraa {
// These enums must match the enums in gpio.h
@@ -61,7 +61,7 @@ typedef enum {
/**
* @brief C++ API to General Purpose IO
*
* This file defines the gpio C++ interface for libmaa
* This file defines the gpio C++ interface for libmraa
*
* @snippet Blink-IO.cpp Interesting
*/
@@ -81,18 +81,18 @@ class Gpio {
*/
Gpio(int pin, bool owner=true, bool raw=false) {
if (raw)
m_gpio = maa_gpio_init_raw(pin);
m_gpio = mraa_gpio_init_raw(pin);
else
m_gpio = maa_gpio_init(pin);
m_gpio = mraa_gpio_init(pin);
if (!owner)
maa_gpio_owner(m_gpio, 0);
mraa_gpio_owner(m_gpio, 0);
}
/**
* Gpio object destructor, this will only unexport the gpio if we where
* the owner
*/
~Gpio() {
maa_gpio_close(m_gpio);
mraa_gpio_close(m_gpio);
}
/**
* Set the edge mode for ISR
@@ -100,12 +100,12 @@ class Gpio {
* @param mode The edge mode to set
* @return Result of operation
*/
maa_result_t edge(Edge mode) {
return maa_gpio_edge_mode(m_gpio, (gpio_edge_t) mode);
mraa_result_t edge(Edge mode) {
return mraa_gpio_edge_mode(m_gpio, (gpio_edge_t) mode);
}
#if defined(SWIGPYTHON)
maa_result_t isr(Edge mode, PyObject *pyfunc, PyObject* args) {
return maa_gpio_isr(m_gpio, (gpio_edge_t) mode, (void (*) (void *)) pyfunc, (void *) args);
mraa_result_t isr(Edge mode, PyObject *pyfunc, PyObject* args) {
return mraa_gpio_isr(m_gpio, (gpio_edge_t) mode, (void (*) (void *)) pyfunc, (void *) args);
}
#else
/**
@@ -117,8 +117,8 @@ class Gpio {
* @param args Arguments passed to the interrupt handler (fptr)
* @return Result of operation
*/
maa_result_t isr(Edge mode, void (*fptr)(void *), void * args) {
return maa_gpio_isr(m_gpio, (gpio_edge_t) mode, fptr, args);
mraa_result_t isr(Edge mode, void (*fptr)(void *), void * args) {
return mraa_gpio_isr(m_gpio, (gpio_edge_t) mode, fptr, args);
}
#endif
/**
@@ -127,8 +127,8 @@ class Gpio {
*
* @return Result of operation
*/
maa_result_t isrExit() {
return maa_gpio_isr_exit(m_gpio);
mraa_result_t isrExit() {
return mraa_gpio_isr_exit(m_gpio);
}
/**
* Change Gpio mode
@@ -136,8 +136,8 @@ class Gpio {
* @param mode The mode to change the gpio into
* @return Result of operation
*/
maa_result_t mode(Mode mode) {
return maa_gpio_mode(m_gpio, (gpio_mode_t) mode);
mraa_result_t mode(Mode mode) {
return mraa_gpio_mode(m_gpio, (gpio_mode_t) mode);
}
/**
* Change Gpio direction
@@ -145,8 +145,8 @@ class Gpio {
* @param dir The direction to change the gpio into
* @return Result of operation
*/
maa_result_t dir(Dir dir) {
return maa_gpio_dir(m_gpio, (gpio_dir_t) dir);
mraa_result_t dir(Dir dir) {
return mraa_gpio_dir(m_gpio, (gpio_dir_t) dir);
}
/**
* Read value from Gpio
@@ -154,7 +154,7 @@ class Gpio {
* @return Gpio value
*/
int read() {
return maa_gpio_read(m_gpio);
return mraa_gpio_read(m_gpio);
}
/**
* Write value to Gpio
@@ -162,11 +162,11 @@ class Gpio {
* @param value Value to write to Gpio
* @return Result of operation
*/
maa_result_t write(int value) {
return maa_gpio_write(m_gpio, value);
mraa_result_t write(int value) {
return mraa_gpio_write(m_gpio, value);
}
private:
maa_gpio_context m_gpio;
mraa_gpio_context m_gpio;
};
}

View File

@@ -28,7 +28,7 @@
* @file
* @brief Inter-Integrated Circuit
*
* This file defines the i2c/Iic interface for libmaa. A context represents a
* This file defines the i2c/Iic interface for libmraa. A context represents a
* bus and that bus may contain multiple addresses or i2c slaves. It 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
@@ -52,7 +52,7 @@ extern "C" {
/**
* Opaque pointer definition to the internal struct _i2c
*/
typedef struct _i2c* maa_i2c_context;
typedef struct _i2c* mraa_i2c_context;
/**
* Initialise i2c context, using board defintions
@@ -60,7 +60,7 @@ typedef struct _i2c* maa_i2c_context;
* @param bus i2c bus to use
* @return i2c context or NULL
*/
maa_i2c_context maa_i2c_init(int bus);
mraa_i2c_context mraa_i2c_init(int bus);
/**
* Initialise i2c context, passing in spi bus to use.
@@ -68,7 +68,7 @@ maa_i2c_context maa_i2c_init(int bus);
* @param bus The i2c bus to use i.e. /dev/i2c-2 would be "2"
* @return i2c context or NULL
*/
maa_i2c_context maa_i2c_init_raw(unsigned int bus);
mraa_i2c_context mraa_i2c_init_raw(unsigned int bus);
/**
* Sets the frequency of the i2c context
@@ -77,7 +77,7 @@ maa_i2c_context maa_i2c_init_raw(unsigned int bus);
* @param hz The bus frequency in hertz
* @return Result of operation
*/
maa_result_t maa_i2c_frequency(maa_i2c_context dev, int hz);
mraa_result_t mraa_i2c_frequency(mraa_i2c_context dev, int hz);
/**
* Read from an i2c context
@@ -87,7 +87,7 @@ maa_result_t maa_i2c_frequency(maa_i2c_context dev, int hz);
* @param length max number of bytes to read
* @return length of the read in bytes or 0
*/
int maa_i2c_read(maa_i2c_context dev, uint8_t *data, int length);
int mraa_i2c_read(mraa_i2c_context dev, uint8_t *data, int length);
/**
* Read a single byte from the i2c context
@@ -95,7 +95,7 @@ int maa_i2c_read(maa_i2c_context dev, uint8_t *data, int length);
* @param dev The i2c context
* @return The result of the read or -1 if failed
*/
uint8_t maa_i2c_read_byte(maa_i2c_context dev);
uint8_t mraa_i2c_read_byte(mraa_i2c_context dev);
/**
* Write to an i2c context
@@ -105,7 +105,7 @@ uint8_t maa_i2c_read_byte(maa_i2c_context dev);
* @param length the number of bytes to transmit
* @return Result of operation
*/
maa_result_t maa_i2c_write(maa_i2c_context dev, const uint8_t *data, int length);
mraa_result_t mraa_i2c_write(mraa_i2c_context dev, const uint8_t *data, int length);
/**
* Write a single byte to an i2c context
@@ -114,7 +114,7 @@ maa_result_t maa_i2c_write(maa_i2c_context dev, const uint8_t *data, int length)
* @param data The byte to write
* @return Result of operation
*/
maa_result_t maa_i2c_write_byte(maa_i2c_context dev, const uint8_t data);
mraa_result_t mraa_i2c_write_byte(mraa_i2c_context dev, const uint8_t data);
/**
* Sets the i2c context address.
@@ -125,15 +125,15 @@ maa_result_t maa_i2c_write_byte(maa_i2c_context dev, const uint8_t data);
* general call address.
* @return Result of operation
*/
maa_result_t maa_i2c_address(maa_i2c_context dev, int address);
mraa_result_t mraa_i2c_address(mraa_i2c_context dev, int address);
/**
* De-inits an maa_i2c_context device
* De-inits an mraa_i2c_context device
*
* @param dev The i2c context
* @return Result of operation
*/
maa_result_t maa_i2c_stop(maa_i2c_context dev);
mraa_result_t mraa_i2c_stop(mraa_i2c_context dev);
#ifdef __cplusplus
}

View File

@@ -26,12 +26,12 @@
#include "i2c.h"
namespace maa {
namespace mraa {
/**
* @brief C++ API to Inter-Integrated Circuit
*
* This file defines the I2c C++ interface for libmaa
* This file defines the I2c C++ interface for libmraa
*
* @snippet I2c-compass.cpp Interesting
*/
@@ -47,9 +47,9 @@ class I2c {
*/
I2c(int bus, bool raw=false) {
if (raw)
m_i2c = maa_i2c_init_raw(bus);
m_i2c = mraa_i2c_init_raw(bus);
else
m_i2c = maa_i2c_init(bus);
m_i2c = mraa_i2c_init(bus);
}
/**
* Closes the I2c Bus used. This does not guarrantee the bus will not
@@ -57,7 +57,7 @@ class I2c {
* slaves.
*/
~I2c() {
maa_i2c_stop(m_i2c);
mraa_i2c_stop(m_i2c);
}
/**
* Sets the i2c Frequency for communication. Your board may not support
@@ -67,8 +67,8 @@ class I2c {
* @param hz Frequency to set the bus to in hz
* @return Result of operation
*/
maa_result_t frequency(int hz) {
return maa_i2c_frequency(m_i2c, hz);
mraa_result_t frequency(int hz) {
return mraa_i2c_frequency(m_i2c, hz);
}
/**
* Set the slave to talk to, typically called before every read/write
@@ -77,8 +77,8 @@ class I2c {
* @param address Communicate to the i2c slave on this address
* @return Result of operation
*/
maa_result_t address(int address) {
return maa_i2c_address(m_i2c, address);
mraa_result_t address(int address) {
return mraa_i2c_address(m_i2c, address);
}
/**
* Read exactly one byte from the bus
@@ -86,7 +86,7 @@ class I2c {
* @return Char read from the bus
*/
unsigned char readByte() {
return (unsigned char) maa_i2c_read_byte(m_i2c);
return (unsigned char) mraa_i2c_read_byte(m_i2c);
}
/**
* Read mutliple bytes from the bus
@@ -96,7 +96,7 @@ class I2c {
* @return length of the read or 0 if failed
*/
int read(unsigned char * data, int length) {
return maa_i2c_read(m_i2c, data, length);
return mraa_i2c_read(m_i2c, data, length);
}
/**
* Write one byte to the bus
@@ -105,8 +105,8 @@ class I2c {
* @param length Size of buffer to send
* @return Result of operation
*/
maa_result_t write(const unsigned char* data, int length) {
return maa_i2c_write(m_i2c, data, length);
mraa_result_t write(const unsigned char* data, int length) {
return mraa_i2c_write(m_i2c, data, length);
}
/**
@@ -116,9 +116,9 @@ class I2c {
* @param data Value to write to register
* @return Result of operation
*/
maa_result_t writeReg(const unsigned char reg, const unsigned char data) {
mraa_result_t writeReg(const unsigned char reg, const unsigned char data) {
const unsigned char buf[2] = {reg, data};
return maa_i2c_write(m_i2c, buf, 2);
return mraa_i2c_write(m_i2c, buf, 2);
}
/**
@@ -127,11 +127,11 @@ class I2c {
* @param data The byte to send on the bus
* @return Result of operation
*/
maa_result_t write(const unsigned char data) {
return maa_i2c_write_byte(m_i2c, data);
mraa_result_t write(const unsigned char data) {
return mraa_i2c_write_byte(m_i2c, data);
}
private:
maa_i2c_context m_i2c;
mraa_i2c_context m_i2c;
};
}

View File

@@ -28,7 +28,7 @@
* @file
* @brief Pulse Width Modulation module
*
* PWM is the Pulse Width Modulation interface to libmaa. It allows the
* PWM is the Pulse Width Modulation interface to libmraa. It allows the
* generation of a signal on a pin. Some boards may have higher or lower levels
* of resolution so make sure you check the board & pin you are using before
* hand.
@@ -45,7 +45,7 @@ extern "C" {
#include "common.h"
typedef struct _pwm* maa_pwm_context;
typedef struct _pwm* mraa_pwm_context;
/**
* Initialise pwm_context, uses board mapping
@@ -53,7 +53,7 @@ typedef struct _pwm* maa_pwm_context;
* @param pin The PWM PIN
* @return pwm context or NULL
*/
maa_pwm_context maa_pwm_init(int pin);
mraa_pwm_context mraa_pwm_init(int pin);
/**
* Initialise pwm_context, raw mode
@@ -62,7 +62,7 @@ maa_pwm_context maa_pwm_init(int pin);
* @param pin The PWM PIN.
* @return pwm context or NULL
*/
maa_pwm_context maa_pwm_init_raw(int chipid, int pin);
mraa_pwm_context mraa_pwm_init_raw(int chipid, int pin);
/**
* Set the ouput duty-cycle percentage, as a float
@@ -73,7 +73,7 @@ maa_pwm_context maa_pwm_init_raw(int chipid, int pin);
* Values above or below this range will be set at either 0.0f or 1.0f
* @return Result of operation
*/
maa_result_t maa_pwm_write(maa_pwm_context dev, float percentage);
mraa_result_t mraa_pwm_write(mraa_pwm_context dev, float percentage);
/**
* Read the ouput duty-cycle percentage, as a float
@@ -83,7 +83,7 @@ maa_result_t maa_pwm_write(maa_pwm_context dev, float percentage);
* 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
*/
float maa_pwm_read(maa_pwm_context dev);
float mraa_pwm_read(mraa_pwm_context dev);
/**
* Set the PWM period as seconds represented in a float
@@ -92,7 +92,7 @@ float maa_pwm_read(maa_pwm_context dev);
* @param seconds Period represented as a float in seconds
* @return Result of operation
*/
maa_result_t maa_pwm_period(maa_pwm_context dev, float seconds);
mraa_result_t mraa_pwm_period(mraa_pwm_context dev, float seconds);
/**
* Set period, milliseconds.
@@ -101,7 +101,7 @@ maa_result_t maa_pwm_period(maa_pwm_context dev, float seconds);
* @param ms Milliseconds for period
* @return Result of operation
*/
maa_result_t maa_pwm_period_ms(maa_pwm_context dev, int ms);
mraa_result_t mraa_pwm_period_ms(mraa_pwm_context dev, int ms);
/**
* Set period, microseconds
@@ -110,7 +110,7 @@ maa_result_t maa_pwm_period_ms(maa_pwm_context dev, int ms);
* @param us Microseconds as period
* @return Result of operation
*/
maa_result_t maa_pwm_period_us(maa_pwm_context dev, int us);
mraa_result_t mraa_pwm_period_us(mraa_pwm_context dev, int us);
/**
* Set pulsewidth, As represnted by seconds in a (float)
@@ -119,7 +119,7 @@ maa_result_t maa_pwm_period_us(maa_pwm_context dev, int us);
* @param seconds The duration of a pulse
* @return Result of operation
*/
maa_result_t maa_pwm_pulsewidth(maa_pwm_context dev, float seconds);
mraa_result_t mraa_pwm_pulsewidth(mraa_pwm_context dev, float seconds);
/**
* Set pulsewidth, milliseconds
@@ -128,7 +128,7 @@ maa_result_t maa_pwm_pulsewidth(maa_pwm_context dev, float seconds);
* @param ms Milliseconds for pulsewidth
* @return Result of operation
*/
maa_result_t maa_pwm_pulsewidth_ms(maa_pwm_context dev, int ms);
mraa_result_t mraa_pwm_pulsewidth_ms(mraa_pwm_context dev, int ms);
/**
* Set pulsewidth, microseconds
@@ -137,7 +137,7 @@ maa_result_t maa_pwm_pulsewidth_ms(maa_pwm_context dev, int ms);
* @param us Microseconds for pulsewidth
* @return Result of operation
*/
maa_result_t maa_pwm_pulsewidth_us(maa_pwm_context dev, int us);
mraa_result_t mraa_pwm_pulsewidth_us(mraa_pwm_context dev, int us);
/**
* Set the enable status of the PWM pin. None zero will assume on with output being driven.
@@ -147,7 +147,7 @@ maa_result_t maa_pwm_pulsewidth_us(maa_pwm_context dev, int us);
* @param enable Toggle status of pin
* @return Result of operation.
*/
maa_result_t maa_pwm_enable(maa_pwm_context dev, int enable);
mraa_result_t mraa_pwm_enable(mraa_pwm_context dev, int enable);
/**
* Change ownership of context
@@ -156,7 +156,7 @@ maa_result_t maa_pwm_enable(maa_pwm_context dev, int enable);
* @param owner Ownership boolean
* @return Result of operation
*/
maa_result_t maa_pwm_owner(maa_pwm_context dev, maa_boolean_t owner);
mraa_result_t mraa_pwm_owner(mraa_pwm_context dev, mraa_boolean_t owner);
/**
* Close and unexport the PWM pin
@@ -164,7 +164,7 @@ maa_result_t maa_pwm_owner(maa_pwm_context dev, maa_boolean_t owner);
* @param dev The pwm context to use
* @return Result of operation
*/
maa_result_t maa_pwm_close(maa_pwm_context dev);
mraa_result_t mraa_pwm_close(mraa_pwm_context dev);
#ifdef __cplusplus
}

View File

@@ -26,12 +26,12 @@
#include "pwm.h"
namespace maa {
namespace mraa {
/**
* @brief C++ API to Pulse Width Modulation
*
* This file defines the PWM C++ interface for libmaa
* This file defines the PWM C++ interface for libmraa
*
* @snippet Pwm3-cycle.cpp Interesting
*/
@@ -48,17 +48,17 @@ class Pwm {
*/
Pwm(int pin, int chipid=-1, bool owner = true) {
if (chipid == -1)
m_pwm = maa_pwm_init(pin);
m_pwm = mraa_pwm_init(pin);
else
m_pwm = maa_pwm_init_raw(pin, chipid);
m_pwm = mraa_pwm_init_raw(pin, chipid);
if (!owner)
maa_pwm_owner(m_pwm, 0);
mraa_pwm_owner(m_pwm, 0);
}
/**
* Pwm destructor
*/
~Pwm() {
maa_pwm_close(m_pwm);
mraa_pwm_close(m_pwm);
}
/**
* Set the output duty-cycle percentage, as a float
@@ -69,8 +69,8 @@ class Pwm {
* 1.0f
* @return Result of operation
*/
maa_result_t write(float percentage) {
return maa_pwm_write(m_pwm, percentage);
mraa_result_t write(float percentage) {
return mraa_pwm_write(m_pwm, percentage);
}
/**
* Read the ouput duty-cycle percentage, as a float
@@ -81,7 +81,7 @@ class Pwm {
* 1.0f
*/
float read() {
return maa_pwm_read(m_pwm);
return mraa_pwm_read(m_pwm);
}
/**
* Set the PWM period as seconds represented in a float
@@ -89,8 +89,8 @@ class Pwm {
* @param period Period represented as a float in seconds
* @return Result of operation
*/
maa_result_t period(float period) {
return maa_pwm_period(m_pwm, period);
mraa_result_t period(float period) {
return mraa_pwm_period(m_pwm, period);
}
/**
* Set period, milliseconds
@@ -98,8 +98,8 @@ class Pwm {
* @param ms milliseconds for period
* @return Result of operation
*/
maa_result_t period_ms(int ms) {
return maa_pwm_period_ms(m_pwm, ms);
mraa_result_t period_ms(int ms) {
return mraa_pwm_period_ms(m_pwm, ms);
}
/**
* Set period, microseconds
@@ -107,8 +107,8 @@ class Pwm {
* @param us microseconds as period
* @return Result of operation
*/
maa_result_t period_us(int us) {
return maa_pwm_period_us(m_pwm, us);
mraa_result_t period_us(int us) {
return mraa_pwm_period_us(m_pwm, us);
}
/**
* Set pulsewidth, As represnted by seconds in a (float)
@@ -116,8 +116,8 @@ class Pwm {
* @param seconds The duration of a pulse
* @return Result of operation
*/
maa_result_t pulsewidth(float seconds) {
return maa_pwm_pulsewidth(m_pwm, seconds);
mraa_result_t pulsewidth(float seconds) {
return mraa_pwm_pulsewidth(m_pwm, seconds);
}
/**
* Set pulsewidth, milliseconds
@@ -125,8 +125,8 @@ class Pwm {
* @param ms milliseconds for pulsewidth
* @return Result of operation
*/
maa_result_t pulsewidth_ms(int ms) {
return maa_pwm_pulsewidth_ms(m_pwm, ms);
mraa_result_t pulsewidth_ms(int ms) {
return mraa_pwm_pulsewidth_ms(m_pwm, ms);
}
/**
* The pulsewidth, microseconds
@@ -134,8 +134,8 @@ class Pwm {
* @param us microseconds for pulsewidth
* @return Result of operation
*/
maa_result_t pulsewidth_us(int us) {
return maa_pwm_pulsewidth_us(m_pwm, us);
mraa_result_t pulsewidth_us(int us) {
return mraa_pwm_pulsewidth_us(m_pwm, us);
}
/**
* Set the enable status of the PWM pin. None zero will assume on with
@@ -144,14 +144,14 @@ class Pwm {
* @param enable enable status of pin
* @return Result of operation
*/
maa_result_t enable(bool enable) {
mraa_result_t enable(bool enable) {
if (enable)
return maa_pwm_enable(m_pwm, 1);
return mraa_pwm_enable(m_pwm, 1);
else
return maa_pwm_enable(m_pwm, 0);
return mraa_pwm_enable(m_pwm, 0);
}
private:
maa_pwm_context m_pwm;
mraa_pwm_context m_pwm;
};
}

View File

@@ -28,7 +28,7 @@
* @file
* @brief System Packet Interface
*
* This file defines the spi interface for libmaa
* This file defines the spi interface for libmraa
*
* @snippet spi_mcp4261.c Interesting
*/
@@ -46,7 +46,7 @@ extern "C" {
/**
* Opaque pointer definition to the internal struct _spi
*/
typedef struct _spi* maa_spi_context;
typedef struct _spi* mraa_spi_context;
/**
* Initialise SPI_context, uses board mapping. Sets the muxes
@@ -54,7 +54,7 @@ typedef struct _spi* maa_spi_context;
* @param bus Bus to use, as listed in platform definition, normally 0
* @return Spi context or NULL
*/
maa_spi_context maa_spi_init(int bus);
mraa_spi_context mraa_spi_init(int bus);
/**
* Set the SPI device mode. see spidev 0-3.
@@ -63,15 +63,15 @@ maa_spi_context maa_spi_init(int bus);
* @param mode The SPI mode, See Linux spidev
* @return Spi context or NULL
*/
maa_result_t maa_spi_mode(maa_spi_context dev,unsigned short mode);
mraa_result_t mraa_spi_mode(mraa_spi_context dev,unsigned short mode);
/** Set the SPI device operating clock frequency.
*
* @param dev the Spi context
* @param hz the frequency in hz
* @return maa_spi_context The returned initialised SPI context
* @return mraa_spi_context The returned initialised SPI context
*/
maa_result_t maa_spi_frequency(maa_spi_context dev, int hz);
mraa_result_t mraa_spi_frequency(mraa_spi_context dev, int hz);
/** Write Single Byte to the SPI device.
*
@@ -79,7 +79,7 @@ maa_result_t maa_spi_frequency(maa_spi_context dev, int hz);
* @param data Data to send
* @return Data received on the miso line
*/
uint8_t maa_spi_write(maa_spi_context dev, uint8_t data);
uint8_t mraa_spi_write(mraa_spi_context dev, uint8_t data);
/** Write Buffer of bytes to the SPI device. The pointer return has to be
* free'd by the caller.
@@ -89,7 +89,7 @@ uint8_t maa_spi_write(maa_spi_context dev, uint8_t data);
* @param length elements within buffer, Max 4096
* @return Data received on the miso line, same length as passed in
*/
uint8_t* maa_spi_write_buf(maa_spi_context dev, uint8_t* data, int length);
uint8_t* mraa_spi_write_buf(mraa_spi_context dev, uint8_t* data, int length);
/**
* Change the SPI lsb mode
@@ -98,7 +98,7 @@ uint8_t* maa_spi_write_buf(maa_spi_context dev, uint8_t* data, int length);
* @param lsb Use least significant bit transmission. 0 for msbi
* @return Result of operation
*/
maa_result_t maa_spi_lsbmode(maa_spi_context dev, maa_boolean_t lsb);
mraa_result_t mraa_spi_lsbmode(mraa_spi_context dev, mraa_boolean_t lsb);
/**
* Set bits per mode on transaction, defaults at 8
@@ -107,15 +107,15 @@ maa_result_t maa_spi_lsbmode(maa_spi_context dev, maa_boolean_t lsb);
* @param bits bits per word
* @return Result of operation
*/
maa_result_t maa_spi_bit_per_word(maa_spi_context dev, unsigned int bits);
mraa_result_t mraa_spi_bit_per_word(mraa_spi_context dev, unsigned int bits);
/**
* De-inits an maa_spi_context device
* De-inits an mraa_spi_context device
*
* @param dev The Spi context
* @return Result of operation
*/
maa_result_t maa_spi_stop(maa_spi_context dev);
mraa_result_t mraa_spi_stop(mraa_spi_context dev);
#ifdef __cplusplus
}

View File

@@ -26,12 +26,12 @@
#include "spi.h"
namespace maa {
namespace mraa {
/**
* @brief C++ API to System Packet Interface
*
* This file defines the SPI C++ interface for libmaa
* This file defines the SPI C++ interface for libmraa
*
* @snippet Spi-pot.cpp Interesting
*/
@@ -43,13 +43,13 @@ class Spi {
* @param bus to use, as listed in the platform definition, normally 0
*/
Spi(int bus) {
m_spi = maa_spi_init(bus);
m_spi = mraa_spi_init(bus);
}
/**
* Closes spi bus
*/
~Spi() {
maa_spi_stop(m_spi);
mraa_spi_stop(m_spi);
}
/**
* Set the SPI device mode. see spidev0-3
@@ -57,8 +57,8 @@ class Spi {
* @param mode the mode. See Linux spidev doc
* @return Result of operation
*/
maa_result_t mode(unsigned short mode) {
return maa_spi_mode(m_spi, mode);
mraa_result_t mode(unsigned short mode) {
return mraa_spi_mode(m_spi, mode);
}
/**
* Set the SPI device operating clock frequency
@@ -66,8 +66,8 @@ class Spi {
* @param hz the frequency to set in hz
* @return Result of operation
*/
maa_result_t frequency(int hz) {
return maa_spi_frequency(m_spi, hz);
mraa_result_t frequency(int hz) {
return mraa_spi_frequency(m_spi, hz);
}
/**
* Write single byte to the SPI device
@@ -76,7 +76,7 @@ class Spi {
* @return data received on the miso line
*/
unsigned char write(uint8_t data) {
return (unsigned char) maa_spi_write(m_spi, data);
return (unsigned char) mraa_spi_write(m_spi, data);
}
/**
* Write buffer of bytes to SPI device
@@ -86,7 +86,7 @@ class Spi {
* @return char* data received on the miso line. Same length as passed in
*/
unsigned char* write(uint8_t* data, int length) {
return (unsigned char*) maa_spi_write_buf(m_spi, data, length);
return (unsigned char*) mraa_spi_write_buf(m_spi, data, length);
}
/**
* Change the SPI lsb mode
@@ -94,8 +94,8 @@ class Spi {
* @param lsb Use least significant bit transmission - 0 for msbi
* @return Result of operation
*/
maa_result_t lsbmode(bool lsb) {
return maa_spi_lsbmode(m_spi, (maa_boolean_t) lsb);
mraa_result_t lsbmode(bool lsb) {
return mraa_spi_lsbmode(m_spi, (mraa_boolean_t) lsb);
}
/**
* Set bits per mode on transaction, default is 8
@@ -103,10 +103,10 @@ class Spi {
* @param bits bits per word
* @return Result of operation
*/
maa_result_t bitPerWord(unsigned int bits) {
return maa_spi_bit_per_word(m_spi, bits);
mraa_result_t bitPerWord(unsigned int bits) {
return mraa_spi_bit_per_word(m_spi, bits);
}
private:
maa_spi_context m_spi;
mraa_spi_context m_spi;
};
}

View File

@@ -25,7 +25,7 @@
/** @file
*
* This file defines the basic shared types for libmaa
* This file defines the basic shared types for libmraa
* this file is different to common.h in that swig takes this as an input
*/
@@ -34,38 +34,38 @@ extern "C" {
#endif
/**
* MAA supported platform types
* MRAA supported platform types
*/
typedef enum {
MAA_INTEL_GALILEO_GEN1 = 0, /**< The Generation 1 Galileo platform (RevD) */
MAA_INTEL_GALILEO_GEN2 = 1, /**< The Generation 2 Galileo platform (RevG/H) */
MRAA_INTEL_GALILEO_GEN1 = 0, /**< The Generation 1 Galileo platform (RevD) */
MRAA_INTEL_GALILEO_GEN2 = 1, /**< The Generation 2 Galileo platform (RevG/H) */
MAA_UNKNOWN_PLATFORM = 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
} maa_platform_t;
MRAA_UNKNOWN_PLATFORM = 99 /**< An unknown platform type, typically will load INTEL_GALILEO_GEN1 */
} mraa_platform_t;
/**
* MAA return codes
* MRAA return codes
*/
typedef enum {
MAA_SUCCESS = 0, /**< Expected response */
MAA_ERROR_FEATURE_NOT_IMPLEMENTED = 1, /**< Feature TODO */
MAA_ERROR_FEATURE_NOT_SUPPORTED = 2, /**< Feature not supported by HW */
MAA_ERROR_INVALID_VERBOSITY_LEVEL = 3, /**< Verbosity level wrong */
MAA_ERROR_INVALID_PARAMETER = 4, /**< Parameter invalid */
MAA_ERROR_INVALID_HANDLE = 5, /**< Handle invalid */
MAA_ERROR_NO_RESOURCES = 6, /**< No resource of that type avail */
MAA_ERROR_INVALID_RESOURCE = 7, /**< Resource invalid */
MAA_ERROR_INVALID_QUEUE_TYPE = 8, /**< Queue type incorrect */
MAA_ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */
MAA_ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */
MAA_ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */
MAA_ERROR_PLATFORM_ALREADY_INITIALISED = 12, /**< Board is already initialised */
MRAA_SUCCESS = 0, /**< Expected response */
MRAA_ERROR_FEATURE_NOT_IMPLEMENTED = 1, /**< Feature TODO */
MRAA_ERROR_FEATURE_NOT_SUPPORTED = 2, /**< Feature not supported by HW */
MRAA_ERROR_INVALID_VERBOSITY_LEVEL = 3, /**< Verbosity level wrong */
MRAA_ERROR_INVALID_PARAMETER = 4, /**< Parameter invalid */
MRAA_ERROR_INVALID_HANDLE = 5, /**< Handle invalid */
MRAA_ERROR_NO_RESOURCES = 6, /**< No resource of that type avail */
MRAA_ERROR_INVALID_RESOURCE = 7, /**< Resource invalid */
MRAA_ERROR_INVALID_QUEUE_TYPE = 8, /**< Queue type incorrect */
MRAA_ERROR_NO_DATA_AVAILABLE = 9, /**< No data available */
MRAA_ERROR_INVALID_PLATFORM = 10, /**< Platform not recognised */
MRAA_ERROR_PLATFORM_NOT_INITIALISED = 11, /**< Board information not initialised */
MRAA_ERROR_PLATFORM_ALREADY_INITIALISED = 12, /**< Board is already initialised */
MAA_ERROR_UNSPECIFIED = 99 /**< Unknown Error */
} maa_result_t;
MRAA_ERROR_UNSPECIFIED = 99 /**< Unknown Error */
} mraa_result_t;
/**
* This function attempts to set the maa process to a given priority and the
* This function attempts to set the mraa process to a given priority and the
* scheduler to SCHED_RR. Highest * priority is typically 99 and minimum is 0.
* This function * will set to MAX if * priority is > MAX. Function will return
* -1 on failure.
@@ -73,30 +73,30 @@ typedef enum {
* @param priority Value from typically 0 to 99
* @return The priority value set
*/
int maa_set_priority(const unsigned int priority);
int mraa_set_priority(const unsigned int priority);
/** Get the version string of maa autogenerated from git tag
/** Get the version string of mraa autogenerated from git tag
*
* The version returned may not be what is expected however it is a reliable
* number associated with the git tag closest to that version at build time
*
* @return version string from version.h
*/
const char* maa_get_version();
const char* mraa_get_version();
/**
* Print a textual representation of the maa_result_t
* Print a textual representation of the mraa_result_t
*
* @param result the result to print
*/
void maa_result_print(maa_result_t result);
void mraa_result_print(mraa_result_t result);
/**
* Get platform type, board must be initialised.
*
* @return maa_platform_t Platform type enum
* @return mraa_platform_t Platform type enum
*/
maa_platform_t maa_get_platform_type();
mraa_platform_t mraa_get_platform_type();
#ifdef __cplusplus
}