From 036bcb8da90fa19b4a6270da4b4b0df5806f2a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 5 Jun 2011 07:52:26 +0200 Subject: set_debug_(on|off) => set_debug/get_debug --- libk8055/k8055.h | 4 ++-- libk8055/libk8055.c | 9 +++++---- libk8055/main.c | 2 +- pyk8055/libk8055.i | 12 ++++++------ 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/libk8055/k8055.h b/libk8055/k8055.h index 83602a3..d1f8359 100644 --- a/libk8055/k8055.h +++ b/libk8055/k8055.h @@ -59,8 +59,8 @@ extern "C" { int k8055_counter_2( struct k8055_dev* dev ); char* k8055_version( void ); - void k8055_set_debug_on( void ); - void k8055_set_debug_off( void ); + int k8055_set_debug( int status ); + int k8055_get_debug( void ); int k8055_search_devices( void ); int k8055_open_device( struct k8055_dev* dev, int board_address ); diff --git a/libk8055/libk8055.c b/libk8055/libk8055.c index a73312d..917cff0 100644 --- a/libk8055/libk8055.c +++ b/libk8055/libk8055.c @@ -197,12 +197,13 @@ static int k8055_takeover_device( libusb_device_handle* handle, int interface ) return 0; } -void k8055_set_debug_on( void ) { - debug = 1; +int k8055_set_debug( int status ) { + debug = ((status>0) ? 1 : 0 ); + return debug; } -void k8055_set_debug_off( void ) { - debug = 0; +int k8055_get_debug( void ) { + return debug; } char* k8055_version( void ) { diff --git a/libk8055/main.c b/libk8055/main.c index 0fc7f68..f2751d0 100644 --- a/libk8055/main.c +++ b/libk8055/main.c @@ -111,7 +111,7 @@ int read_param( int argc, char* params[] ) { !str2int( params[i]+6,&dbt2 ) ) erreurParam = true; else if ( !strcmp( params[i],"-debug" ) ) { debug = 1; - k8055_set_debug_on(); + k8055_set_debug(1); } else if ( !strcmp( params[i],"-reset1" ) ) resetcnt1 = true; else if ( !strcmp( params[i],"-reset2" ) ) resetcnt2 = true; else if ( !strcmp( params[i],"--help" ) ) { diff --git a/pyk8055/libk8055.i b/pyk8055/libk8055.i index b6ecd70..7e35c9b 100644 --- a/pyk8055/libk8055.i +++ b/pyk8055/libk8055.i @@ -49,8 +49,8 @@ extern int k8055_counter_1( struct k8055_dev* dev ); extern int k8055_counter_2( struct k8055_dev* dev ); */ /*extern char* k8055_version( void );*/ -extern void k8055_set_debug_on( void ); -extern void k8055_set_debug_off( void ); +extern void k8055_set_debug( int status ); +extern void k8055_get_debug( void ); extern int k8055_search_devices( void ); extern int k8055_open_device( struct k8055_dev* dev, int board_address ); extern int k8055_close_device( struct k8055_dev* dev ); @@ -109,10 +109,10 @@ class k8055: # return _pyk8055.k8055_version(); def DebugOn(self): - return _pyk8055.k8055_set_debug_on(); + return _pyk8055.k8055_set_debug(1); def DebugOff(self): - return _pyk8055.k8055_set_debug_off(); + return _pyk8055.k8055_set_debug(0); def SearchDevices(self): return _pyk8055.k8055_search_devices() @@ -250,8 +250,8 @@ extern int k8055_counter_1( struct k8055_dev* dev ); extern int k8055_counter_2( struct k8055_dev* dev ); */ /*extern char* k8055_version( void );*/ -extern void k8055_set_debug_on( void ); -extern void k8055_set_debug_off( void ); +extern void k8055_set_debug( int status ); +extern void k8055_get_debug( void ); extern int k8055_search_devices( void ); extern int k8055_open_device( struct k8055_dev* dev, int board_address ); extern int k8055_close_device( struct k8055_dev* dev ); -- cgit v1.1-2-g2b99