CRpi
A library for rpi with intefaces to: gpio, pwm, dma
gpio.h
Go to the documentation of this file.
1 #ifndef GPIO_H
2 #define GPIO_H
3 
4 #include <stdint.h>
5 
6 
16 #define BCM_MIN 0
18 #define BCM_MAX 27
20 
22 #define PORT_FUNCTION_INPUT 0
23 #define PORT_FUNCTION_OUTPUT 1
25 #define PORT_FUNCTION_ALT_0 4
27 #define PORT_FUNCTION_ALT_1 5
29 #define PORT_FUNCTION_ALT_2 6
31 #define PORT_FUNCTION_ALT_3 7
33 #define PORT_FUNCTION_ALT_4 3
35 #define PORT_FUNCTION_ALT_5 2
37 
38 
39 
40 int gpio_init();
41 
42 int gpio_isInit();
43 
44 int gpio_setFunction(int bcmPort, int function);
45 
46 int gpio_setOutput(int bcmPort, int value);
47 
48 int gpio_setOutputAll(uint64_t set, uint64_t clear);
49 
50 
51 #endif
int gpio_init()
Initializes the interface, to be called before any other function in this file.
Definition: gpio.cpp:23
int gpio_setFunction(int bcmPort, int function)
Sets the function of the specified port.
Definition: gpio.cpp:55
int gpio_setOutput(int bcmPort, int value)
Sets the output at the specified port. The port will output this value if set to the output function...
Definition: gpio.cpp:82
int gpio_setOutputAll(uint64_t set, uint64_t clear)
sets all the specified gpios to the specified values
Definition: gpio.cpp:127
int gpio_isInit()
true if gpio_init has been called with success
Definition: gpio.cpp:39