summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-03-01 09:56:34 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2011-03-01 09:56:34 +0100
commitce2df0909161eee14f8a9146b5c0b20fe09058f3 (patch)
treed30577897037b0f4197e24b80ff04670713f1951
parent1a663cd2b28b8558f92d99078ec0daed288c87be (diff)
downloadk8055-ce2df0909161eee14f8a9146b5c0b20fe09058f3.zip
k8055-ce2df0909161eee14f8a9146b5c0b20fe09058f3.tar.gz
update C API long* => int* ...
-rw-r--r--libk8055/k8055.h4
-rw-r--r--libk8055/libk8055.c19
2 files changed, 17 insertions, 6 deletions
diff --git a/libk8055/k8055.h b/libk8055/k8055.h
index f180831..37a70af 100644
--- a/libk8055/k8055.h
+++ b/libk8055/k8055.h
@@ -47,7 +47,7 @@ extern "C" {
int k8055_set_all_analog( struct k8055_dev* dev );
int k8055_clear_all_analog( struct k8055_dev* dev );
- int k8055_read_all_analog( struct k8055_dev* dev, long* data1, long* data2 );
+ int k8055_read_all_analog( struct k8055_dev* dev, int* data1, int* data2 );
int k8055_write_all_analog( struct k8055_dev* dev, int data1, int data2 );
int k8055_set_digital_channel( struct k8055_dev* dev, int channel );
@@ -60,7 +60,7 @@ extern "C" {
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_read_all_values( struct k8055_dev* dev, long int* data1, long int* data2, long int* data3, long int* data4, long int* data5 );
+ 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 );
int k8055_read_counter( struct k8055_dev* dev, int counter );
diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c
index ba183b0..6d85c06 100644
--- a/libk8055/libk8055.c
+++ b/libk8055/libk8055.c
@@ -272,7 +272,7 @@ int k8055_read_analog_channel( struct k8055_dev* dev, int channel ) {
return K8055_ERROR;
}
-int k8055_read_all_analog( struct k8055_dev* dev, long* data1, long* data2 ) {
+int k8055_read_all_analog( struct k8055_dev* dev, int* data1, int* data2 ) {
if ( k8055_read( dev )!=0 ) return K8055_ERROR;
*data1 = dev->data_in[ANALOG_1_OFFSET];
*data2 = dev->data_in[ANALOG_2_OFFSET];
@@ -368,7 +368,7 @@ int k8055_read_all_digital( struct k8055_dev* dev ) {
return return_data;
}
-int k8055_read_all_values( struct k8055_dev* dev, long int* data1, long int* data2, long int* data3, long int* data4, long int* data5 ) {
+int k8055_read_all_values( struct k8055_dev* dev, int* data1, int* data2, int* data3, int* data4, int* data5 ) {
if ( k8055_read( dev )!=0 ) return K8055_ERROR;
*data1 = (
( ( dev->data_in[0] >> 4 ) & 0x03 ) | /* Input 1 and 2 */
@@ -468,7 +468,11 @@ long ReadAnalogChannel( long channel ) {
return k8055_read_analog_channel( curr_dev, channel );
}
int ReadAllAnalog( long* data1, long* data2 ) {
- return k8055_read_all_analog( curr_dev, data1, data2 );
+ int d1, d2;
+ int r = k8055_read_all_analog( curr_dev, &d1, &d2 );
+ *data1 = d1;
+ *data2 = d2;
+ return r;
}
int OutputAnalogChannel( long channel, long data ) {
return k8055_write_analog_channel( curr_dev, channel, data );
@@ -510,7 +514,14 @@ long ReadAllDigital() {
return k8055_read_all_digital( curr_dev );
}
int ReadAllValues( long int* data1, long int* data2, long int* data3, long int* data4, long int* data5 ) {
- return k8055_read_all_values( curr_dev, data1, data2, data3, data4, data5 );
+ int d1, d2, d3, d4, d5;
+ int r = k8055_read_all_values( curr_dev, &d1, &d2, &d3, &d4, &d5 );
+ *data1 = d1;
+ *data2 = d2;
+ *data3 = d3;
+ *data4 = d4;
+ *data5 = d5;
+ return r;
}
int SetAllValues( int DigitalData, int AdData1, int AdData2 ) {
return k8055_set_all_values( curr_dev, DigitalData, AdData1, AdData2 );