Final Project/FinalProject.X/FinalProjectMain.c
// <editor-fold defaultstate="collapsed" desc="pollMatrix()">
/******************************************************************************
 * pollMatrix function
 *
 * Polls the keyboard matrix and stores the appropriate keycodes in a buffer to 
 * send.  Assumes only one button pressed at a time.
 ******************************************************************************/

pollMatrix function

Polls the keyboard matrix and stores the appropriate keycodes in a buffer to
send.  Assumes only one button pressed at a time.
pollMatrix function Polls the keyboard matrix and stores the appropriate keycodes in a buffer to send . Assumes only one button pressed at a time .
void pollMatrix() {
    if((PORTD & 0b11110000) == 0)
        return;
    debounceRoutine();
    buttonPress = PORTD & 0b11110000;
    switch(buttonPress)
    {
        case 0b10000000:
            byteToSend = 0xA8;
            break;
        case 0b01000000:
            byteToSend = 0xAC;
            break;
        case 0b00100000:
            byteToSend = 0xAE;
            break;
        case 0b00010000:
            byteToSend = 0xAB;
            break;
    }
    if(buttonPress > 0)
    {
        readyToSend = 1;
        keypress = 1;
    }
}
void pollMatrix ( ) { if ( ( PORTD & 0b11110000 ) == 0 ) return ; debounceRoutine ( ) ; buttonPress = PORTD & 0b11110000 ; switch ( buttonPress ) { case 0b10000000 : byteToSend = 0xA8 ; break ; case 0b01000000 : byteToSend = 0xAC ; break ; case 0b00100000 : byteToSend = 0xAE ; break ; case 0b00010000 : byteToSend = 0xAB ; break ; } if ( buttonPress > 0 ) { readyToSend = 1 ; keypress = 1 ; } }
<editor-fold defaultstate="collapsed" desc="pollMatrix()">
 pollMatrix function
<editor - fold defaultstate = " collapsed " desc = " pollMatrix () " > pollMatrix function