diff options
| author | manuel <manuel@mausz.at> | 2013-12-25 13:25:16 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-12-25 13:25:16 +0100 |
| commit | 0c8c9ad976879f7c90f9915a60845ccb0cdb337d (patch) | |
| tree | 162951b4713f3836f4114958a423e2c90ecf9c6b /python/native/gpio.h | |
| download | webiopi-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.h | 73 |
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 | /* | ||
| 2 | Copyright (c) 2012 Ben Croston / 2012-2013 Eric PTAK | ||
| 3 | |||
| 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
| 5 | this software and associated documentation files (the "Software"), to deal in | ||
| 6 | the Software without restriction, including without limitation the rights to | ||
| 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | ||
| 8 | of the Software, and to permit persons to whom the Software is furnished to do | ||
| 9 | so, subject to the following conditions: | ||
| 10 | |||
| 11 | The above copyright notice and this permission notice shall be included in all | ||
| 12 | copies or substantial portions of the Software. | ||
| 13 | |||
| 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 20 | SOFTWARE. | ||
| 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 | |||
| 50 | struct pulse { | ||
| 51 | int type; | ||
| 52 | float value; | ||
| 53 | }; | ||
| 54 | |||
| 55 | int setup(void); | ||
| 56 | int get_function(int gpio); | ||
| 57 | void set_function(int gpio, int function, int pud); | ||
| 58 | int input(int gpio); | ||
| 59 | void output(int gpio, int value); | ||
| 60 | void outputSequence(int gpio, int period, char* sequence); | ||
| 61 | struct pulse* getPulse(int gpio); | ||
| 62 | void pulseMilli(int gpio, int up, int down); | ||
| 63 | void pulseMilliRatio(int gpio, int width, float ratio); | ||
| 64 | void pulseMicro(int gpio, int up, int down); | ||
| 65 | void pulseMicroRatio(int gpio, int width, float ratio); | ||
| 66 | void pulseAngle(int gpio, float angle); | ||
| 67 | void pulseRatio(int gpio, float ratio); | ||
| 68 | void enablePWM(int gpio); | ||
| 69 | void disablePWM(int gpio); | ||
| 70 | int isPWMEnabled(int gpio); | ||
| 71 | |||
| 72 | void cleanup(void); | ||
| 73 | |||
