X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=server%2Fbbb_pin.h;h=14bc7ebbb272820b3fc26b26851375dc8a1c8485;hb=HEAD;hp=ce91e5aeb7da2520718582b0ec8d5fe734d0bc38;hpb=10a0d0813cab99327bcb7f7fcb0008c783cfc685;p=matches%2FMCTX3420.git diff --git a/server/bbb_pin.h b/server/bbb_pin.h index ce91e5a..14bc7eb 100644 --- a/server/bbb_pin.h +++ b/server/bbb_pin.h @@ -12,43 +12,49 @@ #if defined(_BBB) || defined(_BBB_PIN_SRC) // Initialise / Deinitialise functions -extern void GPIO_Export(int pin); +extern bool GPIO_Export(int pin); extern void GPIO_Unexport(int pin); -extern void PWM_Export(int pin); +extern bool PWM_Export(int pin); extern void PWM_Unexport(int pin); -extern void ADC_Export(int pin); +extern bool ADC_Export(int pin); extern void ADC_Unexport(int pin); // Pin reading/setting functions -extern bool GPIO_Read(int pin); -extern void GPIO_Set(int pin, bool value); +extern bool GPIO_Read(int pin, bool *result); +extern bool GPIO_Set(int pin, bool value); -extern int ADC_Read(int pin); +extern bool ADC_Read(int id, int *value); -extern void PWM_Set(int pin, bool polarity, long period, long duty); // period and duty are in ns -extern void PWM_Stop(int pin); -#else -//Empty defines so it compiles on any platform that's not the BBB -#define GPIO_Export(pin) -#define GPIO_Unexport(pin) +extern bool PWM_Set(int pin, bool polarity, long period, long duty); // period and duty are in ns +extern bool PWM_Stop(int pin); -#define PWM_Export(pin) -#define PWM_Unexport(pin) +#else +//! @cond Doxygen_Suppress +//Horrible hacks to silence gcc when compiling on systems that are not the BBB +extern bool True_Stub(int arg, ...); +extern bool ADC_Read_Stub(int *val, ...); +extern bool GPIO_Read_Stub(bool *val, ...); -#define ADC_Export(pin) -#define ADC_Unexport(pin) +#define GPIO_Export(pin) True_Stub((int)pin) +#define GPIO_Unexport(pin) (void)0 -#define GPIO_Read(pin) 0 -#define GPIO_Set(pin, value) +#define PWM_Export(pin) True_Stub((int)pin) +#define PWM_Unexport(pin) (void)0 -#define ADC_Read(pin) 0 +#define ADC_Export(pin) True_Stub((int)pin) +#define ADC_Unexport(pin) (void)0 -#define PWM_Set(pin, polarity, period, duty) -#define PWM_Stop(Pin) +#define GPIO_Read(pin, result) GPIO_Read_Stub(result, pin) +#define GPIO_Set(pin, value) True_Stub((int)pin, value) +#define ADC_Read(id, value) ADC_Read_Stub(value, id) +#define PWM_Set(pin, polarity, period, duty) True_Stub((int)pin, polarity, period, duty) +#define PWM_Stop(pin) True_Stub((int)pin) +//yuck +//! @endcond #endif //_BBB #endif //_BBB_PIN_H