pihwm
A lightweight C library for Raspberry Pi hardware modules.
Main Page
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Groups
Pages
pi_gpio.h
Go to the documentation of this file.
1
28
#ifndef PI_GPIO_H
29
#define PI_GPIO_H
30
31
// Useful constants
32
#define INPUT 1
33
#define OUTPUT 0
34
#define IN INPUT
35
#define OUT OUTPUT
36
37
#define HIGH 1
38
#define LOW 0
39
#define ON HIGH
40
#define OFF LOW
41
42
// Function prototypes
43
int
gpio_init
(
unsigned
int
pin,
unsigned
int
dir);
44
int
gpio_set_int
(
unsigned
int
pin,
void
(*isr) (
int
),
char
*mode);
45
int
gpio_clear_int
(
unsigned
int
pin);
46
int
gpio_write
(
unsigned
int
pin,
unsigned
int
val);
47
int
gpio_read
(
unsigned
int
pin);
48
int
gpio_release
(
unsigned
int
pin);
49
50
// Aliases for pseudo-Arduino compatibility
51
#define pinMode(pin, dir) gpio_init(pin, dir);
52
#define digitalWrite(pin, val) gpio_write(pin, val);
53
#define digitalRead(pin) gpio_read(pin);
54
#define attachInterrupt(pin, isr, mode) gpio_set_int(pin, isr, mode);
55
#define detachInterrupt(pin) gpio_clear_int(pin);
56
57
#endif
58
lib
pi_gpio.h
Generated on Wed Apr 17 2013 23:40:57 for pihwm by
1.8.2