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

📄 avsys.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 4 页
字号:
        break;
    }

    //[2] Check if continue parsing the input key
    //    (1) DVD player mode : let main flow handle input key
    //    (2) Non-DVD player mode:
    //        If non-Tuner mode, ie. AV input mode, return invalid key
    //        If tuner mode, let following action contiue the parsing
    if(__bAUXChannel == AUX_CHANNEL_DVD)
        return bKey;
    else
    {
        if(__bAUXChannel != AUX_CHANNEL_TUNER)
            return INVALID_KEY;
    }

    // Following procedure is only for tuner mode's key parsing
#ifndef NO_TUNER

    // [3] Cancel the auto-scan mode while any key input before precessing key action
    if(__bTunerMode & TUNER_MODE_AUTO_SCAN)
    {
        _TUNER_AutoScan(DISABLE_AUTO_SCAN);

        // LLY.278-1, Update panel info. & Program Tuner w/ final freqency
        // While any key input to cancel auto scan mode
        PANEL_Output(MSG_STATION, NULL);

        // LLY2.78b, merge two statement into one -- assignment & programming
        CHIPS_ProgramTuner((BYTE)(SET_BAND|__StationInfo->bBand));
    }

    // [4] Transfer the input key into relative key if necessary
    switch(bKey)
    {
    case    KEY_NEXT:
        bKey=KEY_PRESET_PLUS;
        break;

    case    KEY_PREV:
        bKey=KEY_PRESET_MINUS;
        break;

    case    KEY_SCF:
        bKey=KEY_TUNING_PLUS;
        break;

    case    KEY_SCB:
        bKey=KEY_TUNING_MINUS;
        break;

    case    KEY_PROGRAM:
        bKey=KEY_MEMORY;
        break;

    case    KEY_RANDOM:    
    //Kevin2.79 KEY_INTRO is also defined as KEY_BAND
    case    KEY_INTRO:    
        bKey=KEY_BAND;
        break;
    }

    // [5] Let main flow to handle number relative key
    if(bKey>=INPUT_KEY_GROUP6 && bKey<INPUT_KEY_GROUP7)
        return  bKey;

    // [6] Process the input key action
    switch(bKey)
    {
    // Switch FM/ AM band
    case    KEY_BAND:
        // Clear relative variables
        __bProgramCurrentIndex=0; // reset current memory index

        // Switch band : FM <--> AM
        __StationInfo->bBand = !__StationInfo->bBand;

        // Light last station info.
        PANEL_Output(MSG_STATION, NULL);

        // LLY.278, Program new station info.
        // LLY2.78b, merge two statement into one -- assignment & programming
        CHIPS_ProgramTuner((BYTE)(SET_BAND|__StationInfo->bBand));

        return KEY_NO_KEY;


    case    KEY_MEMORY:
        // LLY2.78b, transfer KEY_MEMORY into KEY_ACTIVE while
        // [1] enable SUPPORT_NUMBER_CONFIRM_KEY, and
        // [2] in input memory mode, and
        // [3] any digit has been input
        // Otherwise, nobody will merge the last input digit into final value
#ifdef  SUPPORT_NUMBER_CONFIRM_KEY
        // When has number input, KEY_PLAY/KEY_PLAY_PAUSE/KEY_ENTER will act as confirm key.
        if( (_wPreValue!=0xffff) && (__bTunerMode&TUNER_MODE_MEMORY))
        {
            return KEY_ACTIVE; // confirm the input key
        }
#endif // #ifdef SUPPORT_NUMBER_CONFIRM_KEY

        // Enter/ Exit Memory mode procedure
        if(__bTunerMode & TUNER_MODE_MEMORY) // within memory input mode
        {
            // clear memory mode
            __bTunerMode &= ~TUNER_MODE_MEMORY;

            // LLY2.78b, Save desired station info. into memory array
            // And, do the correspond action on panel
            // ie. control panel action has been in _TUNER_MemoryAction()
            _TUNER_MemoryAction(MEMORY_SAVE);
        }
        else  // not in memory input mode
        {
            __bTunerMode |= TUNER_MODE_MEMORY;
            PANEL_Output(MSG_MEMORY, INITIAL_MSG); // light "memory" LED
        }
        return KEY_NO_KEY;

    // LLY2.78b, re-adjust the input key procedure
    case    KEY_NUMBER: // Number key input
        // Output the input number on panel
        // Kevin2.81, reference global variable __wNumberPrevious directly
        // Because, we remove the 2nd parameter of AVSYS_ProcessKey()
        //PANEL_Output(MSG_NUMBER, wParam);
        PANEL_Output(MSG_NUMBER, __wNumberPrevious);

        // Do correspond action base on different mode
        if(__bTunerMode & TUNER_MODE_MEMORY) // memory input mode
        {
            // Keep the input number into memory index only
            // Kevin2.81, reference global variable __wNumberPrevious directly
            // Because, we remove the 2nd parameter of AVSYS_ProcessKey()
            //__bProgramCurrentIndex=(BYTE)wParam;
            __bProgramCurrentIndex=(BYTE)__wNumberPrevious;

            // Continue the KEY_MEMORY procedure automatically -- clear memory mode and save the station into memory
            // LLY2.37p, call the corresponding action directly instead of assign the F/W key
            // To avoid IR key and F/W key conflict issue
            //__bISRKey=KEY_MEMORY; 
            
            __bTunerMode &= ~TUNER_MODE_MEMORY;
            _TUNER_MemoryAction(MEMORY_SAVE);
        }
        else // non-memory input mode
        {
        	//Kevin2.81
            //if(wParam>=100)
            if(__wNumberPrevious>=100)
            {
                // jump to desired station position
				//Kevin2.81
                //_TUNER_JumpStation(wParam);
                _TUNER_JumpStation(__wNumberPrevious);
            }
            else  // recall the desired memory index
            {
                // Keep the input number into memory index
                //__bProgramCurrentIndex=(BYTE)wParam;
                __bProgramCurrentIndex=(BYTE)__wNumberPrevious;
                _TUNER_MemoryAction(MEMORY_GET);
            }
        }
        return  KEY_NO_KEY;


    // Get next memory index value
    case    KEY_PRESET_PLUS:
        // Increase memory index by 1
        __bProgramCurrentIndex++;
        if(__StationInfo->bBand==BAND_FM)
        {
            if(__bProgramCurrentIndex>MAX_FM_STATION_NO)
                __bProgramCurrentIndex=1;
        }
        else
        {
            if(__bProgramCurrentIndex>MAX_AM_STATION_NO)
                __bProgramCurrentIndex=1;
        }

        // LLY2.78b, Update desired memory station into current station
        // And, do the correspond action on panel
        // ie. control panel action has been in _TUNER_MemoryAction()
        _TUNER_MemoryAction(MEMORY_GET);

        return KEY_NO_KEY;

    // Get previous memory index value
    case    KEY_PRESET_MINUS:       
        //Kevin2.79
        //if(__bProgramCurrentIndex==1)
        if(__bProgramCurrentIndex==1 || __bProgramCurrentIndex==0)
        {
            if(__StationInfo->bBand==BAND_FM)
                __bProgramCurrentIndex=MAX_FM_STATION_NO;
            else
                __bProgramCurrentIndex=MAX_AM_STATION_NO;
        }
        else
            __bProgramCurrentIndex--;

        // LLY2.78b, Update desired memory station into current station
        // And, do the correspond action on panel
        // ie. control panel action has been in _TUNER_MemoryAction()
        _TUNER_MemoryAction(MEMORY_GET);

        return KEY_NO_KEY;

    // Auto up-scan the receivable station
    case    KEY_TUNING_PLUS:
        if( (_TUNER_TuningFreq(AUTO_SCAN|UP_TUNING)) == STATION_LOCK) // lock at receivable station
        {
            _TUNER_AutoScan(DISABLE_AUTO_SCAN);
        }
        else
        {
            _TUNER_AutoScan(ENABLE_UP_SCAN);
        }
        return KEY_NO_KEY;

    // Auto down-scan the receivable station
    case    KEY_TUNING_MINUS:
        if( (_TUNER_TuningFreq(DOWN_TUNING|AUTO_SCAN)) == STATION_LOCK) // lock at receivable station
        {
            _TUNER_AutoScan(DISABLE_AUTO_SCAN);
        }
        else
        {
            _TUNER_AutoScan(ENABLE_DOWN_SCAN);
        }
        return KEY_NO_KEY;

    // Increase the frequency by one gap
    case    KEY_RIGHT:
        _TUNER_TuningFreq(MANUAL_SCAN|UP_TUNING);
        return KEY_NO_KEY;

    // Decrease the frequency by one gap
    case    KEY_LEFT:
        _TUNER_TuningFreq(MANUAL_SCAN|DOWN_TUNING);
        return KEY_NO_KEY;

    // LLY2.78b, new extra feature -- scan from the min to max frequency
    // and save all receivable station into memory array
    case    KEY_GOTOTIME:
    case    KEY_SEARCH:   
//Kevin2.79 customers can decide whether to search scan from min freq or from current freq.
#ifdef SEARCH_SCAN_FROM_MIN_FREQ
        // [1] Reset to max frequency first, because we want to scan from min frequency
        //     And, _TUNER_TuningFreq() will start from min if current is max frequency
        if(__StationInfo->bBand==BAND_FM)
            __StationInfo->wFreq[BAND_FM]=MAX_FM_FREQ;
        else
            __StationInfo->wFreq[BAND_AM]=MAX_AM_FREQ;
#endif //#ifdef AUTO_SCAN_FROM_MIN_FREQ

        // [2] Enable search mode flag (share __bSearchScan variable)
        __bTunerMode |= TUNER_MODE_SEARCH_SCAN;
        
        // [3] Reset current index index to 0
        __bProgramCurrentIndex=0;

        // [4] Start auto scan action from min to max frequency
        if( (_TUNER_TuningFreq(AUTO_SCAN|UP_TUNING)) == STATION_LOCK) // lock at receivable station
        {                  
            //Increase the index by 1 for saving action
            __bProgramCurrentIndex++;
                        
            // Save 1st receivable station into memory array
            _TUNER_MemoryAction(MEMORY_SAVE);
          
            // Keep the system time for next search scan reference
            __dwPreGetTime=UTL_GetSysTimer();
        }

        // [5] Always continue to do up scan
        _TUNER_AutoScan(ENABLE_UP_SCAN);
        return KEY_NO_KEY;

    // Others are non-support key, only display "invalid" message
    default:
        return INVALID_KEY;
    }


