mraa  1.8.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gpio.h
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 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #include <stdio.h>
44 #include <pthread.h>
45 #include "common.h"
46 
47 #if defined(SWIGJAVA) || defined(JAVACALLBACK)
48 #include <jni.h>
49 void mraa_java_isr_callback(void *args);
50 #endif
51 
55 typedef struct _gpio* mraa_gpio_context;
56 
60 typedef enum {
66 
70 typedef enum {
76 
80 typedef enum {
86 
90 typedef enum {
94 
95 
99 typedef enum {
103 
110 mraa_gpio_context mraa_gpio_init(int pin);
111 
118 mraa_gpio_context mraa_gpio_init_raw(int gpiopin);
119 
127 mraa_result_t mraa_gpio_edge_mode(mraa_gpio_context dev, mraa_gpio_edge_t mode);
128 
139 mraa_result_t mraa_gpio_isr(mraa_gpio_context dev, mraa_gpio_edge_t edge, void (*fptr)(void*), void* args);
140 
148 mraa_result_t mraa_gpio_isr_exit(mraa_gpio_context dev);
149 
157 mraa_result_t mraa_gpio_mode(mraa_gpio_context dev, mraa_gpio_mode_t mode);
158 
166 mraa_result_t mraa_gpio_dir(mraa_gpio_context dev, mraa_gpio_dir_t dir);
167 
175 mraa_result_t mraa_gpio_read_dir(mraa_gpio_context dev, mraa_gpio_dir_t *dir);
176 
184 mraa_result_t mraa_gpio_close(mraa_gpio_context dev);
185 
193 int mraa_gpio_read(mraa_gpio_context dev);
194 
202 mraa_result_t mraa_gpio_write(mraa_gpio_context dev, int value);
203 
211 mraa_result_t mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t owner);
212 
220 mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap);
221 
228 int mraa_gpio_get_pin(mraa_gpio_context dev);
229 
236 int mraa_gpio_get_pin_raw(mraa_gpio_context dev);
237 
245 mraa_result_t mraa_gpio_input_mode(mraa_gpio_context dev, mraa_gpio_input_mode_t mode);
246 
255 
256 #ifdef __cplusplus
257 }
258 #endif
Definition: gpio.h:84
mraa_result_t mraa_gpio_owner(mraa_gpio_context dev, mraa_boolean_t owner)
Definition: gpio.h:64
Definition: gpio.h:74
mraa_result_t mraa_gpio_isr(mraa_gpio_context dev, mraa_gpio_edge_t edge, void(*fptr)(void *), void *args)
unsigned int mraa_boolean_t
Definition: common.h:67
Definition: gpio.h:81
Definition: gpio.h:82
mraa_result_t mraa_gpio_isr_exit(mraa_gpio_context dev)
Definition: gpio.h:61
mraa_result_t mraa_gpio_input_mode(mraa_gpio_context dev, mraa_gpio_input_mode_t mode)
mraa_result_t mraa_gpio_close(mraa_gpio_context dev)
mraa_result_t mraa_gpio_dir(mraa_gpio_context dev, mraa_gpio_dir_t dir)
Definition: gpio.h:73
mraa_gpio_dir_t
Definition: gpio.h:70
mraa_gpio_mode_t
Definition: gpio.h:60
mraa_result_t mraa_gpio_mode(mraa_gpio_context dev, mraa_gpio_mode_t mode)
int mraa_gpio_get_pin(mraa_gpio_context dev)
mraa_result_t mraa_gpio_edge_mode(mraa_gpio_context dev, mraa_gpio_edge_t mode)
Definition: gpio.h:91
mraa_gpio_edge_t
Definition: gpio.h:80
Definition: gpio.h:72
mraa_gpio_context mraa_gpio_init_raw(int gpiopin)
Definition: gpio.h:92
struct _gpio * mraa_gpio_context
Definition: gpio.h:55
mraa_gpio_context mraa_gpio_init(int pin)
int mraa_gpio_get_pin_raw(mraa_gpio_context dev)
Definition: gpio.h:71
mraa_result_t
Definition: types.h:206
Definition: gpio.h:83
mraa_result_t mraa_gpio_read_dir(mraa_gpio_context dev, mraa_gpio_dir_t *dir)
Definition: gpio.h:62
mraa_result_t mraa_gpio_write(mraa_gpio_context dev, int value)
mraa_gpio_input_mode_t
Definition: gpio.h:90
mraa_result_t mraa_gpio_use_mmaped(mraa_gpio_context dev, mraa_boolean_t mmap)
Definition: gpio.h:101
mraa_gpio_out_driver_mode_t
Definition: gpio.h:99
int mraa_gpio_read(mraa_gpio_context dev)
Definition: gpio.h:63
mraa_result_t mraa_gpio_out_driver_mode(mraa_gpio_context dev, mraa_gpio_out_driver_mode_t mode)
Definition: gpio.h:100