mraa  0.6.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Typedefs Enumerations Enumerator Pages
common.hpp
Go to the documentation of this file.
1 /*
2  * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
3  * Copyright (c) 2014 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #pragma once
26 
27 #include "common.h"
28 #include <string>
29 
33 namespace mraa {
34 
47 inline std::string getVersion()
48 {
49  std::string ret = mraa_get_version();
50  return ret;
51 }
52 
62 inline int setPriority(const unsigned int priority)
63 {
64  return mraa_set_priority(priority);
65 }
66 
73 {
74  return mraa_get_platform_type();
75 }
76 
82 inline void printError(mraa_result_t result)
83 {
84  mraa_result_print(result);
85 }
86 
94 inline bool pinModeTest(int pin, mraa_pinmodes_t mode)
95 {
96  return (bool) mraa_pin_mode_test(pin,mode);
97 }
98 
104 inline unsigned int adcRawBits()
105 {
106  return mraa_adc_raw_bits();
107 }
108 
114 inline unsigned int adcSupportedBits()
115 {
116  return mraa_adc_supported_bits();
117 }
118 
124 inline std::string getPlatformName()
125 {
126  std::string ret_val(mraa_get_platform_name());
127  return ret_val;
128 }
129 
135 inline unsigned int getPinCount()
136 {
137  return mraa_get_pin_count();
138 }
139 
147 inline mraa_result_t setLogLevel(int level)
148 {
149  return mraa_set_log_level(level);
150 }
151 
152 }
mraa_platform_t getPlatformType()
Definition: common.hpp:72
mraa_result_t setLogLevel(int level)
Definition: common.hpp:147
char * mraa_get_platform_name()
const char * mraa_get_version()
std::string getVersion()
Definition: common.hpp:47
mraa_platform_t
Definition: types.h:39
mraa_platform_t mraa_get_platform_type()
mraa_boolean_t mraa_pin_mode_test(int pin, mraa_pinmodes_t mode)
unsigned int mraa_adc_supported_bits()
unsigned int adcSupportedBits()
Definition: common.hpp:114
bool pinModeTest(int pin, mraa_pinmodes_t mode)
Definition: common.hpp:94
unsigned int getPinCount()
Definition: common.hpp:135
std::string getPlatformName()
Definition: common.hpp:124
unsigned int mraa_adc_raw_bits()
int setPriority(const unsigned int priority)
Definition: common.hpp:62
mraa_result_t
Definition: types.h:145
mraa_pinmodes_t
Definition: types.h:166
int mraa_set_priority(const unsigned int priority)
unsigned int adcRawBits()
Definition: common.hpp:104
void mraa_result_print(mraa_result_t result)
mraa_result_t mraa_set_log_level(int level)
void printError(mraa_result_t result)
Definition: common.hpp:82
unsigned int mraa_get_pin_count()