#endif  // #ifndef NO_TUNER
#endif  // #ifdef SUPPORT_AV_SYSTEM

    return  bKey;
}


//  **************************************************************************
//  Function    :   AVSYS_Trigger
//  Description :   Do some polling action for A/V system application
//                  (1) Per-channel adjustment time-out checking
//                  (2) If lock the receivable station
//                      and update the frequency while do auto-scaning
//  Arguments   :   None
//  Return      :   None
//  Side Effect :
//  **************************************************************************
void AVSYS_Trigger(void)
{
#ifdef  SUPPORT_AV_SYSTEM

    // **** Notice: Collect all necessary thing for all modes -- DVD/ TUNER/ AV1/ AV2  ****//

    // Step 1: Time-out checking for per-channel adjustment
    // wyc.277a-AVSys, because AMP mode will auto exit after 10s not press any keys.
    // So, we need to check time here for AMP auto exit.
    // When enter AMP mode to adjust the per-channel volume, need timer to control auto exit AMP mode.
    if (__bAMPActive & AMP_TUNE_PER_CHANNEL)   //in per-channel adjust mode               
    {
        if ((UTL_GetSysTimer() - __dwTimeAMP) > COUNT_10_SEC)
        {
            /*
			__bAMPActive &= ~AMP_TUNE_PER_CHANNEL;
            //Kevin2.79 CHIPS_WriteVolumeToEPPROM is renamed as CHIPS_EPPROMReadWriteVolume            
            //CHIPS_WriteVolumeToEPPROM(WRITE_PER_CHANNEL_NOT_INITIAL);
            CHIPS_EPPROMReadWriteVolume(WRITE_PER_CHANNEL_NOT_INITIAL);            
            // LLY.278, use meaning define for MSG_VOLUME, ex. "CLEAR_MSG"
            OSD_OUTPUT_MACRO(MSG_VOLUME, CLEAR_MSG, NULL);
			*/
            //Kevin2.81 review AVSys
            CHIPS_AMPAction(AMP_MODE_ENTER_EXIT);   //exit AMP mode                		
        }
    }
    if (__bAMPActive & AMP_TUNE_ALL_CHANNEL)    //in all-channel adjust mode
    {
        if ((UTL_GetSysTimer() - __dwTimeAMP) > COUNT_3_SEC)
        {
            __bAMPActive &= ~AMP_TUNE_ALL_CHANNEL;          
            //Kevin2.79 CHIPS_WriteVolumeToEPPROM is renamed as CHIPS_EPPROMReadWriteVolume            
            //CHIPS_WriteVolumeToEPPROM(WRITE_ALL_CHANNEL_NOT_INITIAL);
            CHIPS_EPPROMReadWriteVolume(WRITE_ALL_CHANNEL_NOT_INITIAL);
            // LLY.278, use meaning define for MSG_VOLUME, ex. "CLEAR_MSG"
            OSD_OUTPUT_MACRO(MSG_VOLUME, CLEAR_MSG, NULL);
        }
    }

//Kevin2.81 add timeout for EQ
// DO NOT Timeout for 908 EQ UI 
#ifdef CHIP_W9928
#ifdef SUPPORT_USER_DEFINED_EQ    
    if ( __bSoundEffect&EQ_ADJUST_USER_DEFINED_EQ)//in user-defined EQ adjust mode
    {
        if ((UTL_GetSysTimer() - __dwTimeEQ) > COUNT_10_SEC)
        {
            CHIPS_SoundEffect(EQ_MODE_ENTER_EXIT);   //exit EQ mode  
        }
    } 
#endif  
    if ( __bSoundEffect&EQ_ADJUST_MAIN_EQ)  //in main EQ adjust mode
    {
        if ((UTL_GetSysTimer() - __dwTimeEQ) > COUNT_3_SEC)
        {
            CHIPS_SoundEffect(EQ_MODE_ENTER_EXIT);   //exit EQ mode             
        }
    }
#endif                                            

⌨️ 快捷键说明

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