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 //Horrible hacks to silence gcc when compiling on systems that are not the BBB
35 extern bool True_Stub(int arg, ...);
36 extern bool ADC_Read_Stub(int *val, ...);
37 extern bool GPIO_Read_Stub(bool *val, ...);
39 #define GPIO_Export(pin) True_Stub((int)pin)
40 #define GPIO_Unexport(pin) (void)0
42 #define PWM_Export(pin) True_Stub((int)pin)
43 #define PWM_Unexport(pin) (void)0
45 #define ADC_Export(pin) True_Stub((int)pin)
46 #define ADC_Unexport(pin) (void)0
48 #define GPIO_Read(pin, result) GPIO_Read_Stub(result, pin)
49 #define GPIO_Set(pin, value) True_Stub((int)pin, value)
51 #define ADC_Read(id, value) ADC_Read_Stub(value, id)
53 #define PWM_Set(pin, polarity, period, duty) True_Stub((int)pin, polarity, period, duty)
54 #define PWM_Stop(pin) True_Stub((int)pin)