void keyboard_handler(void)
{
    unsigned char key_temp, prev_key_from_buff;

    key_temp = get_key_status();
        
    if(multitap_timeout==0)
    lcdcmd(CRSR_BLINK);
    else
    lcdcmd(CRSR_ON);
    
    if(key_temp)
    {

    /*  if(key_temp == '*')
        {    gotocursorXY(crsr_x_global-1, crsr_y_global);
            lcdchar(' ');
            gotocursorXY(crsr_x_global-1, crsr_y_global);
            return;    
        }  */    //trying backspace
        if(keys_cnt == 1)
        {    if(keypress_buff[sizeof(keypress_buff)-2])/**/     //only if buffer is not empty
            prev_key_from_buff = keypress_buff[sizeof(keypress_buff)-2];    //2nd last byte
            else prev_key_from_buff = '~';        //if u r pressing key just after boot, last key would be '~'
        } 
        else 
        prev_key_from_buff = keypress_buff[keys_cnt-2];
        
        if((key_temp == prev_key_from_buff))    //repetition of same key without timeout period. Rotate through accepted keys.
        {    if(multitap_timeout>0)
            {    if(++index == strlen(keys_abc[key_temp-'0']))    //index can be 0..3 for "abc2"
                index = 0;
                if(crsr_x_global==1)    //ranges from 1..20
                gotocursorXY(20, crsr_y_global-1);
                else
                gotocursorXY(crsr_x_global-1, crsr_y_global);
                lcdchar(*(keys_abc[key_temp-'0'] + index));
            }
            else    //multitap_timeout = 0 ... 1 sec has elapsed since last keypress
            {    index = 0;
                lcdchar(*(keys_abc[key_temp-'0'] + index));
            }
        }
        else    //that is a different key from last pressed
        {    index = 0;
            lcdchar(*(keys_abc[key_temp-'0'] + index));    //print base char for that key
        }      
        multitap_timeout = 20;    //timeout must start at EVERY keypress
    
    }    // if(key_temp)
}    // keyboard_handler()
