diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-03-01 11:26:58 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-03-01 11:26:58 +0100 |
commit | 5ce542cf07a3db8b28cee5362802188ae9937631 (patch) | |
tree | e61bc43e7c93962d6e5910c84383524f628808b1 /libk8055 | |
parent | 473c9d43885e943b52e4db4ca8af18b547feb15d (diff) | |
download | k8055-5ce542cf07a3db8b28cee5362802188ae9937631.zip k8055-5ce542cf07a3db8b28cee5362802188ae9937631.tar.gz |
fix header to prevent compilation complications
Diffstat (limited to 'libk8055')
-rw-r--r-- | libk8055/k8055++.h | 4 | ||||
-rw-r--r-- | libk8055/k8055.h | 22 | ||||
-rw-r--r-- | libk8055/libk8055.c | 36 |
3 files changed, 53 insertions, 9 deletions
diff --git a/libk8055/k8055++.h b/libk8055/k8055++.h index 074458a..87c9b9b 100644 --- a/libk8055/k8055++.h +++ b/libk8055/k8055++.h @@ -22,6 +22,9 @@ * */ +#ifndef K8055_CPP_H +#define K8055_CPP_H 1 + #include "k8055.h" class K8055 { @@ -79,3 +82,4 @@ class K8055 { struct k8055_dev dev; }; +#endif // K8055_CPP_H diff --git a/libk8055/k8055.h b/libk8055/k8055.h index 121c757..b63f51f 100644 --- a/libk8055/k8055.h +++ b/libk8055/k8055.h @@ -19,6 +19,9 @@ http://opensource.org/licenses/ */ +#ifndef K8055_H +#define K8055_H 1 + #ifdef __cplusplus extern "C" { #endif @@ -41,15 +44,15 @@ extern "C" { int k8055_read( struct k8055_dev* dev ); int k8055_write( struct k8055_dev* dev ); - int k8055_digital_1( struct k8055_dev* dev ) { return ( ( dev->data_in[DIGITAL_INP_OFFSET] >> 4 ) & 0x01 ); } - int k8055_digital_2( struct k8055_dev* dev ) { return ( ( dev->data_in[DIGITAL_INP_OFFSET] >> 5 ) & 0x01 ); } - int k8055_digital_3( struct k8055_dev* dev ) { return ( ( dev->data_in[DIGITAL_INP_OFFSET] ) & 0x01 ); } - int k8055_digital_4( struct k8055_dev* dev ) { return ( ( dev->data_in[DIGITAL_INP_OFFSET] >> 6 ) & 0x01 ); } - int k8055_digital_5( struct k8055_dev* dev ) { return ( ( dev->data_in[DIGITAL_INP_OFFSET] >> 7 ) & 0x01 ); } - int k8055_analog_1( struct k8055_dev* dev ) { return dev->data_in[ANALOG_1_OFFSET]; } - int k8055_analog_2( struct k8055_dev* dev ) { return dev->data_in[ANALOG_2_OFFSET]; } - int k8055_counter_1( struct k8055_dev* dev ) { return dev->data_in[COUNTER_1_OFFSET]; } - int k8055_counter_2( struct k8055_dev* dev ) { return dev->data_in[COUNTER_2_OFFSET]; } + int k8055_digital_1( struct k8055_dev* dev ); + int k8055_digital_2( struct k8055_dev* dev ); + int k8055_digital_3( struct k8055_dev* dev ); + int k8055_digital_4( struct k8055_dev* dev ); + int k8055_digital_5( struct k8055_dev* dev ); + int k8055_analog_1( struct k8055_dev* dev ); + int k8055_analog_2( struct k8055_dev* dev ); + int k8055_counter_1( struct k8055_dev* dev ); + int k8055_counter_2( struct k8055_dev* dev ); char* k8055_version( void ); void k8055_set_debug_on( void ); @@ -116,3 +119,4 @@ extern "C" { } #endif +#endif // K8055_H diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c index 4fbb8d5..ad97891 100644 --- a/libk8055/libk8055.c +++ b/libk8055/libk8055.c @@ -132,6 +132,42 @@ int k8055_write( struct k8055_dev* dev ) { return K8055_ERROR; } +int k8055_digital_1( struct k8055_dev* dev ) { + return ( ( dev->data_in[DIGITAL_INP_OFFSET] >> 4 ) & 0x01 ); +} + +int k8055_digital_2( struct k8055_dev* dev ) { + return ( ( dev->data_in[DIGITAL_INP_OFFSET] >> 5 ) & 0x01 ); +} + +int k8055_digital_3( struct k8055_dev* dev ) { + return ( ( dev->data_in[DIGITAL_INP_OFFSET] ) & 0x01 ); +} + +int k8055_digital_4( struct k8055_dev* dev ) { + return ( ( dev->data_in[DIGITAL_INP_OFFSET] >> 6 ) & 0x01 ); +} + +int k8055_digital_5( struct k8055_dev* dev ) { + return ( ( dev->data_in[DIGITAL_INP_OFFSET] >> 7 ) & 0x01 ); +} + +int k8055_analog_1( struct k8055_dev* dev ) { + return dev->data_in[ANALOG_1_OFFSET]; +} + +int k8055_analog_2( struct k8055_dev* dev ) { + return dev->data_in[ANALOG_2_OFFSET]; +} + +int k8055_counter_1( struct k8055_dev* dev ) { + return dev->data_in[COUNTER_1_OFFSET]; +} + +int k8055_counter_2( struct k8055_dev* dev ) { + return dev->data_in[COUNTER_2_OFFSET]; +} + /* If device is owned by some kernel driver, try to disconnect it and claim the device*/ static int k8055_takeover_device( usb_dev_handle* udev, int interface ) { char driver_name[STR_BUFF]; |