Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
70:714c33487aae
Parent:
69:65665afbad5d
Child:
72:895ca792c647
--- a/vz_protocol.cpp	Wed Nov 12 13:25:54 2014 +0000
+++ b/vz_protocol.cpp	Thu Nov 13 19:16:48 2014 +0000
@@ -2,8 +2,8 @@
 #include "prompt.h"
 #include "debug.h"
     
-extern DigitalOut led2;
-extern DigitalOut led4;
+//extern DigitalOut led2;
+//extern DigitalOut led4;
 
 uint16_t pkg_ckserr = 0;
 uint16_t pkg_cksok = 0;
@@ -140,7 +140,7 @@
         pkg[ 7 ] = seq_num;
         //__print_clock__( pkg + 8 );
         fill = __VZ_HEADER_OFFSET__ + __CLOCK_SYNC_SIZE__ + __SEQ_NUM_SIZE__;
-    }if( type == __CB_BYE__ ){
+    }else if( type == __CB_BYE__ ){
         pkg[ 7 ] = seq_num;
         //__print_clock__( pkg + 8 );
         pkg[ __TIMESLICE_PLACE__ ] = cb_buffer[ __TIMESLICE_PLACE__ ];
@@ -200,8 +200,7 @@
 }
 
 uint16_t __checksum__( uint8_t * buffer, size_t length ){
-        if( !buffer ) return( 0 );
-
+    if( !buffer ) return( 0 );
     uint16_t cc = 0x00;
     buffer[ 4 ] = buffer[ 5 ] = 0x5a;
     for( register int i = 0; i < length; i++ ){
@@ -216,8 +215,10 @@
 }
 
 void __print_clock__( uint8_t * buffer ){
+    if( !buffer ) return;
+    
     //int ntp_result = ntp.setTime( "200.192.232.8", 123, 3 );
-    led2 = !led2;
+    //led2 = !led2;
     struct tm  ts;
     //int ntp_result = ntp.setTime( "200.192.232.8" );
     //int ntp_result = ntp.setTime( "200.192.232.8", 123, 3 );
@@ -227,8 +228,6 @@
         time( &seconds );
         ts = *localtime( &seconds );
    //}
-
-        if( !buffer ) return;
     
     int ano = ts.tm_year + 1900;
     int mes = ts.tm_mon + 1;
@@ -257,5 +256,5 @@
     
     /* convertendo pro ascii do nro */
     for( register int i = 0; i < 14; i++ ) buffer[ i ] += 0x30;
-    led4 = !led4;
+    //led4 = !led4;
 }
\ No newline at end of file