Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
104:62646ef786a3
Parent:
100:09a23fcd3bdf
Child:
105:a930035b6556
--- a/parallelcpld.cpp	Thu Feb 19 18:04:33 2015 +0000
+++ b/parallelcpld.cpp	Wed Feb 25 18:44:11 2015 +0000
@@ -42,66 +42,38 @@
         delay_to_send_to_cbx.start();
         once = false;
     }
-    /*
-    if( delay_to_send_to_cbx.read_ms() < 7 ){
-    {
-        delayed_pkg_to_cb++;
+    
+    delay_to_send_to_cbx.reset();
+    
+    if( tx_clear == 1 ){
+        tx_clear = 0;
+        xmemcpy( TXBuffer, buffer, __CB_BUFFER_SIZE__ );
+        // Send the first position of TXBuffer first
+        parallel_write( TXBuffer[ 0 ] );
+        DataReady = 1;
+        xmemcpy( cb_tx_buffer, buffer, __CB_BUFFER_SIZE__ );
+        cpld_pkg_tx_counter++;
+        
+        uint16_t ext = ( ( uint16_t )buffer[ 0 ] ) << 8  | buffer[ 1 ];
+        uint16_t port = ( ( uint16_t )buffer[ 2 ] ) << 8  | buffer[ 3 ];
+        uint8_t type = buffer[ 6 ];
+        
+        if( debug_fw ){
+            buffer[ 0 ] |= BIT7;
+            fw_cbx_pkg( ext, port, ( char *)buffer );
+        }
+        
+        if( debug_cb_tx == true ){            
+            if( type != __AUDIO__ ) send_msg("Pkg to CBx :: ( %d, %d ) -- Type :: %d", ext, port, type );            
+        } 
+    }else{
+        // Error if the transmission is still in use
         uint8_t ret = ring_buffer_add( rb, buffer );
         
         if( ret == 0x01 ) if( dparallel ) debug_msg("Error: Ring buffer fully charged");
         
         if( ret == 0x00 ) if( dparallel ) debug_msg("Success : package queued -- on queue %u", rb->size );
-    } else {
-    */
-        delay_to_send_to_cbx.reset();
-        
-        if( tx_clear == 1 ){
-            tx_clear = 0;
-            xmemcpy( TXBuffer, buffer, __CB_BUFFER_SIZE__ );
-            /*
-            if( big_bug_pkg ){
-                send_msg("--> %d", __CB_BUFFER_SIZE__ + 4 );
-                big_bug_pkg = false;
-                uint8_t big_buffer[ __CB_BUFFER_SIZE__ + 4 ]; 
-                xmemcpy( big_buffer, buffer, __CB_BUFFER_SIZE__ );
-                big_buffer[ __CB_BUFFER_SIZE__ + 3 ] = 0x11;
-                big_buffer[ __CB_BUFFER_SIZE__ + 2 ] = 0x13;
-                big_buffer[ __CB_BUFFER_SIZE__ + 1 ] = 0x17;
-                big_buffer[ __CB_BUFFER_SIZE__  ] = 0x17;
-                
-                parallel_write( big_buffer[ 0 ] );
-                
-            }else{
-                
-            }
-            */
-            // Send the first position of TXBuffer first
-            parallel_write( TXBuffer[ 0 ] );
-            DataReady = 1;
-            xmemcpy( cb_tx_buffer, buffer, __CB_BUFFER_SIZE__ );
-            cpld_pkg_tx_counter++;
-            
-            uint16_t ext = ( ( uint16_t )buffer[ 0 ] ) << 8  | buffer[ 1 ];
-            uint16_t port = ( ( uint16_t )buffer[ 2 ] ) << 8  | buffer[ 3 ];
-            uint8_t type = buffer[ 6 ];
-            
-            if( debug_fw ){
-                buffer[ 0 ] |= BIT7;
-                fw_cbx_pkg( ext, port, ( char *)buffer );
-            }
-            
-            if( debug_cb_tx == true ){            
-                if( type != __AUDIO__ ) send_msg("Pkg to CBx :: ( %d, %d ) -- Type :: %d", ext, port, type );            
-            } 
-        }else{
-            // Error if the transmission is still in use
-            uint8_t ret = ring_buffer_add( rb, buffer );
-            
-            if( ret == 0x01 ) if( dparallel ) debug_msg("Error: Ring buffer fully charged");
-            
-            if( ret == 0x00 ) if( dparallel ) debug_msg("Success : package queued -- on queue %u", rb->size );
-        }
-    //}
+    }
 }
 
 //*****************************************************************************