Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: debug.h
- Revision:
- 48:195c97f12e8e
- Parent:
- 45:c80574f24dc3
- Child:
- 69:65665afbad5d
diff -r 3983efe3aeba -r 195c97f12e8e debug.h --- a/debug.h Tue Oct 07 18:43:44 2014 +0000 +++ b/debug.h Mon Oct 20 16:13:10 2014 +0000 @@ -10,6 +10,7 @@ extern char debug_msg1[ 1024+64 ]; extern char debug_msg2[ 1024 ]; +extern char msg_[ 1024 ]; void debug_pkg( int size, uint8_t * pkg ); @@ -19,11 +20,24 @@ sprintf(debug_msg2, __VA_ARGS__); \ strcat(debug_msg1, debug_msg2); \ pc.printf( "%s\n\r", debug_msg1 ); \ - if( from_eth ){ \ - if( tcp_session ){ \ - strcat( debug_msg1, "\n\r" ); \ - tcp_client.send_all( debug_msg1, strlen( debug_msg1 ) ); \ - } \ + if( tcp_session ){ \ + strcat( debug_msg1, "\n\r" ); \ + tcp_client.send_all( debug_msg1, strlen( debug_msg1 ) ); \ + }else if( udp_request ){ \ + udp_server.sendTo( udp_client, debug_msg1, strlen( debug_msg1 ) ); \ } \ } + +#define send_msg(...) _send_msg(__VA_ARGS__) +#define _send_msg(...) { \ + sprintf( msg_, __VA_ARGS__); \ + pc.printf( "%s\n\r> ", msg_ ); \ + if( tcp_session ){ \ + strcat( msg_, "\n\r> " ); \ + tcp_client.send_all( msg_, strlen( msg_ ) ); \ + }else if( udp_request ){ \ + udp_server.sendTo( udp_client, debug_msg1, strlen( debug_msg1 ) ); \ + } \ +} + #endif \ No newline at end of file