3 * @brief Definition of functions for controlling pins on the Beaglebone Black
11 #include "bbb_pin_defines.h"
13 #if defined(_BBB) || defined(_BBB_PIN_SRC)
14 // Initialise / Deinitialise functions
15 extern bool GPIO_Export(int pin);
16 extern void GPIO_Unexport(int pin);
18 extern bool PWM_Export(int pin);
19 extern void PWM_Unexport(int pin);
21 extern bool ADC_Export(int pin);
22 extern void ADC_Unexport(int pin);
24 // Pin reading/setting functions
25 extern bool GPIO_Read(int pin, bool *result);
26 extern bool GPIO_Set(int pin, bool value);
28 extern bool ADC_Read(int id, int *value);
30 extern bool PWM_Set(int pin, bool polarity, long period, long duty); // period and duty are in ns
31 extern bool PWM_Stop(int pin);
34 //'Empty' defines so it compiles on any platform that's not the BBB
36 extern bool GPIO_Export(int pin);
37 extern void GPIO_Unexport(int pin);
39 #define GPIO_Export(pin) true
40 #define GPIO_Unexport(pin)
42 #define PWM_Export(pin) true
43 #define PWM_Unexport(pin)
45 #define ADC_Export(pin) true
46 #define ADC_Unexport(pin)
48 //Hack to both zero the result field (so it's never uninitialised) and return true
49 #define GPIO_Read(pin, result) ((*(result) = 0) == 0)
50 #define GPIO_Set(pin, value) true
52 #define ADC_Read(id, value) ((*(value) = 0) == 0)
54 #define PWM_Set(pin, polarity, period, duty) true
55 #define PWM_Stop(pin) true