mraa  0.7.1
Low Level Skeleton Library for Communication on GNU/Linux platforms
common.h
Go to the documentation of this file.
1 /*
2  * Author: Brendan Le Foll <brendan.le.foll@intel.com>
3  * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
4  * Copyright © 2014 Intel Corporation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22  * IN THE SOFTWARE.
23  */
24 
25 #pragma once
26 
27 #include "types.h"
28 
29 #define MRAA_PLATFORM_NAME_MAX_SIZE 64
30 #define MRAA_PIN_NAME_SIZE 12
31 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
45 typedef unsigned int mraa_boolean_t;
46 
58 #if (defined SWIGPYTHON) || (defined SWIG)
60 #else
61 // this sets a compiler attribute (supported by GCC & clang) to have mraa_init()
62 // be called as a constructor make sure your libc supports this! uclibc needs
63 // to be compiled with UCLIBC_CTOR_DTOR
64 mraa_result_t mraa_init() __attribute__((constructor));
65 #endif
66 
74 void mraa_deinit();
75 
83 mraa_boolean_t mraa_pin_mode_test(int pin, mraa_pinmodes_t mode);
84 
90 unsigned int mraa_adc_raw_bits();
91 
97 unsigned int mraa_adc_supported_bits();
98 
106 
112 char* mraa_get_platform_name();
113 
123 int mraa_set_priority(const unsigned int priority);
124 
132 const char* mraa_get_version();
133 
139 void mraa_result_print(mraa_result_t result);
140 
147 
153 unsigned int mraa_get_pin_count();
154 
162 char* mraa_get_pin_name(int pin);
163 
164 #ifdef __cplusplus
165 }
166 #endif
char * mraa_get_platform_name()
const char * mraa_get_version()
unsigned int mraa_boolean_t
Definition: common.h:45
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()
char * mraa_get_pin_name(int pin)
void mraa_deinit()
mraa_result_t mraa_init() __attribute__((constructor))
unsigned int mraa_adc_raw_bits()
mraa_result_t
Definition: types.h:184
mraa_pinmodes_t
Definition: types.h:205
int mraa_set_priority(const unsigned int priority)
void mraa_result_print(mraa_result_t result)
mraa_result_t mraa_set_log_level(int level)
unsigned int mraa_get_pin_count()