summaryrefslogtreecommitdiffstats
path: root/libk8055/k8055.h
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-03-01 10:37:03 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2011-03-01 10:37:03 +0100
commit685999a84dad1fa51e28eb8c676e53fb3a856375 (patch)
treea8255b12b359eef55332ee00ba14a35e93f87040 /libk8055/k8055.h
parent4ac9d96b5ca74c03020282d1c486e0eecad58d73 (diff)
downloadk8055-685999a84dad1fa51e28eb8c676e53fb3a856375.zip
k8055-685999a84dad1fa51e28eb8c676e53fb3a856375.tar.gz
set k8055_read and k8055_write public, add data_in access functions
Diffstat (limited to 'libk8055/k8055.h')
-rw-r--r--libk8055/k8055.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libk8055/k8055.h b/libk8055/k8055.h
index 37a70af..121c757 100644
--- a/libk8055/k8055.h
+++ b/libk8055/k8055.h
@@ -25,12 +25,31 @@ extern "C" {
#define PACKET_LEN 8
+#define DIGITAL_INP_OFFSET 0
+#define DIGITAL_OUT_OFFSET 1
+#define ANALOG_1_OFFSET 2
+#define ANALOG_2_OFFSET 3
+#define COUNTER_1_OFFSET 4
+#define COUNTER_2_OFFSET 6
+
struct k8055_dev {
int dev_no;
struct usb_dev_handle* device_handle;
unsigned char data_in[PACKET_LEN+1];
unsigned char data_out[PACKET_LEN+1];
};
+ 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]; }
char* k8055_version( void );
void k8055_set_debug_on( void );