Private
Public Access
2
0

mraa: add mraa_get_platform_name

getPlatformName for c++/swig API
Closes #35

Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
Thomas Ingleby
2014-11-26 15:15:55 +00:00
parent 0289c63c4c
commit d1185efc0a
8 changed files with 55 additions and 0 deletions

View File

@@ -26,6 +26,8 @@
#include "types.h"
#define MRAA_PLATFORM_NAME_MAX_SIZE 64
/** @file
*
* This file defines the basic shared values for libmraa
@@ -186,6 +188,8 @@ typedef struct {
int pwm_default_period; /**< The default PWM period is US */
int pwm_max_period; /**< Maximum period in us */
int pwm_min_period; /**< Minimum period in us */
unsigned int platform_name_length; /**< Platform Name length */
char* platform_name; /**< Platform Name pointer */
mraa_pininfo_t* pins; /**< Pointer to pin array */
/*@}*/
} mraa_board_t;
@@ -247,6 +251,13 @@ unsigned int mraa_adc_supported_bits();
*/
mraa_result_t mraa_set_log_level(int level);
/**
* Return the Platform's Name, If no platform detected return "Unknown"
*
* @return platform name
*/
char* mraa_get_platform_name();
#ifdef __cplusplus
}
#endif

View File

@@ -116,6 +116,17 @@ inline unsigned int adcSupportedBits()
return mraa_adc_supported_bits();
}
/**
* Return Platform Name. "Unknown" if no platform inited.
*
* @return platform name
*/
inline std::string getPlatformName()
{
std::string ret_val(mraa_get_platform_name());
return ret_val;
}
/**
* 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.