summaryrefslogtreecommitdiffstats
path: root/python/native/gpio.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-12-25 13:25:16 +0100
committermanuel <manuel@mausz.at>2013-12-25 13:25:16 +0100
commit0c8c9ad976879f7c90f9915a60845ccb0cdb337d (patch)
tree162951b4713f3836f4114958a423e2c90ecf9c6b /python/native/gpio.h
downloadwebiopi-0c8c9ad976879f7c90f9915a60845ccb0cdb337d.tar.gz
webiopi-0c8c9ad976879f7c90f9915a60845ccb0cdb337d.tar.bz2
webiopi-0c8c9ad976879f7c90f9915a60845ccb0cdb337d.zip
initial commit
Diffstat (limited to 'python/native/gpio.h')
-rw-r--r--python/native/gpio.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/python/native/gpio.h b/python/native/gpio.h
new file mode 100644
index 0000000..cb0147c
--- /dev/null
+++ b/python/native/gpio.h
@@ -0,0 +1,73 @@
1/*
2Copyright (c) 2012 Ben Croston / 2012-2013 Eric PTAK
3
4Permission is hereby granted, free of charge, to any person obtaining a copy of
5this software and associated documentation files (the "Software"), to deal in
6the Software without restriction, including without limitation the rights to
7use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8of the Software, and to permit persons to whom the Software is furnished to do
9so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20SOFTWARE.
21*/
22
23#define SETUP_OK 0
24#define SETUP_DEVMEM_FAIL 1
25#define SETUP_MALLOC_FAIL 2
26#define SETUP_MMAP_FAIL 3
27
28#define GPIO_COUNT 54
29
30#define IN 0
31#define OUT 1
32#define ALT5 2
33#define ALT4 3
34#define ALT0 4
35#define ALT1 5
36#define ALT2 6
37#define ALT3 7
38#define PWM 8
39
40#define LOW 0
41#define HIGH 1
42
43#define PUD_OFF 0
44#define PUD_DOWN 1
45#define PUD_UP 2
46
47#define RATIO 1
48#define ANGLE 2
49
50struct pulse {
51 int type;
52 float value;
53};
54
55int setup(void);
56int get_function(int gpio);
57void set_function(int gpio, int function, int pud);
58int input(int gpio);
59void output(int gpio, int value);
60void outputSequence(int gpio, int period, char* sequence);
61struct pulse* getPulse(int gpio);
62void pulseMilli(int gpio, int up, int down);
63void pulseMilliRatio(int gpio, int width, float ratio);
64void pulseMicro(int gpio, int up, int down);
65void pulseMicroRatio(int gpio, int width, float ratio);
66void pulseAngle(int gpio, float angle);
67void pulseRatio(int gpio, float ratio);
68void enablePWM(int gpio);
69void disablePWM(int gpio);
70int isPWMEnabled(int gpio);
71
72void cleanup(void);
73