Ejemplo n.º 1
0
int main() 
{
    enableInterrupts();
    initTMR2();
    char key = 'x';
    
    while(1);
    {
       clearLCD();
       InitKeyPad();
       
       switch(state)
       {
           case findKey:
               ScanKeys(); //should i update the key value here?
               break;
           case debouncePress:
               delayUs(5000); //Proper Delay?
               break;
           case debounceRelease:
               delayUs(5000);
               break;
           case display:
               printCharLCD(key);
               break;
       }
    }
    
}
Ejemplo n.º 2
0
void DoKeyTune(void)
{
    if(OS.runmode<16)
    {
        KP.Key[KP_C]=0;
        VFLD_print("KEY 00    \n");
        VFLD.Symbol[VFLD_RO]=0;
        if(OS.runmode<10)
        {
            VFLD.String[5]=OS.runmode;
        }
        else
        {
            VFLD.String[5]=OS.runmode+55;
        }
        VFLD.Symbol[VFLD_CN2]=1;

        if( KP.Scanline[ KP.Matrix[OS.runmode].line ] > 20 )
        {
            VFLD_Value( KP.Scanline[ KP.Matrix[OS.runmode].line ] );

            if( ( KP.Scanline[ KP.Matrix[OS.runmode].line ] > KP.Matrix[OS.runmode].limit1 ) & ( KP.Scanline[ KP.Matrix[OS.runmode].line ] > KP.Matrix[OS.runmode].limit0 ) )
            {
                KP.Matrix[OS.runmode].limit1++;
                VFLD.Symbol[VFLD_RO]=1;
            }
            if( ( KP.Scanline[ KP.Matrix[OS.runmode].line ] < KP.Matrix[OS.runmode].limit0 ) & ( KP.Scanline[ KP.Matrix[OS.runmode].line ] < KP.Matrix[OS.runmode].limit1 ))
            {
                KP.Matrix[OS.runmode].limit0--;
                VFLD.Symbol[VFLD_RO]=1;
            }
            VFLD_Refresh();
        }
        ScanKeys();
        if(KP.Key[KP_C]>0)
        {
            KP.Key[KP_C]=0;
            OS.runmode++;
            OS_delay_ns(50000000);
        }
        KP.Key[0]=0;

    }
    else
    {
        OS_SetRunlevel(RL_Setup);
    }
}