mraa  0.6.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Typedefs Enumerations Enumerator Pages
Functions | Macros | Typedefs
common.h File Reference

API Description

This file defines the basic shared values for libmraa

Go to the source code of this file.

Functions

mraa_result_t mraa_init () __attribute__((constructor))
 
void mraa_deinit ()
 
mraa_boolean_t mraa_pin_mode_test (int pin, mraa_pinmodes_t mode)
 
unsigned int mraa_adc_raw_bits ()
 
unsigned int mraa_adc_supported_bits ()
 
mraa_result_t mraa_set_log_level (int level)
 
char * mraa_get_platform_name ()
 
int mraa_set_priority (const unsigned int priority)
 
const char * mraa_get_version ()
 
void mraa_result_print (mraa_result_t result)
 
mraa_platform_t mraa_get_platform_type ()
 
unsigned int mraa_get_pin_count ()
 

Macros

#define MRAA_PLATFORM_NAME_MAX_SIZE   64
 

Typedefs

typedef unsigned int mraa_boolean_t
 

Function Documentation

mraa_result_t mraa_init ( ) const

Initialise MRAA

Detects running platform and attempts to use included pinmap

Returns
Result of operation
void mraa_deinit ( )

De-Initilise MRAA

This is not a strict requirement but useful to test memory leaks and for people who like super clean code. If dynamically loading & unloading libmraa you need to call this before unloading the library.

mraa_boolean_t mraa_pin_mode_test ( int  pin,
mraa_pinmodes_t  mode 
)

Checks if a pin is able to use the passed in mode.

Parameters
pinPhysical Pin to be checked.
modethe mode to be tested.
Returns
boolean if the mode is supported, 0=false.

Here is the caller graph for this function:

unsigned int mraa_adc_raw_bits ( )

Check the board's bit size when reading the value

Returns
raw bits being read from kernel module. zero if no ADC

Here is the caller graph for this function:

unsigned int mraa_adc_supported_bits ( )

Return value that the raw value should be shifted to. Zero if no ADC

Returns
return actual bit size the adc value should be understood as.

Here is the caller graph for this function:

mraa_result_t mraa_set_log_level ( int  level)

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.

Returns
Result of operation

Here is the caller graph for this function:

char* mraa_get_platform_name ( )

Return the Platform's Name, If no platform detected return NULL

Returns
platform name

Here is the caller graph for this function:

int mraa_set_priority ( const unsigned int  priority)

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.

Parameters
priorityValue from typically 0 to 99
Returns
The priority value set

Here is the caller graph for this function:

const char* mraa_get_version ( )

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

Returns
version string from version.h

Here is the caller graph for this function:

void mraa_result_print ( mraa_result_t  result)

Print a textual representation of the mraa_result_t

Parameters
resultthe result to print

Here is the caller graph for this function:

mraa_platform_t mraa_get_platform_type ( )

Get platform type, board must be initialised.

Returns
mraa_platform_t Platform type enum

Here is the caller graph for this function:

unsigned int mraa_get_pin_count ( )

Get platform pincount, board must be initialised.

Returns
uint of physical pin count on the in-use platform

Here is the caller graph for this function:

Typedef Documentation

typedef unsigned int mraa_boolean_t

MRAA boolean type 1 For TRUE

Include dependency graph for common.h: