![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: vz_protocol.cpp
- Revision:
- 46:a670f187a704
- Parent:
- 34:f19d9735428e
- Child:
- 48:195c97f12e8e
diff -r c80574f24dc3 -r a670f187a704 vz_protocol.cpp --- a/vz_protocol.cpp Tue Oct 07 12:10:36 2014 +0000 +++ b/vz_protocol.cpp Tue Oct 07 18:38:30 2014 +0000 @@ -2,7 +2,8 @@ #include "prompt.h" extern DigitalOut led2; -extern DigitalOut led3; +extern DigitalOut led4; +NTPClient ntp; uint16_t pkg_ckserr = 0; uint16_t pkg_cksok = 0; @@ -130,8 +131,7 @@ fill = __TIMESLICE_PLACE__ + 1; } - for( register int i = fill; i < __CB_BUFFER_SIZE__; i++ ) pkg[ i ] = 0x00; - led2 = !led2; + for( register int i = fill; i < __CB_BUFFER_SIZE__; i++ ) pkg[ i ] = 0x00; uint16_t cc = __checksum__( pkg, 300 ); pkg[ 4 ] =( uint8_t )( ( cc & 0xFF00 ) >> 8) ; @@ -182,10 +182,11 @@ } void __print_clock__( uint8_t * buffer ){ - NTPClient ntp; //int ntp_result = ntp.setTime( "200.192.232.8", 123, 3 ); + led2 = !led2; struct tm ts; - int ntp_result = ntp.setTime( "200.192.232.8" ); + //int ntp_result = ntp.setTime( "200.192.232.8" ); + int ntp_result = ntp.setTime( "200.192.232.8", 123, 3 ); if( ntp_result == 0 ){ time_t seconds; // seconds = time(NULL); @@ -220,4 +221,5 @@ /* convertendo pro ascii do nro */ for( register int i = 0; i < 14; i++ ) buffer[ i ] += 0x30; + led4 = !led4; } \ No newline at end of file