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

📄 e20_sub.c

📁 HSAV DR53E CF卡MP3录放板应用编程源代码
💻 C
📖 第 1 页 / 共 5 页
字号:


#include "E20_main.h"           

CONST_CHAR TabPKeyScan[] = {
    0xef,0xdf,0xbf,0x7f,0xf7,0xfb,
};


void MPKeyScan(){
    BYTE gLocal_1;
    BYTE gLocal_2;

    M4094DataWrite(TabPKeyScan[gPKeyScan]);
    p4094_LowSTB = 1;
    p4094_LowSTB = 0;
    gLocal_2 = (IOP1 << 5) | gPKeyScan;


    if (((gLocal_2 & 0xe0) != 0xe0) || (gLocal_2 == 0x23)){
        GPKeyData = gLocal_2;   
        FPKeyDetect = 1;
    } 
    if (FPKeyDetect){   
        if (!FPKeyStep){
            if (++gPKeyConfirmTm > 5){
                gPKeyConfirmTm = 0;
                if (GPKeyData == gLocal_2){
                     FPKeyDecodeOk = 1;
                }
                else FPKeyDetect = 0;  
            }
        }    
        else{ 
            if (GPKeyData != gLocal_2){
               if (++gPKeyConfirmTm > 5){
                   gPKeyConfirmTm = 0;  
                   FPKeyStep = 0;
                   FPKeyDetect = 0;     
                }
            }
            else gPKeyConfirmTm = 0;   
        }
    }
    else{    
        if (++gPKeyScan > 5) gPKeyScan = 0;
    }     
    return;
}
void MSUB10msTimer(){
    WORD g2Local_2;
    if (FInitiaizeOK){
        if (gKeyJopLockTm_A != 0) --gKeyJopLockTm_A;
        if (FKeyJogSwOK_A){
            FKeyJogSwOK_A = 0;   
            FRmDecodOK = 1;
            FPKeyDecodeOk = 0;
            GRmCodeData = cRmKey_CursorMove;
        }
    }
    if (FPKeyDecodeOk){
        FPKeyDecodeOk = 0;
        FRmDecodOK = 1;
        FPKeyStep = 1;
        FDirectUp = 0;
        gBuzzerTm = 8;  

        switch (GPKeyData){
            case cPKey_Program_Setup : GRmCodeData = cRmKey_Program_Setup; break;
            case cPKey_Timer_Setup : GRmCodeData = cRmKey_Timer_Setup; break;
            case cPKey_EEPAddrClear : GRmCodeData = cRmKey_Delete; break;
            case cPKey_Mute : GRmCodeData = cRmKey_Mute; break;
            case cPKey_Record_Setup : GRmCodeData = cRmKey_Record_Setup; break;
            case cPKey_PlayMusic : GRmCodeData = cRmKey_PlayMusic; break;
            case cPKey_Exit : GRmCodeData = cRmKey_Exit;  break;
            case cPKey_PWR_Out : GRmCodeData = cRmKey_PWR_Out; break;
            case cPKey_VOLUp : GRmCodeData = cRmKey_SkipUp; break;
            case cPKey_VOLDown : GRmCodeData = cRmKey_SkipDown; break;
            case cPKey_Enter : GRmCodeData = cRmKey_Enter; break;
            default : FRmDecodOK = 0;gBuzzerTm = 0; break;     

        }
    }

    if ((gKeyCancelTm != 0)	&& (++gKeyCancelTm > 40)){
		gKeyCancelTm = 30;
	}

    if (FRmDecodOK){
    	FRmDecodOK = 0;
        FDirectUp = 0;   
        gBuzzerTm = 8;  
		FCursor_Move = 0;
        if (gStartTime){
            gStartTime = 0;
            FNoMission_Staus = 0;
            mLED_Sture();
            MLED_Release();
            gMain00 = MEEP_ByteRead(cEEPAddr_OutComctrl);
            if (gMain00 != 0xff){
                gCurrOutComctrl = gMain00;
            }
            else gCurrOutComctrl = 0;
            gControlManualStatus = cControlManualStatus;
            gInputType = MEEP_ByteRead(cEEPAddr_WorkRest)&0x07;
            mInputSwitch();
            gReturnMenuBuffer = (MEEP_ByteRead(cEEPAddr_WorkRest)>>3)&0x1f;
            MenuBuffer();
            MReturnMenu();
            MPowerComctrl(gCurrOutComctrl);
            MLine1Conctrl();
            gMain00 = 1;
            gMain00 = MEEP_ByteRead(cEEPAddr_PlayTrack); //开机播放记忆曲目
            if ((gMain00 != 0xff)&&(gMain00 != gTrackNumber)) MSpecify_Play(gMain00);
        }
        if (FErase_UpData) return;

		if (GRmCodeData != GRmCodeData_Save){
			gKeyCancelTm = 0;
		}
		GRmCodeData_Save = GRmCodeData;
		if ((gKeyCancelTm > 1) && (gKeyCancelTm < 20)){
            gRmKeyContinCanclTm = 1;
			if (GRmCodeData != cRmKey_CursorMove) return;
		}
                                    
        switch (GRmCodeData){
            case cRmKey_VOLUp : FDirectUp = 1;
            case cRmKey_VOLDown : 
                if (gMenuSelect == cMenu_Exit){
                    FPress_Enter_Modify = 0;
                    MReturnMenu();
                }
                FKeyJogUp_A = 0;
                if (FDirectUp) FKeyJogUp_A = 1;
                mAUDVolCtrl();
                if (gMenuSelect == cMenu_Main02_Select_MP3){
                    MDIP_Menu_Volume(128-8*3-17*2,1); //光标1
                }
                else if (gMenuSelect == cMenu_Main02_Select_Tuner) {
                    MDIP_Menu_Volume(128-8*3-17*2,1); //光标1
                }
                else if ((gMenuSelect == cMenu_Main02_Select_LINE)||(gMenuSelect == cMenu_Main02_Select_MIC)){
                    MDIP_Menu_Volume(0+8*4,1); //光标1
                }
                gRmKeyContinCanclTm = 1;
                break;            
            case cRmKey_SkipUp : FDirectUp = 1;
            case cRmKey_SkipDown : 
                gAutoExitTime = 10;
                if ((gReturnMenuBuffer == cMenu_Main02_Select_MP3)||(FTaskNowing && (gNextType == cInput_MP3)&&(gMenuSelect == cMenu_Main02_Start_up_TimerList))){
                    gCTBCommandBuffer[0] = cCTB_CommandA02; 
                    if (FDirectUp){
                        gCTBCommandBuffer[1] = cCTB_SKIP_UP;/*按下一曲应发送指令 02H/41H */
                        FDIPSimble_VolUp(1);            
                    }
                    else {
                        gCTBCommandBuffer[1] = cCTB_SKIP_DOWN;   /*按上一曲应发送指令 02H/42H */
                        FDIPSimble_VolDn(1);
                    }
                    MCTBCommandWrite();

                    if (FControlManual) break;
                    if (gMenuSelect == cMenu_Exit){

                        MDIP_ClearTreakName();
                        MDIPClearALL();//清屏  
                        MEnter_Menu_PlayMusic(4);
                    }
                }
                else if ((gReturnMenuBuffer == cMenu_Main02_Select_Tuner)||(gMenuSelect == cMenu_Main02_Select_Tuner)
                ||(FTaskNowing && (gNextType == cInput_Tuner)&&(gMenuSelect == cMenu_Main02_Start_up_TimerList))){
                    if (FDirectUp){
                        if (++g2TUNAddrRead > 255){
                            g2TUNAddrRead = cEEPAddr_TUNStart+1;
                        }
                        FDIPSimble_VolUp(1);            
                    }
                    else {
                        --g2TUNAddrRead;
                        if (g2TUNAddrRead == cEEPAddr_TUNStart){
                            g2TUNAddrRead = 0xff;
                        }                         
                        FDIPSimble_VolDn(1);
                    }
                    MTUN_FreqConctrl();
                    MEEP_ByteWrite(cEEPAddr_TunChannelLow, g2TUNAddrRead);
                    MEEP_ByteWrite(cEEPAddr_TunChannelHigh, g2TUNAddrRead >> 8);
                    FHandToAutoTuner = 1;
                    MDIP_TUNShow(gCursorMove-2);
                    MDIP_TUNNumber(gCursorMove-1);
                    if ((gMenuSelect == cMenu_Exit)||(gMenuSelect != cMenu_Main02_Select_Tuner)){
                        MDIPClearALL();//清屏  
                        MEnter_Menu_PlayMusic(2);
                    }

                }
                break;            
            case cRmKey_PlayPause :
                MEnterQuessKey();
                MEnter_Menu_PlayMusic(4);
                if (gAUDAction_State != cAUDAction_Play) Mplay_Stop(cCTB_PLAY);   
                else Mplay_Stop(cCTB_PAUSE);
                if (FAUDMuteEnl){
                    FDIPSimble_Mute(0);
                    FAUDMuteEnl = 0;
                    mInputSwitch(); //切换4053通道
                }
                break;            
            case cRmKey_PlayStop :
                if (!FAUDMuteEnl) Mplay_Stop(cCTB_STOP);   
                break;            
            case cRmKey_Menu :
                MEnterQuessKey();
                MDIPClearALL();   
                gCursorMove = 1;
                FPress_Enter_Modify = 0;
                gMenuSelect = cMenu_Main;
                MDIP_Main_Menu(gCursorMove);  
                break;            
            case cRmKey_LINE :
                MEnterQuessKey();
                MEnter_Menu_PlayMusic(3);
                break;            
            case cRmKey_MP3 :
                MEnterQuessKey();
                if (gMenuSelect == cMenu_Main02_Select_MP3){
                    if (++gPlayTYPE > 4) gPlayTYPE = 1;
                }
                MEnter_Menu_PlayMusic(4);
                break;            
            case cRmKey_Mic :
                MEnterQuessKey();
                MEnter_Menu_PlayMusic(1);
                break;            
            case cRmKey_Tuner :
                MEnterQuessKey();
                MEnter_Menu_PlayMusic(2);
                break;            
            case cRmKey_PlayMusic :
                MEnterQuessKey();
                gMenuSelect = cMenu_Main01_PlayMusic;
                MDIP_Menu_PlayMusic(gCursorMove);
                break;            
            case cRmKey_Mute : 
                kAUDMute();             
                break;            
            case cRmKey_Enter : 
                FNoAuto_StoreTuner = 0;
                MMenu_None_ClearALL();
                if (FPress_Enter_Clear) MDIPClearALL(); 
                MEnter();//按确定后,进入反白光标的下一层菜单
                mLED_Sture();
                MLED_Release();
                break;            
            case cRmKey_Exit : 
                if (gMenuSelect != cMenu_Exit){
                    MDIPClearALL(); 
                    FDIPSimble_Exit(1);
                }
                MMenu_Exit();
                break;            
            case cRmKey_Manual:  
                MEnterQuessKey();                
                MDIPClearALL();  
                FControlManual = ~FControlManual;
                if (!FControlManual){   // 手动
                    gControlManualStatus = cControlManualStatus;
                    gMenuSelect = cMenu_Exit;
                    gInputType = MEEP_ByteRead(cEEPAddr_WorkRest)&0x07;
                    gReturnMenuBuffer = (MEEP_ByteRead(cEEPAddr_WorkRest)>>3)&0x1f;
                    if (gReturnMenuBuffer == cMenu_Main02_Start_up_TimerList){
                        gReturnMenuBuffer = cMenu_Main02_Select_MP3;
                    }
                    MReturnMenu();
                } 
                else {                 // 自动
                    gCursorMove = 3;
                    MEnter_Menu_Program();
                }
                gAutoExitTime = 10;
                break;            
            case cRmKey_MenuUp : FKeyJogUp_A = 0;
            case cRmKey_MenuDn :  
            case cRmKey_CursorMove : 
                switch (gMenuSelect){
                    case  cMenu_Main02_Select_MIC :
                        FPress_Enter_Modify = 0;
                        break;
                    case  cMenu_Main02_Select_LINE :
                        FPress_Enter_Modify = 0;
                        break;
                    case  cMenu_Main02_Select_MP3 :
                        if (GRmCodeData != cRmKey_CursorMove) FPress_Enter_Modify = 0;
                        break;
                    case  cMenu_Main02_Select_Tuner :
                         if ((gCursorMove == 1) && (GRmCodeData != cRmKey_CursorMove)) FPress_Enter_Modify = 0;
                        break;
                    default : break;		  	
                }
                if (GRmCodeData == cRmKey_MenuDn) FKeyJogUp_A = 1;
                MCursor_Move();
                break;            
            case cRmKey_Program_Setup : 
                MEnterQuessKey();
                MDIP_ProgramList_Menu();
                gMenuSelect = cMenu_Main01_Program;
                break;            
            case cRmKey_Timer_Setup : 
                MEnterQuessKey();
                MDIP_Menu_TimerList(gCursorMove);
                gMenuSelect = cMenu_Main01_Timer;
                break;            
            #ifndef OTG_MODE

⌨️ 快捷键说明

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