Ejemplo n.º 1
0
int main(void)
{
	// packets[0] = UPC-A Barcode
	// packets[1] = Item Name
	// packets[2] = Number of Servings
	// packets[3] = Scan Date (MM/DD/YYYY);
	char** packets;
    char return_key;
    char package[] = "<keypad><x>*/";
    
    TRISGbits.TRISG7 = 1; //in breakout pin RF2 (row 1)
    TRISGbits.TRISG2  = 1; //in breakout pin RA2 (row 2)
    TRISCbits.TRISC0 = 1; //in breakout pin RB8 (row 3)
    TRISCbits.TRISC1 = 1;//in breakout pin RB9 (row 4)                 
    TRISEbits.TRISE12 = 0; //in breakout pin RB12 (col 1)
    TRISCbits.TRISC2 = 0; //in breakout pin RB10 (col 2)
    TRISEbits.TRISE14 = 0; //in breakout pin RB14 (col 3)
    
    
    ANSELGbits.ANSG7 = 0; //Row 1-4        //configuring all pins as digital
    ANSELGbits.ANSG2 = 0;
    ANSELCbits.ANSC0 = 0;
    ANSELCbits.ANSC1 = 0;
    ANSELEbits.ANSE12 = 0; //Col 1-3
    ANSELCbits.ANSC2 = 0;
    ANSELEbits.ANSE14 = 0;
    
    InitClock();
    InitUART2();
    
    /* Infinite Loop */
    while ( TRUE )
    {
        if (rx_complete)
        {
            break;
        }
        return_key = 'X'; //initialize return key to default return variable from readKeyboard()

        while(return_key == 'X'){ //while nothing is pressed, keep on making calls
            return_key = readKeyboard();
        }

        if(return_key != 'X'){ //if return_key is not default key, send to RPi
            package[9] = return_key;
            U1MODEbits.UARTEN = 1;  // Re-enable UART if not already done
            printf("%s", package);
        }

        while(readKeyboard() != 'X'){
            //no operation till next key is pressed.
        }
    }
    
    packets = get_barcode();
    read_sd_card(packets);
}
Ejemplo n.º 2
0
int main(void) {
	
	InitClock();	// This is the PLL settings

	InitUART2();	// Initialize UART2 for 9600,8,N,1 TX/RX

	InitPorts();	// LEDs outputs, Switches Inputs

	while(1) {	// The ever versatile Infinite Loop!
		SoftwareDebounce();
	}
}
Ejemplo n.º 3
0
/****************************************************************************
 Function
    InitUART

 Description
    Initialize the Tiva UART modules 1, 2, and 5
****************************************************************************/
void InitUART(void) {
    InitUART1();
    InitUART2();
    InitUART5();
}