X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=api%2Fmraa%2Fcommon.hpp;h=cf409ae08ba7bbdf1cdbc8eb51ba210d68422d92;hb=5bd5f2d546ca8f4f532117e7489a4b289a1de0dc;hp=94821e870132dba1f412c1450a4814822f5ef629;hpb=4031124081357ae9ff6e0ba2624cbed79ed254a6;p=contrib%2Fmraa.git diff --git a/api/mraa/common.hpp b/api/mraa/common.hpp index 94821e8..cf409ae 100644 --- a/api/mraa/common.hpp +++ b/api/mraa/common.hpp @@ -214,4 +214,89 @@ setLogLevel(int level) { return mraa_set_log_level(level); } + +/** + * Detect presence of sub platform. + * + * @return bool true if sub platform is present and initialized, false otherwise + */ +inline bool +hasSubPlatform() +{ + return static_cast(mraa_has_sub_platform()); +} + + +/** + * Select main platform for platform info calls. + * + * @return bool true if main platform is available, false otherwise + */ +inline bool +selectMainPlatform() +{ + return static_cast(mraa_select_main_platform()); +} + +/** + * Select sub platform for platform info calls. + * + * @return mraa_boolean_t true if sub platform is available, 0 otherwise + */ +inline bool +selectSubPlatform() +{ + return static_cast(mraa_select_sub_platform()); +} + + +/** + * Check if sub platform is currently available and selected for platform info calls. + * + * @return bool true if sub platform is selected, false otherwise + */ +inline bool +isSubPlatformSelected() +{ + return static_cast(mraa_is_sub_platform_selected()); +} + + +/** + * Check if pin or bus id includes sub platform mask. + * + * @param int pin or bus number + * + * @return mraa_boolean_t 1 if pin or bus is for sub platform, 0 otherwise + */ +inline bool +isSubPlatformId(int pin_or_bus_id) +{ + return static_cast(mraa_is_sub_platform_id(pin_or_bus_id)); +} + +/** + * Convert pin or bus index to corresponding sub platform id. + * + * @param int pin or bus index + * + * @return int sub platform pin or bus number + */ +inline int +getSubPlatformId(int pin_or_bus_index) +{ + return mraa_get_sub_platform_id(pin_or_bus_index); +} + +/** + * Convert pin or bus sub platform id to index. + * + * @param int sub platform pin or bus id + * + * @return int pin or bus index + */ +int getSubPlatformIndex(int pin_or_bus_id) +{ + return mraa_get_sub_platform_index(pin_or_bus_id); +} }