From 85b41913139682838141a44b8d6e2d3f2df2cccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Mon, 6 Jun 2011 07:43:23 +0200 Subject: rename k8055_(set|read)_all_values to k8055_(write|read)_all_(outputs|inputs) --- k8055gui/MyFrame.cpp | 4 ++-- libk8055/k8055++.h | 4 ++-- libk8055/k8055.h | 4 ++-- libk8055/libk8055.c | 14 +++++++------- libk8055/libk8055.cpp | 8 ++++---- libk8055/main.c | 10 +++++----- pyk8055/libk8055.i | 12 ++++++------ 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/k8055gui/MyFrame.cpp b/k8055gui/MyFrame.cpp index 7ea9270..109cbc1 100644 --- a/k8055gui/MyFrame.cpp +++ b/k8055gui/MyFrame.cpp @@ -215,7 +215,7 @@ void MyFrame::OnBnClickedOutputtest(wxCommandEvent& WXUNUSED(event)) k8055.ClearAllDigital(); k8055.ClearAllAnalog(); k8055.SetAnalogChannel( 1 ); - for( int i=0, j=255; i<256; i++, j--) k8055.SetAllValues(i,i,j); + for( int i=0, j=255; i<256; i++, j--) k8055.WriteAllOutputs(i,i,j); k8055.ClearAllDigital(); k8055.ClearAllAnalog(); OutputTest->SetValue(false); @@ -345,7 +345,7 @@ void MyFrame::OnIdle(wxIdleEvent& event) { //read data int data1, data2, data3, data4, data5; - k8055.ReadAllValues(&data1, &data2, &data3, &data4, &data5); + k8055.ReadAllInputs(&data1, &data2, &data3, &data4, &data5); //print data on interface I1->SetValue(data1 & 0x01); diff --git a/libk8055/k8055++.h b/libk8055/k8055++.h index 61822e3..9646e8b 100644 --- a/libk8055/k8055++.h +++ b/libk8055/k8055++.h @@ -78,8 +78,8 @@ class K8055 { int ReadAllDigital(); int WriteAllDigital( int data ); - int SetAllValues( int digital_data, int ad_data1, int ad_data2 ); - int ReadAllValues ( int* data1, int* data2, int* data3, int* data4, int* data5 ); + int WriteAllOutputs( int digital, int analog1, int analog2 ); + int ReadAllInputs ( int* digital, int* analog1, int* analog2, int* counter1, int* counter2 ); int ResetCounter( int counter ); int ReadCounter( int counter ); diff --git a/libk8055/k8055.h b/libk8055/k8055.h index d889b60..dfb1203 100644 --- a/libk8055/k8055.h +++ b/libk8055/k8055.h @@ -97,8 +97,8 @@ extern "C" { int k8055_read_digital_channel( struct k8055_dev* dev, int channel ); int k8055_read_all_digital( struct k8055_dev* dev ); - 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* digital, int* analog1, int* analog2, int* counter1, int* counter2 ); + int k8055_write_all_outputs( struct k8055_dev* dev, int digital, int analog1, int analog2 ); + int k8055_read_all_inputs( struct k8055_dev* dev, int* digital, int* analog1, int* analog2, int* counter1, int* counter2 ); 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 33bff48..45f5c60 100644 --- a/libk8055/libk8055.c +++ b/libk8055/libk8055.c @@ -451,7 +451,7 @@ int k8055_read_all_digital( struct k8055_dev* dev ) { return return_data; } -int k8055_read_all_values( struct k8055_dev* dev, int* digital, int* analog1, int* analog2, int* counter1, int* counter2 ) { +int k8055_read_all_inputs( struct k8055_dev* dev, int* digital, int* analog1, int* analog2, int* counter1, int* counter2 ) { if ( k8055_read( dev )!=0 ) return K8055_ERROR; if(digital) *digital = ( ( ( dev->data_in[DIGITAL_INP_OFFSET] >> 4 ) & 0x03 ) | /* Input 1 and 2 */ @@ -464,11 +464,11 @@ int k8055_read_all_values( struct k8055_dev* dev, int* digital, int* analog1, in return 0; } -int k8055_set_all_values( struct k8055_dev* dev, int d_data, int a_data1, int a_data2 ) { +int k8055_write_all_outputs( struct k8055_dev* dev, int digital, int analog1, int analog2 ) { dev->data_out[CMD_OFFSET] = CMD_SET_ANALOG_DIGITAL; - 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; + dev->data_out[DIGITAL_OUT_OFFSET] = ( unsigned char )digital; + dev->data_out[ANALOG_1_OFFSET] = ( unsigned char )analog1; + dev->data_out[ANALOG_2_OFFSET] = ( unsigned char )analog2; return k8055_write( dev ); } @@ -598,7 +598,7 @@ long ReadAllDigital() { } int ReadAllValues( long int* data1, long int* data2, long int* data3, long int* data4, long int* data5 ) { int d1, d2, d3, d4, d5; - int r = k8055_read_all_values( curr_dev, &d1, &d2, &d3, &d4, &d5 ); + int r = k8055_read_all_inputs( curr_dev, &d1, &d2, &d3, &d4, &d5 ); if(data1) *data1 = d1; if(data2) *data2 = d2; if(data3) *data3 = d3; @@ -607,7 +607,7 @@ int ReadAllValues( long int* data1, long int* data2, long int* data3, long int* return r; } int SetAllValues( int DigitalData, int AdData1, int AdData2 ) { - return k8055_set_all_values( curr_dev, DigitalData, AdData1, AdData2 ); + return k8055_write_all_outputs( curr_dev, DigitalData, AdData1, AdData2 ); } int ResetCounter( long counter ) { return k8055_reset_counter( curr_dev, counter ); diff --git a/libk8055/libk8055.cpp b/libk8055/libk8055.cpp index f30e23e..563cb43 100644 --- a/libk8055/libk8055.cpp +++ b/libk8055/libk8055.cpp @@ -182,12 +182,12 @@ int K8055::WriteAllDigital( int data ) { return k8055_write_all_digital( &dev, data ); } -int K8055::SetAllValues( int digital_data, int ad_data1, int ad_data2 ) { - return k8055_set_all_values( &dev, digital_data, ad_data1, ad_data2 ); +int K8055::WriteAllOutputs( int digital, int analog1, int analog2 ) { + return k8055_write_all_outputs( &dev, digital, analog1, analog2 ); } -int K8055::ReadAllValues ( int* data1, int* data2, int* data3, int* data4, int* data5 ) { - return k8055_read_all_values( &dev, data1, data2, data3, data4, data5 ); +int K8055::ReadAllInputs ( int* digital, int* analog1, int* analog2, int* counter1, int* counter2 ) { + return k8055_read_all_inputs( &dev, digital, analog1, analog2, counter1, counter2 ); } int K8055::ResetCounter( int counter ) { diff --git a/libk8055/main.c b/libk8055/main.c index c0814de..50e361c 100644 --- a/libk8055/main.c +++ b/libk8055/main.c @@ -173,16 +173,16 @@ int main ( int argc,char* params[] ) { if ( dbt2 != -1 ) k8055_set_counter_debounce_time( dev,2,dbt1 ); if ( ( ia1!=-1 ) && ( ia2!=-1 ) && ( id8!=-1 ) ) { - result = k8055_set_all_values( dev,id8,ia1,ia2 ); + result = k8055_write_all_outputs( dev,id8,ia1,ia2 ); if ( debug ) printf( "SetAllValues=%d - Digital:%d, analog1:%d, analog2:%d\n",result,id8,ia1,ia2 ); } else if ( ( id8 != -1 ) && ( ia1!=-1 ) ) { - result = k8055_set_all_values( dev,id8,ia1,0 ); + result = k8055_write_all_outputs( dev,id8,ia1,0 ); if ( debug ) printf( "SetAllValues=%d - Digital:%d, analog1:%d\n",result,id8,ia1 ); } else if ( ( id8 != -1 ) && ( ia2!=-1 ) ) { - result = k8055_set_all_values( dev,id8,0,ia2 ); + result = k8055_write_all_outputs( dev,id8,0,ia2 ); if ( debug ) printf( "SetAllValues=%d - Digital:%d, analog2:%d\n",result,id8,ia2 ); } else if ( ( ia1 != -1 ) && ( ia2!=-1 ) ) { - result = k8055_set_all_values( dev,0,ia1,ia2 ); + result = k8055_write_all_outputs( dev,0,ia1,ia2 ); if ( debug ) printf( "SetAllValues=%d - analog1:%d, analog2:%d\n",result,ia1,ia2 ); } else { if ( ia1!=-1 ) { @@ -203,7 +203,7 @@ int main ( int argc,char* params[] ) { if ( delay ) { while ( time_msec()-mstart < i*delay ); } - k8055_read_all_values( dev,&d,&a1,&a2,&c1,&c2 ); + k8055_read_all_inputs( dev,&d,&a1,&a2,&c1,&c2 ); lastcall = time_msec(); printf( "%d;%d;%d;%d;%d;%d\n", ( int )( lastcall-start ), d, a1, a2, c1, c2 ); } diff --git a/pyk8055/libk8055.i b/pyk8055/libk8055.i index f788df3..ec16028 100644 --- a/pyk8055/libk8055.i +++ b/pyk8055/libk8055.i @@ -69,8 +69,8 @@ extern int k8055_set_all_digital( struct k8055_dev* dev ); extern int k8055_clear_all_digital( struct k8055_dev* dev ); extern int k8055_read_all_digital( struct k8055_dev* dev ); /*extern int k8055_write_all_digital( struct k8055_dev* dev, int data );*/ -extern int k8055_set_all_values( struct k8055_dev* dev, int d_data, int a_data1, int a_data2 ); -extern int k8055_read_all_values( struct k8055_dev* dev, int* data1, int* data2, int* data3, int* data4, int* data5 ); +extern int k8055_write_all_outputs( struct k8055_dev* dev, int d_data, int a_data1, int a_data2 ); +extern int k8055_read_all_inputs( struct k8055_dev* dev, int* data1, int* data2, int* data3, int* data4, int* data5 ); extern int k8055_reset_counter( struct k8055_dev* dev, int counter ); extern int k8055_read_counter( struct k8055_dev* dev, int counter ); extern int k8055_set_counter_debounce_time( struct k8055_dev* dev, int counter, int debounce_time ); @@ -212,7 +212,7 @@ class k8055: def SetAllValues(self,ddata, adata1, adata2): """Write digital output channel bitmask (0-255) and both analog channels data (0-255,0-255)""" - return _pyk8055.k8055_set_all_values(self.dev,ddata, adata1, adata2) + return _pyk8055.k8055_write_all_outputs(self.dev,ddata, adata1, adata2) def ReadAllValues(self): """Read data from all input channels at once @@ -220,7 +220,7 @@ class k8055: Returns list, [return-value,digital input data, analog channel_data1, analog channel_data2, counter1, counter2] """ - return _pyk8055.k8055_read_all_values(self.dev) + return _pyk8055.k8055_read_all_inputs(self.dev) def ResetCounter(self,CounterNo): """Reset input counter (1/2), input channel 1/2""" @@ -270,8 +270,8 @@ extern int k8055_set_all_digital( struct k8055_dev* dev ); extern int k8055_clear_all_digital( struct k8055_dev* dev ); extern int k8055_read_all_digital( struct k8055_dev* dev ); /*extern int k8055_write_all_digital( struct k8055_dev* dev, int data );*/ -extern int k8055_set_all_values( struct k8055_dev* dev, int d_data, int a_data1, int a_data2 ); -extern int k8055_read_all_values( struct k8055_dev* dev, int* data1, int* data2, int* data3, int* data4, int* data5 ); +extern int k8055_write_all_outputs( struct k8055_dev* dev, int d_data, int a_data1, int a_data2 ); +extern int k8055_read_all_inputs( struct k8055_dev* dev, int* data1, int* data2, int* data3, int* data4, int* data5 ); extern int k8055_reset_counter( struct k8055_dev* dev, int counter ); extern int k8055_read_counter( struct k8055_dev* dev, int counter ); extern int k8055_set_counter_debounce_time( struct k8055_dev* dev, int counter, int debounce_time ); -- cgit v1.1-2-g2b99