mraa  0.4.5
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Variables 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 std::string getVersion()
48 {
49  std::string ret = mraa_get_version();
50  return ret;
51 }
52 
62 int setPriority(const unsigned int priority)
63 {
64  return mraa_set_priority(priority);
65 }
66 
73 {
74  return mraa_get_platform_type();
75 }
76 
83 {
84  mraa_result_print(result);
85 }
86 
94 bool pinModeTest(int pin, mraa_pinmodes_t mode)
95 {
96  return (bool) mraa_pin_mode_test(pin,mode);
97 }
98 
104 unsigned int adcRawBits()
105 {
106  return mraa_adc_raw_bits();
107 }
108 
114 unsigned int adcSupportedBits()
115 {
116  return mraa_adc_supported_bits();
117 }
118 
119 }
mraa_platform_t getPlatformType()
Definition: common.hpp:72
std::string getVersion()
Definition: common.hpp:47
mraa_platform_t
Definition: types.h:39
const char * mraa_get_version()
mraa_boolean_t mraa_pin_mode_test(int pin, mraa_pinmodes_t mode)
unsigned int mraa_adc_supported_bits()
void mraa_result_print(mraa_result_t result)
unsigned int adcSupportedBits()
Definition: common.hpp:114
bool pinModeTest(int pin, mraa_pinmodes_t mode)
Definition: common.hpp:94
mraa_pinmodes_t
Definition: common.h:47
mraa_platform_t mraa_get_platform_type()
unsigned int mraa_adc_raw_bits()
int setPriority(const unsigned int priority)
Definition: common.hpp:62
mraa_result_t
Definition: types.h:49
unsigned int adcRawBits()
Definition: common.hpp:104
int mraa_set_priority(const unsigned int priority)
void printError(mraa_result_t result)
Definition: common.hpp:82