Fix brief string
[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 bool GPIO_Export(int pin);
16 extern void GPIO_Unexport(int pin);
17
18 extern bool PWM_Export(int pin);
19 extern void PWM_Unexport(int pin);
20
21 extern bool ADC_Export(int pin);
22 extern void ADC_Unexport(int pin);
23
24 // Pin reading/setting functions
25 extern bool GPIO_Read(int pin, bool *result);
26 extern bool GPIO_Set(int pin, bool value);
27
28 extern bool ADC_Read(int id, int *value);
29
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);
32
33 #else
34 //! @cond Doxygen_Suppress
35 //Horrible hacks to silence gcc when compiling on systems that are not the BBB
36 extern bool True_Stub(int arg, ...);
37 extern bool ADC_Read_Stub(int *val, ...);
38 extern bool GPIO_Read_Stub(bool *val, ...);
39
40 #define GPIO_Export(pin) True_Stub((int)pin)
41 #define GPIO_Unexport(pin) (void)0
42
43 #define PWM_Export(pin) True_Stub((int)pin)
44 #define PWM_Unexport(pin) (void)0
45
46 #define ADC_Export(pin) True_Stub((int)pin)
47 #define ADC_Unexport(pin) (void)0
48
49 #define GPIO_Read(pin, result) GPIO_Read_Stub(result, pin)
50 #define GPIO_Set(pin, value) True_Stub((int)pin, value)
51
52 #define ADC_Read(id, value) ADC_Read_Stub(value, id)
53
54 #define PWM_Set(pin, polarity, period, duty) True_Stub((int)pin, polarity, period, duty)
55 #define PWM_Stop(pin) True_Stub((int)pin) 
56 //yuck
57 //! @endcond
58 #endif //_BBB
59
60 #endif //_BBB_PIN_H
61
62 //EOF

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