summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-03-01 07:44:35 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2011-03-01 07:44:35 +0100
commit52139c71e12fe91955dc5d23c072c5662e906f52 (patch)
treeaf5e6ec6814f7cdad0fcc14b583b35e43d33828c
parent3dbfdda5d447eea8389656b5bf9058ac8b80e3a9 (diff)
downloadk8055-52139c71e12fe91955dc5d23c072c5662e906f52.zip
k8055-52139c71e12fe91955dc5d23c072c5662e906f52.tar.gz
channel and counter becomes integers
-rw-r--r--libk8055/k8055.h20
-rw-r--r--libk8055/libk8055.c20
2 files changed, 20 insertions, 20 deletions
diff --git a/libk8055/k8055.h b/libk8055/k8055.h
index 1142114..2966ab6 100644
--- a/libk8055/k8055.h
+++ b/libk8055/k8055.h
@@ -38,26 +38,26 @@ extern "C" {
long search_devices( void );
int open_device( struct k8055_dev* dev, int board_address );
int close_device( struct k8055_dev* dev );
- long read_analog_channel( struct k8055_dev* dev, long channel );
+ long read_analog_channel( struct k8055_dev* dev, int channel );
int read_all_analog( struct k8055_dev* dev, long* data1, long* data2 );
- int output_analog_channel( struct k8055_dev* dev ,long channel, long data );
+ int output_analog_channel( struct k8055_dev* dev ,int channel, long data );
int output_all_analog( struct k8055_dev* dev, long data1, long data2 );
int clear_all_analog( struct k8055_dev* dev );
- int clear_analog_channel( struct k8055_dev* dev, long channel );
- int set_analog_channel( struct k8055_dev* dev, long channel );
+ int clear_analog_channel( struct k8055_dev* dev, int channel );
+ int set_analog_channel( struct k8055_dev* dev, int channel );
int set_all_analog( struct k8055_dev* dev );
int write_all_digital( struct k8055_dev* dev, long data );
- int clear_digital_channel( struct k8055_dev* dev, long channel );
+ int clear_digital_channel( struct k8055_dev* dev, int channel );
int clear_all_digital( struct k8055_dev* dev );
- int set_digital_channel( struct k8055_dev* dev, long channel );
+ int set_digital_channel( struct k8055_dev* dev, int channel );
int set_all_digital( struct k8055_dev* dev );
- int read_digital_channel( struct k8055_dev* dev, long channel );
+ int read_digital_channel( struct k8055_dev* dev, int channel );
long read_all_digital( struct k8055_dev* dev );
int read_all_values( struct k8055_dev* dev, long int* data1, long int* data2, long int* data3, long int* data4, long int* data5 );
int set_all_values( struct k8055_dev* dev, int digital_data, int ad_data1, int ad_data2 );
- int reset_counter( struct k8055_dev* dev, long counter );
- long read_counter( struct k8055_dev* dev, long counter );
- int set_counter_debounce_time( struct k8055_dev* dev, long counter, long debounce_time );
+ int reset_counter( struct k8055_dev* dev, int counter );
+ long read_counter( struct k8055_dev* dev, int counter );
+ int set_counter_debounce_time( struct k8055_dev* dev, int counter, long debounce_time );
/* Velleman API */
char* Version( void );
diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c
index 00528ca..8db1f13 100644
--- a/libk8055/libk8055.c
+++ b/libk8055/libk8055.c
@@ -260,7 +260,7 @@ long search_devices( void ) {
return ret;
}
-long read_analog_channel( struct k8055_dev* dev, long channel ) {
+long read_analog_channel( struct k8055_dev* dev, int channel ) {
if ( !( channel==1 || channel==2 ) ) return K8055_ERROR;
if ( k8055_read( dev )==0 ) {
if ( channel==1 ) {
@@ -279,7 +279,7 @@ int read_all_analog( struct k8055_dev* dev, long* data1, long* data2 ) {
return 0;
}
-int output_analog_channel( struct k8055_dev* dev ,long channel, long data ) {
+int output_analog_channel( struct k8055_dev* dev ,int channel, long data ) {
if ( !( channel==1 || channel==2 ) ) return K8055_ERROR;
dev->data_out[0] = CMD_SET_ANALOG_DIGITAL;
if ( channel==1 ) {
@@ -301,7 +301,7 @@ int clear_all_analog( struct k8055_dev* dev ) {
return output_all_analog( dev, 0, 0 );
}
-int clear_analog_channel( struct k8055_dev* dev, long channel ) {
+int clear_analog_channel( struct k8055_dev* dev, int channel ) {
if ( !( channel==1 || channel==2 ) ) return K8055_ERROR;
if ( channel==1 ) {
return output_analog_channel( dev, 1, 0 );
@@ -310,7 +310,7 @@ int clear_analog_channel( struct k8055_dev* dev, long channel ) {
}
}
-int set_analog_channel( struct k8055_dev* dev, long channel ) {
+int set_analog_channel( struct k8055_dev* dev, int channel ) {
if ( !( channel==1 || channel==2 ) ) return K8055_ERROR;
if ( channel == 2 ) {
return output_analog_channel( dev, 2, 0xff );
@@ -329,7 +329,7 @@ int write_all_digital( struct k8055_dev* dev, long data ) {
return k8055_write( dev );
}
-int clear_digital_channel( struct k8055_dev* dev, long channel ) {
+int clear_digital_channel( struct k8055_dev* dev, int channel ) {
unsigned char data;
if ( channel<1 || channel>8 ) return K8055_ERROR;
data = dev->data_out[1] & ~( 1 << ( channel-1 ) );
@@ -340,7 +340,7 @@ int clear_all_digital( struct k8055_dev* dev ) {
return write_all_digital( dev, 0x00 );
}
-int set_digital_channel( struct k8055_dev* dev, long channel ) {
+int set_digital_channel( struct k8055_dev* dev, int channel ) {
unsigned char data;
if ( channel<1 || channel>8 ) return K8055_ERROR;
data = dev->data_out[1] | ( 1 << ( channel-1 ) );
@@ -351,7 +351,7 @@ int set_all_digital( struct k8055_dev* dev ) {
return write_all_digital( dev, 0xff );
}
-int read_digital_channel( struct k8055_dev* dev, long channel ) {
+int read_digital_channel( struct k8055_dev* dev, int channel ) {
int rval;
if ( channel<1 || channel>8 ) return K8055_ERROR;
if ( ( rval = read_all_digital( dev ) ) == K8055_ERROR ) return K8055_ERROR;
@@ -389,14 +389,14 @@ int set_all_values( struct k8055_dev* dev, int digital_data, int ad_data1, int a
return k8055_write( dev );
}
-int reset_counter( struct k8055_dev* dev, long counter ) {
+int reset_counter( struct k8055_dev* dev, int counter ) {
if ( !( counter==1 || counter==2 ) ) return K8055_ERROR;
dev->data_out[0] = 0x02 + ( unsigned char )counter;
dev->data_out[3+counter] = 0x00;
return k8055_write( dev );
}
-long read_counter( struct k8055_dev* dev, long counter ) {
+long read_counter( struct k8055_dev* dev, int counter ) {
if ( !( counter==1 || counter==2 ) ) return K8055_ERROR;
if ( k8055_read( dev )!=0 ) return K8055_ERROR;
if ( counter==1 ) {
@@ -406,7 +406,7 @@ long read_counter( struct k8055_dev* dev, long counter ) {
}
}
-int set_counter_debounce_time( struct k8055_dev* dev, long counter, long debounce_time ) {
+int set_counter_debounce_time( struct k8055_dev* dev, int counter, long debounce_time ) {
float value;
if ( !( counter==1 || counter==2 ) ) return K8055_ERROR;
dev->data_out[0] = ( unsigned char )counter;