⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cckey.c

📁 ct952 source code use for Digital Frame Photo
💻 C
📖 第 1 页 / 共 5 页
字号:
        // Micky0.72        bFindZero = FALSE;        for (i=MAX_DIGITS;i>=1;i--)        {        	// find the next non-zero digit        	if (bFindZero)    		{    		        		if (__dwNumberPrevious/ wNumberBase)    			{        			break;    			}        		else    			{	                __wNumberQueue >>=1;    			}    		}        	else            if ( __wNumberQueue & wCheckDigit )  // search the highest digit            {                __dwNumberPrevious -= (__dwNumberPrevious/wNumberBase) *wNumberBase;                __wNumberQueue >>=1;                bFindZero= TRUE;            }	        wCheckDigit >>=1;            wNumberBase/=10;        }    }    else if ( bAction == NUMBER_DIGITS )    {    	// Micky0.72, return number of digits by __wNumberQueue    	// can't use the method for KEY_10+    	/*        wCheckDigit=0x10;   // Max. 5 digits        for (i=MAX_DIGITS;i>=1;i--)    	{    		if (wCheckDigit & __wNumberQueue)    			return i;    		else    			wCheckDigit >>=1;    	}        return i;        */    	// count from highest non-zero digit.        wNumberBase = MAX_DIGITS_NUMBER;        for (i=MAX_DIGITS;i>=1;i--)        {            if (__dwNumberPrevious/ wNumberBase)        	{                break;        	}            else        	{                wNumberBase/=10;        	}        }        return i;    }    else if ( bAction == NUMBER_SET_INPUT )    {        if (bNumberTimeOut)            return TRUE;    // number input state        else            return FALSE;    }    else if ( bAction == NUMBER_SET_TIMEOUT)    {        bNumberTimeOut=TRUE;        _dwTimeNumber = OS_GetSysTimer();    }    else if ( bAction == NUMBER_CLEAR_TIMEOUT)    {        bNumberTimeOut=FALSE;    }    // Micky0.72, update number queue    else if (bAction == NUMBER_QUEUE)	{      	wNumberBase = MAX_DIGITS_NUMBER;        for (i=MAX_DIGITS;i>=1;i--)        {            if (__dwNumberPrevious/ wNumberBase)        	{                break;        	}            wNumberBase/=10;        }        __wNumberQueue = 1;        if (i)    	{    		for (; i>=1; i--)    		{    			__wNumberQueue *=2;	    	}    	}    	__wNumberQueue-=1;       	return TRUE;			}    return  TRUE;}//  *********************************************************************//  Function    :   _CC_NumberProcessKey//  Description :   This function will do number calculation for input number//  Arguments   :   bKey,   input number key//  Return      :   KEY_NUMBER, plus __dwTimeKey, __dwNumberPrevious//  Side Effect ://  *********************************************************************// Micky0.80, remove parameterBYTE    _CC_NumberProcessKey(void){    WORD wValue;    BYTE bNumberMode;    BYTE    bNumberMaxDigits;#define NUMBER_NORMAL   1#define NUMBER_SHIFT_LEFT    2//    BYTE    bKey= __bKey;    if  ( ( __bKey >= KEY_N0 ) && (__bKey <= KEY_N20 ) )    {       wValue = __bKey - KEY_N0;    }    else if (__bKey == KEY_N10PLUS)    {        wValue = 0x800A;    }    else if (__bKey == KEY_N20PLUS)    {        wValue = 0x8014;    }    else    {        // must clear number related if any ISR key pressed        if ( __bKeySource == KEY_FROM_ISR )        {            if ( CC_NumberUtility(NUMBER_SET_INPUT) )            {                if ( ( __bKey == KEY_PLAY) || (__bKey == KEY_PLAY_PAUSE) || (__bKey == KEY_ENTER) || (__bKey == KEY_ACTIVE) )                {                    CC_NumberUtility(NUMBER_CLEAR_TIMEOUT);                    // Micky0.80, since the key is not active as original value, clear the message                    __bKeyMessage = MSG_NULL;                    // Micky0.80, return new status                    __bKey = KEY_NUMBER;                    return KEY_BYPASS;                    //return KEY_NUMBER;                 }                CC_NumberUtility(NUMBER_CLEAR);                // Micky0.72, give up current number, clear the number OSD		        OSD_OUTPUT_MACRO(MSG_NUMBER, 0, 0);            }        }        // Micky0.80, return new status        return KEY_BYPASS;                //return bKey;    }#ifdef  SUPPORT_NUMBER_CONFIRM_KEY    bNumberMode= NUMBER_SHIFT_LEFT;#else    bNumberMode= NUMBER_NORMAL;#endif    bNumberMaxDigits = 2;    // means media manager, reference other define for number input mode    // InfoFilter will update __bNavigateMode    if ( __bNavigateMode == MEDIA_NAVIGATE_MODE )    {#ifdef    SUPPORT_CDROM_NUMBER_CONFIRM_KEY        bNumberMode= NUMBER_SHIFT_LEFT;#endif        bNumberMaxDigits = 4;    }// For general display mode(VCD/CD-DA/DVD)    if (bNumberMode == NUMBER_NORMAL)    {        if ( __dwTimeKey )                          // previous key is KEY_N10PLUS        {            __dwNumberPrevious +=wValue & 0x7FFF;    // accumulate the number value        }        else        {            __dwNumberPrevious = wValue & 0x7FFF;        }        if (wValue & 0x8000)        {            CC_NumberUtility(NUMBER_SET_TIMEOUT);        }        else        {            CC_NumberUtility(NUMBER_CLEAR_TIMEOUT);        }    }    else    {        // __wNumberQueue, bit 0=1, 1st digit is on, bit 1, 2nd digit is on, bit 2, 3rd digit is on        if ( __dwTimeKey )                          // previous key is KEY_N10PLUS        {            // record current number of digits            __bTemp = CC_NumberUtility(NUMBER_DIGITS); // original digits            __dwNumberPrevious += wValue & 0x7FFF;            // Micky0.72, re-calculate __wNumberQueue            CC_NumberUtility(NUMBER_QUEUE);            /*            if (wValue & 0x8000)            {            	// Micky0.72, remove the end of ';', bug.                if ( __bTemp != CC_NumberUtility(NUMBER_DIGITS) )                {                    // continue KEY_N10PLUS, don't increase the number digits except carry(90->100)                    __wNumberQueue <<=1;                    __wNumberQueue |=1;                }            }            */        }        else        {            if (wValue & 0x8000)                    // KEY_N10/N20_PLUS.. was pressed            {                // First time press KEY_N10PLUS, always set number digit as 2                __wNumberQueue = 0x03;                // reset previous number                __dwNumberPrevious =0;            }            else            {                // increase digit number for general number                // wyc2.38-909s, don't increase the checking digit when pressing 0 first. Otherwise will happen user can input to 4-digit                 // in CDDA problem.                if ((wValue != 0) || (__dwNumberPrevious != 0))                {                    __wNumberQueue <<=1;                    __wNumberQueue |=1;                    __dwNumberPrevious *= 10;    // shift the last value one digit left                }            }            __dwNumberPrevious += wValue & 0x7FFF;           }        // set time out        CC_NumberUtility(NUMBER_SET_TIMEOUT);    }    if ( CC_NumberUtility(NUMBER_DIGITS) > bNumberMaxDigits )    {    	// Micky0.72, fix number out of max. digits, NUMBER_SHIFT will do it.        //__wNumberQueue = bNumberMaxDigits+1;       CC_NumberUtility(NUMBER_SHIFT);   }    if (wValue & 0x8000)                    // KEY_N10/N20_PLUS.. was pressed    {        __dwTimeKey = OS_GetSysTimer();    }    else    {        __dwTimeKey = NULL_0;    }    if (__dwTimeKey)    {        OSD_OUTPUT_MACRO ( MSG_KEY10, (WORD)__dwNumberPrevious, COUNT_NUMBER_GAP/COUNT_1_SEC );    }    else    {        __bKeyMessage = MSG_NUMBER;        OSD_OUTPUT_MACRO(MSG_NUMBER, (WORD)__dwNumberPrevious, COUNT_NUMBER_GAP/COUNT_1_SEC);    }    // must check if allow number input, if not allow, reset the number    // if allowed, & not time out, return KEY_NO_KEY.    // Micky0.80, return new status    __bKey = KEY_NUMBER;    return KEY_BYPASS;    //return KEY_NUMBER;}// Micky0.62-909, process number key, then convert as KEY_NUMBER//  **************************************************************************//  Function    :   _CC_Trigger_TimeOut_Nummber//  Description :   Do the action when number input time out//  Arguments   :   None//  Return      :   None//  Side Effect :   //  **************************************************************************void _CC_Trigger_NumberTimeOut(void) {    if (bNumberTimeOut)    {        if ( ( OS_GetSysTimer()- _dwTimeNumber ) > COUNT_NUMBER_GAP )        {#ifdef  ACCEPT_TIMEOUT_NUMBERKEY            OSD_OUTPUT_MACRO(MSG_NUMBER, (WORD)__dwNumberPrevious, 1);            bNumberTimeOut = FALSE;            // Micky0.62-909            // ie. don't simulate it by assign F/W key again            // To avoid IR key and F/W key conflict issue            __bFWKey = KEY_NUMBER;  // means to active the number value            CC_MainProcessKey();#else            CC_NumberUtility(NUMBER_CLEAR);            // Micky0.72, give up current number, clear the number OSD   	        OSD_OUTPUT_MACRO(MSG_NUMBER, 0, 0);#endif        }    }}// Micky0.80, remove it./*// Micky0.62-909, add VCD/DVD Process Key//  **************************************************************************//  Function    :   _CC_DVD_PreProcessKey()//  Description :   //  Arguments   :   __bKey//  Return      :   TRUE, the key value is decided.//  Side Effect :   //  **************************************************************************BYTE    _CC_DVD_PreProcessKey(void){    if ( !( __wDiscType & BOOK_DVD ) )        return FALSE;//-------------------------------------------------------------------// :: Release DVD still// DVD_161Micky, add general keys for releasing CELL still/ VOBU still// don't enter pause state for these modes// make sure the keys defined within _bReleaseStillKeys// won't return earlier than the checking for release still.        if ( _CC_ReleaseStillTrigger() == KEY_ACCEPT)        {            __bKey = KEY_NO_KEY;            return TRUE;        }// DVD has buttons. (SUPPORT_KEY_PLAY_AS_KEY_ACTIVE)// when KEY_PLAY is shared use with active// the rule is to active button first#ifdef  SUPPORT_KEY_PLAY_AS_KEY_ACTIVE    if ( (__bKey == KEY_PLAY_PAUSE) || (__bKey == KEY_PLAY) )    {        if ( NV_Action(ACTION_ACTIVE_CHECK, NULL_0) )        {            // Fix Title menu(motion w/ buttons)-> pause-> KEY_PLAY will hang.                        // HolySound(travel around the world-8, -3)                // let non-NPF-> play has top priority            // i.e. Button active only when normal playing            if ( __bModeCmd != KEY_PLAY || __btPause )            {                __bKey = KEY_PLAY;            }            else    // act as confirm key            {                __bKey = KEY_ACTIVE;            }            return TRUE;    // KEY is decided.        }        return FALSE;    }#endif  //#ifdef  SUPPORT_KEY_PLAY_AS_KEY_ACTIVE// :: Shared Keys(DVD only)//      - KEY_DIGEST---> KEY_TITLE//      - KEY_AUDIO_LR--->KEY_AST_CTL//      - KEY_ENTER--->KEY_ACTIVE//      - KEY_GOTO_TIME--->KEY_SEARCH#ifdef NO_DVDDIGEST        if ( __bKey == KEY_DIGEST )        {            __bKey = KEY_TITLE;            return TRUE;        }#endif  //#ifdef NO_DVDDIGEST    #ifdef  KEY_AUDIO_LR_SAME_KEY_AST_CTL        if ( __bKey == KEY_AUDIO_LR )        {            __bKey = KEY_AST_CTL;            return TRUE;        }#endif  //#ifdef  KEY_AUDIO_LR_SAME_KEY_AST_CTL    return FALSE;}BYTE    _CC_VCD_PreProcessKey(void){        if ( !( __wDiscType & BOOK_VCD ) )        {            return FALSE;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -