Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

Revision:
72:895ca792c647
Parent:
48:195c97f12e8e
Child:
74:81c47fff88a5
--- a/parallelcpld.cpp	Mon Nov 17 13:44:53 2014 +0000
+++ b/parallelcpld.cpp	Wed Nov 19 13:36:33 2014 +0000
@@ -1,63 +1,55 @@
-#include "mbed.h"
-#include <stdint.h>
 #include "parallelcpld.h"
-#include "configs.h"
-#include "bits.h"
 
-uint8_t TXBuffer[DATA_SIZE];          // UART3 TX Buffer
-uint8_t tx_clear =1;
+uint8_t TXBuffer[DATA_SIZE];          
+///<UART3 TX Buffer -- Buffer de transmissao para o CPLD
+uint8_t tx_clear = 1;
 
-void parallel_write( uint8_t data)                      // Print a variable using parallel protocol
-{   
-        data0 = BIT0&(data);
-        data1 = BIT1&(data);
-        data2 = BIT2&(data);
-        data3 = BIT3&(data);
-        data4 = BIT4&(data);
-        data5 = BIT5&(data);
-        data6 = BIT6&(data);
-        data7 = BIT7&(data);        
+// Print a variable using parallel protocol
+void parallel_write( uint8_t data ){   
+    data0 = BIT0&(data);
+    data1 = BIT1&(data);
+    data2 = BIT2&(data);
+    data3 = BIT3&(data);
+    data4 = BIT4&(data);
+    data5 = BIT5&(data);
+    data6 = BIT6&(data);
+    data7 = BIT7&(data);        
 }
 
-
-void send2callboxes(){                  // Needs: function parallel_write/ Global variables: TXBuffer, tx_clear / Configuration extern interrupt
-        
-        if ( tx_clear == 1)
-        {   
-            parallel_write( TXBuffer[0] );                  // Send the first position of TXBuffer first
-            DataReady = 1;
-                
-        }else
-        {
-            pc.printf("\r\nError: Overflow Parallel Write TX\r\n");        // Error if the transmission is still in use
-        }
-    
+// Needs: function parallel_write/ Global variables: TXBuffer, tx_clear / Configuration extern interrupt
+void send2callboxes(){
+    // Send the first position of TXBuffer first
+    if( tx_clear == 1 ){
+        //tx_clear = 0;
+        //parallel_write( TXBuffer[ 0 ] );                  
+        //DataReady = 1;
+    }else{
+        // Error if the transmission is still in use
+        if( dparallel ) debug_msg( "Error: Low Overflow Parallel Write TX" );
+        //pc.printf( "\n\rError: Low Overflow Parallel Write TX\n\r" );    
+    }
 }
 
-
 //*****************************************************************************
 //                            EXTERN IRQ Handler
 //*****************************************************************************
 
-void get2(){   
-    
-    static uint16_t c = 1;       
-    DataReady = 0;                              // Get Ready the new data
-//    led3 = !led3;
+void get2(){       
+    static uint16_t c = 1;
+    // Get Ready the new data
+    DataReady = 0;
     tx_clear = 0;
-
-    if ( c < 300 ) 
-    {
-        parallel_write ( TXBuffer[c] ) ;        // Write the next data to be send
-        DataReady = 1;                          // Allow the data to be capture
-        
+    
+    if ( c < 300 ){
+        // Write the next data to be send
+        parallel_write ( TXBuffer[c] ) ;
+        // Allow the data to be capture
+        DataReady = 1;
     }else{
-//            led1 = 0;
-//            led2 = 0;
-//            led3 = 1;
-//            led4 = 1;
-            tx_clear = 1;                       // Allow the next package to the transmitted
-            c = 0;
-        }
+        // Allow the next package to the transmitted
+        tx_clear = 1;
+        c = 0;
+    }
+    
     c++;
 }
\ No newline at end of file