diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-04 08:08:15 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-04 08:08:15 +0200 |
commit | c25b36b014e22e4a49e25c676c8571f929279f16 (patch) | |
tree | c4611deec43d05c2f7651dc18388408236e96e67 /libk8055 | |
parent | 3f6b29ca999bc27bd09f2053759e7a3c4f02de24 (diff) | |
download | k8055-c25b36b014e22e4a49e25c676c8571f929279f16.zip k8055-c25b36b014e22e4a49e25c676c8571f929279f16.tar.gz |
small fixes
Diffstat (limited to 'libk8055')
-rw-r--r-- | libk8055/k8055.h | 2 | ||||
-rw-r--r-- | libk8055/libk8055.c | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/libk8055/k8055.h b/libk8055/k8055.h index c28d4ec..83602a3 100644 --- a/libk8055/k8055.h +++ b/libk8055/k8055.h @@ -85,7 +85,7 @@ extern "C" { int k8055_read_all_digital( struct k8055_dev* dev ); int k8055_write_all_digital( struct k8055_dev* dev, int data ); - int k8055_set_all_values( struct k8055_dev* dev, int digital_data, int ad_data1, int ad_data2 ); + int k8055_set_all_values( struct k8055_dev* dev, int d_data, int a_data1, int a_data2 ); int k8055_read_all_values( struct k8055_dev* dev, int* data1, int* data2, int* data3, int* data4, int* data5 ); int k8055_reset_counter( struct k8055_dev* dev, int counter ); diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c index 85ee4a3..a73312d 100644 --- a/libk8055/libk8055.c +++ b/libk8055/libk8055.c @@ -210,6 +210,7 @@ char* k8055_version( void ) { } int k8055_open_device( struct k8055_dev* dev, int board_address ) { + if(dev->dev_no != 0 ) return K8055_ERROR; int ipid = K8055_IPID + board_address; libusb_device** list; libusb_device* found = NULL; @@ -237,7 +238,6 @@ int k8055_open_device( struct k8055_dev* dev, int board_address ) { if( debug ) fprintf( stderr, "No Velleman device found.\n" ); return K8055_ERROR; } - dev->dev_no = 0; dev->usb_handle = NULL; if( libusb_open( found , &dev->usb_handle )!=0 ) { if( debug ) fprintf( stderr,"usb_open failure\n" ); @@ -431,11 +431,11 @@ int k8055_read_all_values( struct k8055_dev* dev, int* data1, int* data2, int* d return 0; } -int k8055_set_all_values( struct k8055_dev* dev, int digital_data, int ad_data1, int ad_data2 ) { +int k8055_set_all_values( struct k8055_dev* dev, int d_data, int a_data1, int a_data2 ) { dev->data_out[CMD_OFFSET] = CMD_SET_ANALOG_DIGITAL; - dev->data_out[DIGITAL_OUT_OFFSET] = ( unsigned char )digital_data; - dev->data_out[ANALOG_1_OFFSET] = ( unsigned char )ad_data1; - dev->data_out[ANALOG_2_OFFSET] = ( unsigned char )ad_data2; + dev->data_out[DIGITAL_OUT_OFFSET] = ( unsigned char )d_data; + dev->data_out[ANALOG_1_OFFSET] = ( unsigned char )a_data1; + dev->data_out[ANALOG_2_OFFSET] = ( unsigned char )a_data2; return k8055_write( dev ); } |