Interops with non-BBB platforms
[matches/MCTX3420.git] / server / bbb_pin.h
1 /**
2  * @file bbb_pin.h
3  * @brief Definition of functions for controlling pins on the Beaglebone Black
4  */
5
6 #ifndef _BBB_PIN_H
7 #define _BBB_PIN_H
8
9 #include "common.h"
10
11 #include "bbb_pin_defines.h"
12
13 #if defined(_BBB) || defined(_BBB_PIN_SRC)
14 // Initialise / Deinitialise functions
15 extern void GPIO_Export(int pin);
16 extern void GPIO_Unexport(int pin);
17
18 extern void PWM_Export(int pin);
19 extern void PWM_Unexport(int pin);
20
21 extern void ADC_Export(int pin);
22 extern void ADC_Unexport(int pin);
23
24 // Pin reading/setting functions
25 extern bool GPIO_Read(int pin);
26 extern void GPIO_Set(int pin, bool value);
27
28 extern int ADC_Read(int pin);
29
30 extern void PWM_Set(int pin, bool polarity, long period, long duty); // period and duty are in ns
31 extern void PWM_Stop(int pin);
32 #else
33 //Empty defines so it compiles on any platform that's not the BBB
34 #define GPIO_Export(pin)
35 #define GPIO_Unexport(pin)
36
37 #define PWM_Export(pin)
38 #define PWM_Unexport(pin)
39
40 #define ADC_Export(pin)
41 #define ADC_Unexport(pin)
42
43 #define GPIO_Read(pin) 0
44 #define GPIO_Set(pin, value)
45
46 #define ADC_Read(pin) 0
47
48 #define PWM_Set(pin, polarity, period, duty)
49 #define PWM_Stop(Pin)
50
51
52 #endif //_BBB
53
54 #endif //_BBB_PIN_H
55
56 //EOF

UCC git Repository :: git.ucc.asn.au