summaryrefslogtreecommitdiffstats
path: root/libk8055
diff options
context:
space:
mode:
Diffstat (limited to 'libk8055')
-rw-r--r--libk8055/k8055.h2
-rw-r--r--libk8055/libk8055.c10
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 );
}