Add usleep to strain.c just in case...
[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 //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, ...);
38
39 #define GPIO_Export(pin) True_Stub((int)pin)
40 #define GPIO_Unexport(pin) (void)0
41
42 #define PWM_Export(pin) True_Stub((int)pin)
43 #define PWM_Unexport(pin) (void)0
44
45 #define ADC_Export(pin) True_Stub((int)pin)
46 #define ADC_Unexport(pin) (void)0
47
48 #define GPIO_Read(pin, result) GPIO_Read_Stub(result, pin)
49 #define GPIO_Set(pin, value) True_Stub((int)pin, value)
50
51 #define ADC_Read(id, value) ADC_Read_Stub(value, id)
52
53 #define PWM_Set(pin, polarity, period, duty) True_Stub((int)pin, polarity, period, duty)
54 #define PWM_Stop(pin) True_Stub((int)pin) 
55 //yuck
56
57 #endif //_BBB
58
59 #endif //_BBB_PIN_H
60
61 //EOF

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