Modularizando o src

Dependencies:   EALib EthernetInterface_vz mbed-rtos mbed

Fork of header_main_colinas_V0-20-09-14 by VZTECH

parallelcpld.cpp

Committer:
klauss
Date:
2014-11-19
Revision:
72:895ca792c647
Parent:
48:195c97f12e8e
Child:
74:81c47fff88a5

File content as of revision 72:895ca792c647:

#include "parallelcpld.h"

uint8_t TXBuffer[DATA_SIZE];          
///<UART3 TX Buffer -- Buffer de transmissao para o CPLD
uint8_t tx_clear = 1;

// 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);        
}

// 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;
    // Get Ready the new data
    DataReady = 0;
    tx_clear = 0;
    
    if ( c < 300 ){
        // Write the next data to be send
        parallel_write ( TXBuffer[c] ) ;
        // Allow the data to be capture
        DataReady = 1;
    }else{
        // Allow the next package to the transmitted
        tx_clear = 1;
        c = 0;
    }
    
    c++;
}