mraa
2.0.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
|
Data Structures | |
class | Aio |
API to Analog IO. More... | |
class | Gpio |
API to General Purpose IO. More... | |
class | I2c |
API to Inter-Integrated Circuit. More... | |
class | Iio |
API to Industrial IO. More... | |
struct | IioEventData |
class | IioHandler |
class | Led |
API to Light Emitting Diode. More... | |
class | MraaIo |
class | Pwm |
API to Pulse Width Modulation. More... | |
class | Spi |
API to Serial Peripheral Interface. More... | |
class | Uart |
API to UART (enabling only) More... | |
class | UartOW |
API for UART One Wire. More... | |
Enumerations | |
enum | Mode { MODE_STRONG = 0, MODE_PULLUP = 1, MODE_PULLDOWN = 2, MODE_HIZ = 3 } |
enum | Dir { DIR_OUT = 0, DIR_IN = 1, DIR_OUT_HIGH = 2, DIR_OUT_LOW = 3 } |
enum | Edge { EDGE_NONE = 0, EDGE_BOTH = 1, EDGE_RISING = 2, EDGE_FALLING = 3 } |
enum | InputMode { MODE_IN_ACTIVE_HIGH = 0, MODE_IN_ACTIVE_LOW = 1 } |
enum | OutputMode { MODE_OUT_OPEN_DRAIN = 0, MODE_OUT_PUSH_PULL = 1 } |
enum | Spi_Mode { SPI_MODE0 = 0, SPI_MODE1 = 1, SPI_MODE2 = 2, SPI_MODE3 = 3 } |
enum | Platform { INTEL_GALILEO_GEN1 = 0, INTEL_GALILEO_GEN2 = 1, INTEL_EDISON_FAB_C = 2, INTEL_DE3815 = 3, INTEL_MINNOWBOARD_MAX = 4, RASPBERRY_PI = 5, BEAGLEBONE = 6, BANANA = 7, INTEL_NUC5 = 8, A96BOARDS = 9, INTEL_SOFIA_3GR = 10, INTEL_CHERRYHILLS = 11, INTEL_UP = 12, INTEL_JOULE_EXPANSION = 13, PHYBOARD_WEGA = 14, DE_NANO_SOC = 15, INTEL_UP2 = 16, MTK_LINKIT = 17, MTK_OMEGA2 = 18, IEI_TANK = 19, FTDI_FT4222 = 256, GROVEPI = 1024, GENERIC_FIRMATA = 1280, ANDROID_PERIPHERALMANAGER = 95, MOCK_PLATFORM = 96, NULL_PLATFORM = 98, UNKNOWN_PLATFORM = 99 } |
enum | IntelEdisonMiniboard { INTEL_EDISON_MINIBOARD_J17_1 = 0, INTEL_EDISON_MINIBOARD_J17_5 = 4, INTEL_EDISON_MINIBOARD_J17_7 = 6, INTEL_EDISON_MINIBOARD_J17_8 = 7, INTEL_EDISON_MINIBOARD_J17_9 = 8, INTEL_EDISON_MINIBOARD_J17_10 = 9, INTEL_EDISON_MINIBOARD_J17_11 = 10, INTEL_EDISON_MINIBOARD_J17_12 = 11, INTEL_EDISON_MINIBOARD_J17_14 = 13, INTEL_EDISON_MINIBOARD_J18_1 = 14, INTEL_EDISON_MINIBOARD_J18_2 = 15, INTEL_EDISON_MINIBOARD_J18_6 = 19, INTEL_EDISON_MINIBOARD_J18_7 = 20, INTEL_EDISON_MINIBOARD_J18_8 = 21, INTEL_EDISON_MINIBOARD_J18_10 = 23, INTEL_EDISON_MINIBOARD_J18_11 = 24, INTEL_EDISON_MINIBOARD_J18_12 = 25, INTEL_EDISON_MINIBOARD_J18_13 = 26, INTEL_EDISON_MINIBOARD_J19_4 = 31, INTEL_EDISON_MINIBOARD_J19_5 = 32, INTEL_EDISON_MINIBOARD_J19_6 = 33, INTEL_EDISON_MINIBOARD_J19_8 = 35, INTEL_EDISON_MINIBOARD_J19_9 = 36, INTEL_EDISON_MINIBOARD_J19_10 = 37, INTEL_EDISON_MINIBOARD_J19_11 = 38, INTEL_EDISON_MINIBOARD_J19_12 = 39, INTEL_EDISON_MINIBOARD_J19_13 = 40, INTEL_EDISON_MINIBOARD_J19_14 = 41, INTEL_EDISON_MINIBOARD_J20_3 = 44, INTEL_EDISON_MINIBOARD_J20_4 = 45, INTEL_EDISON_MINIBOARD_J20_5 = 46, INTEL_EDISON_MINIBOARD_J20_6 = 47, INTEL_EDISON_MINIBOARD_J20_7 = 48, INTEL_EDISON_MINIBOARD_J20_8 = 49, INTEL_EDISON_MINIBOARD_J20_9 = 50, INTEL_EDISON_MINIBOARD_J20_10 = 51, INTEL_EDISON_MINIBOARD_J20_11 = 52, INTEL_EDISON_MINIBOARD_J20_12 = 53, INTEL_EDISON_MINIBOARD_J20_13 = 54, INTEL_EDISON_MINIBOARD_J20_14 = 55 } |
enum | IntelEdison { INTEL_EDISON_GP182 = 0, INTEL_EDISON_GP135 = 4, INTEL_EDISON_GP27 = 6, INTEL_EDISON_GP20 = 7, INTEL_EDISON_GP28 = 8, INTEL_EDISON_GP111 = 0, INTEL_EDISON_GP109 = 10, INTEL_EDISON_GP115 = 11, INTEL_EDISON_GP128 = 13, INTEL_EDISON_GP13 = 14, INTEL_EDISON_GP165 = 15, INTEL_EDISON_GP19 = 19, INTEL_EDISON_GP12 = 20, INTEL_EDISON_GP183 = 21, INTEL_EDISON_GP110 = 23, INTEL_EDISON_GP114 = 24, INTEL_EDISON_GP129 = 25, INTEL_EDISON_GP130 = 26, INTEL_EDISON_GP44 = 31, INTEL_EDISON_GP46 = 32, INTEL_EDISON_GP48 = 33, INTEL_EDISON_GP131 = 35, INTEL_EDISON_GP14 = 36, INTEL_EDISON_GP40 = 37, INTEL_EDISON_GP43 = 38, INTEL_EDISON_GP77 = 39, INTEL_EDISON_GP82 = 40, INTEL_EDISON_GP83 = 41, INTEL_EDISON_GP134 = 44, INTEL_EDISON_GP45 = 45, INTEL_EDISON_GP47 = 46, INTEL_EDISON_GP49 = 47, INTEL_EDISON_GP15 = 48, INTEL_EDISON_GP84 = 49, INTEL_EDISON_GP42 = 50, INTEL_EDISON_GP41 = 51, INTEL_EDISON_GP78 = 52, INTEL_EDISON_GP79 = 53, INTEL_EDISON_GP80 = 54, INTEL_EDISON_GP81 = 55 } |
enum | RaspberryWiring { RASPBERRY_WIRING_PIN8 = 3, RASPBERRY_WIRING_PIN9 = 5, RASPBERRY_WIRING_PIN7 = 7, RASPBERRY_WIRING_PIN15 = 8, RASPBERRY_WIRING_PIN16 = 10, RASPBERRY_WIRING_PIN0 = 11, RASPBERRY_WIRING_PIN1 = 12, RASPBERRY_WIRING_PIN2 = 13, RASPBERRY_WIRING_PIN3 = 15, RASPBERRY_WIRING_PIN4 = 16, RASPBERRY_WIRING_PIN5 = 18, RASPBERRY_WIRING_PIN12 = 19, RASPBERRY_WIRING_PIN13 = 21, RASPBERRY_WIRING_PIN6 = 22, RASPBERRY_WIRING_PIN14 = 23, RASPBERRY_WIRING_PIN10 = 24, RASPBERRY_WIRING_PIN11 = 26, RASPBERRY_WIRING_PIN17 = 29, RASPBERRY_WIRING_PIN21 = 29, RASPBERRY_WIRING_PIN18 = 30, RASPBERRY_WIRING_PIN19 = 31, RASPBERRY_WIRING_PIN22 = 31, RASPBERRY_WIRING_PIN20 = 32, RASPBERRY_WIRING_PIN26 = 32, RASPBERRY_WIRING_PIN23 = 33, RASPBERRY_WIRING_PIN24 = 35, RASPBERRY_WIRING_PIN27 = 36, RASPBERRY_WIRING_PIN25 = 37, RASPBERRY_WIRING_PIN28 = 38, RASPBERRY_WIRING_PIN29 = 40 } |
enum | Result { SUCCESS = 0, ERROR_FEATURE_NOT_IMPLEMENTED = 1, ERROR_FEATURE_NOT_SUPPORTED = 2, ERROR_INVALID_VERBOSITY_LEVEL = 3, ERROR_INVALID_PARAMETER = 4, ERROR_INVALID_HANDLE = 5, ERROR_NO_RESOURCES = 6, ERROR_INVALID_RESOURCE = 7, ERROR_INVALID_QUEUE_TYPE = 8, ERROR_NO_DATA_AVAILABLE = 9, ERROR_INVALID_PLATFORM = 10, ERROR_PLATFORM_NOT_INITIALISED = 11, ERROR_UART_OW_SHORTED = 12, ERROR_UART_OW_NO_DEVICES = 13, ERROR_UART_OW_DATA_ERROR = 14, ERROR_UNSPECIFIED = 99 } |
enum | Pinmodes { PIN_VALID = 0, PIN_GPIO = 1, PIN_PWM = 2, PIN_FAST_GPIO = 3, PIN_SPI = 4, PIN_I2C = 5, PIN_AIO = 6, PIN_UART = 7 } |
enum | I2cMode { I2C_STD = 0, I2C_FAST = 1, I2C_HIGH = 2 } |
enum | UartParity { UART_PARITY_NONE = 0, UART_PARITY_EVEN = 1, UART_PARITY_ODD = 2, UART_PARITY_MARK = 3, UART_PARITY_SPACE = 4 } |
Functions | |
Result | init () |
std::string | getVersion () |
int | setPriority (const int priority) |
Platform | getPlatformType () |
void | printError (Result result) |
bool | pinModeTest (int pin, Pinmodes mode) |
unsigned int | adcRawBits () |
unsigned int | adcSupportedBits () |
std::string | getPlatformName () |
std::string | getPlatformVersion (int platform_offset=MRAA_MAIN_PLATFORM_OFFSET) |
unsigned int | getPinCount () |
int | getUartCount () |
int | getI2cBusCount () |
int | getI2cBusId (int i2c_bus) |
std::string | getPinName (int pin) |
int | getGpioLookup (std::string pin_name) |
int | getI2cLookup (std::string i2c_name) |
int | getSpiLookup (std::string spi_name) |
int | getPwmLookup (std::string pwm_name) |
int | getUartLookup (std::string uart_name) |
Result | setLogLevel (int level) |
bool | hasSubPlatform () |
bool | isSubPlatformId (int pin_or_bus_id) |
int | getSubPlatformId (int pin_or_bus_index) |
int | getSubPlatformIndex (int pin_or_bus_id) |
int | getDefaultI2cBus (int platform_offset=MRAA_MAIN_PLATFORM_OFFSET) |
Result | addSubplatform (Platform subplatformtype, std::string dev) |
Result | removeSubplatform (Platform subplatformtype) |
template<class T > | |
T * | initIo (std::string desc) |
Result | initJsonPlatform (std::string path) |
namespace
enum Mode |
Gpio Output modes
Enumerator | |
---|---|
MODE_STRONG |
Default. Strong High and Low |
MODE_PULLUP |
Resistive High |
MODE_PULLDOWN |
Resistive Low |
MODE_HIZ |
High Z State |
enum Dir |
Gpio Direction options
Enumerator | |
---|---|
DIR_OUT |
Output. A Mode can also be set |
DIR_IN |
Input |
DIR_OUT_HIGH |
Output. Init High |
DIR_OUT_LOW |
Output. Init Low |
enum Edge |
enum InputMode |
Gpio Input modes
Enumerator | |
---|---|
MODE_IN_ACTIVE_HIGH |
Resistive High |
MODE_IN_ACTIVE_LOW |
Resistive Low |
enum OutputMode |
Gpio output driver modes
Enumerator | |
---|---|
MODE_OUT_OPEN_DRAIN |
Open Drain Configuration |
MODE_OUT_PUSH_PULL |
Push Pull Configuration |
enum Spi_Mode |
MRAA SPI Modes
enum Platform |
MRAA supported platform types
enum IntelEdisonMiniboard |
Intel edison miniboard numbering enum
enum IntelEdison |
Intel Edison raw GPIO numbering enum
enum RaspberryWiring |
Raspberry PI Wiring compatible numbering enum
enum Result |
MRAA return codes
enum Pinmodes |
enum I2cMode |
enum UartParity |
Enum representing different uart parity states
|
inline |
Initialise MRAA
Detects running platform and attempts to use included pinmap, this is run on module/library init/load but is handy to rerun to check board initialised correctly. mraa::SUCCESS inidicates correct initialisation.
|
inline |
Get libmraa version.
|
inline |
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.
priority | Value from typically 0 to 99 |
|
inline |
Get platform type, board must be initialised.
|
inline |
Print a textual representation of the mraa::Result
result | the Result to print |
|
inline |
Checks if a pin is able to use the passed in mode.
pin | Physical Pin to be checked. |
mode | the mode to be tested. |
|
inline |
Check the board's bit size when reading the value
|
inline |
Return value that the raw value should be shifted to. Zero if no ADC
|
inline |
Return platform name.
|
inline |
Return platform versioning info.
platform_offset | optional subplatform identifier |
|
inline |
Return count of physical pins on the running platform
|
inline |
Get platform usable UART count, board must be initialised.
|
inline |
Get platform usable I2C bus count, board must be initialised.
|
inline |
Get I2C adapter number in sysfs.
i2c_bus | the logical I2C bus number |
|
inline |
Get name of pin, board must be initialised.
pin | number |
|
inline |
Get GPIO index by pin name, board must be initialised.
pin_name | GPIO pin name. Eg: IO0 |
std::invalid_argument | if name is not found |
|
inline |
Get I2C bus index by bus name, board must be initialised.
i2c_name | I2C bus name. Eg: I2C6 |
std::invalid_argument | if name is not found |
|
inline |
Get SPI bus index by bus name, board must be initialised.
spi_name | Name of SPI bus. Eg: SPI2 |
std::invalid_argument | if name is not found |
|
inline |
Get PWM index by PWM name, board must be initialised.
pwm_name | Name of PWM. Eg:PWM0 |
std::invalid_argument | if name is not found |
|
inline |
Get UART index by UART name, board must be initialised.
uart_name | Name of the UART. Eg: UART2 |
std::invalid_argument | if name is not found |
|
inline |
Sets the log level to use from 0-7 where 7 is very verbose. These are the syslog log levels, see syslog(3) for more information on the levels.
level |
|
inline |
Detect presence of sub platform.
|
inline |
Check if pin or bus id includes sub platform mask.
pin_or_bus_id | pin or bus number |
|
inline |
Convert pin or bus index to corresponding sub platform id.
pin_or_bus_index | pin or bus index |
|
inline |
Convert pin or bus sub platform id to index.
pin_or_bus_id | sub platform pin or bus id |
|
inline |
Get default i2c bus, board must be initialised.
platform_offset | optional subplatform identifier |
Add mraa subplatform
subplatformtype | the type of subplatform to add (e.g. MRAA_GENERIC_FIRMATA or MRAA_GROVEPI) |
dev | subplatform uart device string or i2c bus number (e.g. "/dev/ttyACM0" or "0") |
Remove mraa subplatform
subplatformtype | the type of subplatform to remove (e.g. MRAA_GENERIC_FIRMATA) |
|
inline |
Create IO using a description in the format: [io]-[pin] [io]-[raw]-[pin] [io]-[raw]-[id]-[pin] [io]-[raw]-[path]
desc | description |
|
inline |
Instantiate an unknown board using a json file
path | Path to the json file, relative to the folder the program was initially run in or a direct path |