📄 uiflow.c
字号:
{
unsigned int X_DOS_TotalFreeCluster;
X_DOS_TotalFreeCluster = 0xffff;
DOS_CheckDiskSpace( &X_DOS_TotalFreeCluster);
if(!G_RecMode)//ADPCM
G_FreeTotalSecond = (((unsigned long)X_DOS_TotalFreeCluster*G_DOS_SectorPerCluster+1)*125)/1000;
else //if(_G723==TRUE)//G723
G_FreeTotalSecond = (((unsigned long)X_DOS_TotalFreeCluster*G_DOS_SectorPerCluster)*54)/100;
}
void UI_idle_Display()
{
//unsigned long X_CardTotal_ByteSize;
DbgP14=1;//mute TI1771
if(G_STATE != STATE_RECORD)
Reset_LED();
// LCD10_Playing_Pause_Stop(2);//display stop icon
LCD10_Disp_Playing_Icon(1);
LCD10_Disp_Apoint(OFF);
LCD10_Disp_Bpoint(OFF);
LCD10_Disp_REP1ALL(G_PLAY_SeqMode);
LCD10_Disp_Folder();
//if(G_FileLock)
LCD10_DispFileLock(G_FileLock);
//else
// LCD10_DispFileLock(0);
// LCD10_Disp_CurrentFileMode(DSP_MenuMODE[G_UIMODE]);
LCD10_Disp_Mode();
Get_Free_Time();
// printf("G_Card_TotalSizeMB=%x\n",G_Card_TotalSizeMB);//card total size(MB)
//sgjm X_CardTotal_ByteSize=(unsigned long)X_DOS_TotalFreeCluster*G_DOS_SectorPerCluster*512;
// printf("Total_ByteSize0=%x\n",(unsigned int)X_CardTotal_ByteSize&0xffff);//free size(B)
// printf("Total_ByteSize1=%x\n",(unsigned int)(X_CardTotal_ByteSize>>16)&0xffff);//free size(B)
if(_G_Storage_Error)
{
G_USR_DirList[G_UIMODE].totalFile=0;
G_FileCurrentIndex=0;
G_FileTotalSecond = 0;
LCD10_Disp_DosErr();
}
else
{
#if (ID3Tag_OPTION==1)
USR_Get_ID3Info(G_DSPPrimeMODE,G_FileCurrentIndex);
#endif
LCD10_Disp_FileIndex_InDIR(G_FileCurrentIndex);
//LCD10_Disp_FileIndex_InDIR(G_Battery_Level);
if(G_UIMODE==0x01)
LCD10_Disp_HHMMSS(G_FileTotalSecond);
else
LCD10_Disp_FileLength(G_DOS_FileSize/10240);
}
G_Power_Off_Timer=240; //30 seconds = 240*125mS
G_SleepCnt = 4;
G_DisplayEvent_Happened=0;
G_LongKey_Speed=9;//add by xyq
DbgP15=1;//turn off DAC OP Power
// DbgP14=1; //unmute
}
//
/*
void UI_idle_Display()
{
DbgP14=0;//mute TI1771
Reset_LED();
LCD10_Playing_Pause_Stop(2);//display stop icon
LCD10_Disp_Apoint(OFF);
LCD10_Disp_Bpoint(OFF);
LCD10_Disp_REP1ALL(G_PLAY_SeqMode);
LCD10_Disp_CurrentFileMode(DSP_MenuMODE[G_UIMODE]);
if(_G_Storage_Error)
{
G_USR_DirList[G_UIMODE].totalFile=0;
G_FileCurrentIndex=0;
LCD10_Disp_DosErr();
}else{
#if (ID3Tag_OPTION==1)
USR_Get_ID3Info(G_DSPPrimeMODE,G_FileCurrentIndex);
#endif
LCD10_Disp_FileIndex_InDIR(G_FileCurrentIndex);
LCD10_Disp_HHMMSS(0);
}
G_Power_Off_Timer=240; //30 seconds = 240*125mS
G_DisplayEvent_Happened=0;
G_LongKey_Speed=9;//add by xyq
// DbgP15=1;//turn off DAC OP Power
}*/
//----------------------------------------------------------------------------------
void UI_Processorstate_transition(void) USING_0
{
BYTE sts;
switch(G_STATE)
{//state
//-- STATE 1: --
/// Idle -- Idle -- Idle -- Idle -- Idle -- Idle -- Idle -- Idle -- Idle -- Idle --
case STATE_IDLE: //State IDLE on--
//DbgP16 = 1;
if(G_EVENT) G_Busy_Timer=0;
switch(G_EVENT)
{//IDLE event
case R_MENU:
//case P_MENU:
G_STATE=STATE_FileMenu;
G_AppoMinute = 0;
if(G_UIMODE!=KUI_MP3_MODE)
{
//G_STATE=STATE_FileMenu;
G_SubMenu=SUBMENU_FOLD;
//LCD10_MenuDisplay();
//G_Busy_Timer=0;
}
else
{
G_SubMenu=SUBMENU_LOCK;
};
LCD10_MenuDisplay();
//G_Busy_Timer=0;
break;
case P_STOP://for power off.xyq021227
G_Power_Off_Timer=0;
G_STATE=STATE_SLEEP;
break;
case R_PLAY://for play MP3 or DVR.xyq021227
if(G_FileCurrentIndex==0) break;//no file, don't play--xyq021227
L2_DSP_setVolume(G_DSP_Volume*2);
// init_pcm1770();
G_STATE=STATE_PLAY;
_G_Openfile = TRUE; // Make Openfile post-processor activity
DbgP15 = 0; //Turn on DAC POWER
// init_pcm1770(); //sgjm add
LCD10_Disp_Playing_Icon(0);
G_Power_Off_Timer=5;
while(G_Power_Off_Timer)
{
};
init_pcm1770();
break;
case R_FF: //Next File
if(G_FileCurrentIndex==0) break;//if no this line,error will happen
(G_FileCurrentIndex==G_USR_DirList[G_UIMODE].totalFile)?(G_FileCurrentIndex=1):(G_FileCurrentIndex=G_FileCurrentIndex+1);
// LCD_ShowTrk(G_FileCurrentIndex);
UI_GetFileAttr();
G_Busy_Timer=24;
G_Flash_HQLP=1;
break;
case R_FR: // Previous File
if(G_FileCurrentIndex==0) break;//if no this line,error will happen
(G_FileCurrentIndex==1)?(G_FileCurrentIndex=G_USR_DirList[G_UIMODE].totalFile):(G_FileCurrentIndex=G_FileCurrentIndex-1);
UI_GetFileAttr();
// LCD_ShowTrk(G_FileCurrentIndex);
G_Busy_Timer=24;
G_Flash_HQLP=1;
break;
case P_DEL://prepare DEL one file function
#if (Auto_Repeat_OPTION==1)
if(_G_StudyFunc)
{
LCD10_Disp_VOX_LEVEL(G_VOXSensitiveLevel);
G_STATE=STATE_VOXSensitive_Adjust;
}
else
#endif
{
//if(G_FileCurrentIndex==0) break;//if no this line,error will happen
if(G_LCDTMoutCnt<8)
{
G_STATE=STATE_WaitDEL;
//if(G_FileCurrentIndex)
G_DelMode=0;
//else
//G_DelMode = 1;
}
}
break;
//case P_STOP://prepare Format flash memory function
// if(G_LCDTMoutCnt<8)
// G_STATE=STATE_WaitFormat;
// break;
case P_MENU: // Mode Switch Function, Switch under Idle Status ---
if(G_UIMODE==0x00)
{
#if (Auto_Repeat_OPTION==1)
if(_G_StudyFunc)
{
_G_StudyFunc=0;
#endif
G_UIMODE=0x01; //MP3--->DVRD
G_DSPPrimeMODE = KDSP_DVRD_MODE;
}
else
{
#if (Auto_Repeat_OPTION==1)
_G_StudyFunc=1;
}
}else{
_G_StudyFunc=0;
#endif
G_UIMODE=0x00; //DVRD--->MP3
G_DSPPrimeMODE = KDSP_MP3_MODE;
// G_FileCurrentIndex = 0;
// UI_GetFileAttr();
// if(G_FileCurrentIndex!=0)//no file, don't play--xyq021227
// {
// _G_Openfile = TRUE;
// G_STATE=STATE_IDLE_PLAY;
// G_Power_Off_Timer=6;
// };
}
G_FileCurrentIndex = 0;
UI_GetFileAttr();
//G_Busy_Timer=0;
break;
case R_MODE:
if(G_UIMODE==0x01)
{
if(!G_RecMode)
{
G_RecMode=1;
G_DSPMinorMODE=KDVR_G723_5K;
_G723=TRUE; //@@chchang_012303
//LCD10_Disp_LP();
}
else
{
G_RecMode=0;
G_DSPMinorMODE=KDVR_ADPCM_4bit;
_G723=FALSE;
//LCD10_Disp_HP();
}
LCD10_Disp_Mode();
//Get_Free_Time();
//G_Busy_Timer = 0;
}
else //if(G_UIMODE==0)
{
(G_Play_EQ>=K_PlayEQModeMax)?(G_Play_EQ=0):(G_Play_EQ=G_Play_EQ+1);
L2_DSP_setEQ(G_Play_EQ);
LCD10_Disp_DSPEQ(G_Play_EQ);
G_Busy_Timer = 16; //two seconds
G_ShowNowSongNumberFG=true;
}
//Get_Free_Time();
G_RecLeftTimeOn=0;
break;
case R_REC://for start record. xyq021227
///chamber@1227, G_UIMODE=0x02 in DVR_Encoder MODE, but then x = 1 in G_USR_DirList[x] ..
G_UIMODE=0x02;
_G723=FALSE;
G_DSPMinorMODE=KDVR_ADPCM_4bit;
if(G_RecMode)
{
G_DSPMinorMODE=KDVR_G723_5K;
_G723=TRUE;
}
else
{
_G723=FALSE;
G_DSPMinorMODE=KDVR_ADPCM_4bit;
};
G_DSPPrimeMODE = KDSP_DVRE_MODE;
//LCD10_Disp_CurrentFileMode(KDSP_DVRE_MODE);
//LCD10_Disp_FileIndex_InDIR(G_USR_DirList[G_UIMODE-1].totalFile+1);
LCD10_Disp_Mode();
LCD10_Disp_Folder();
_G_Openfile = TRUE; // Make Openfile post-processor activity
G_FileLock=0;
LCD10_DispFileLock(0);
G_STATE = STATE_RECORD;
LCD10_Disp_Playing_Icon(0);
DbgP16 = 0;
G_Power_Off_Timer = 4;
while(G_Power_Off_Timer)
{
DbgP16=0;
};
break;
case R_VOLUP: // Volume ++
case R_VOLDOWN: // Volume --
case P_VOLUP:
case P_VOLDOWN:
VolUpDown();
break;
case R_REP:
G_PLAY_SeqMode=(G_PLAY_SeqMode+1)%3;//0:(no repeat); 1:(repeat all); 2:(repeat 1)
LCD10_Disp_REP1ALL(G_PLAY_SeqMode);
break;
default:
break;
}//IDLE event
//xyq LCD handle 021226
if(!G_Busy_Timer) G_Flash_HQLP=0;
if(!G_Busy_Timer&& G_DisplayEvent_Happened && G_STATE==STATE_IDLE)
{
// printf("\n\n%bx\n",lstimer);
// LCD10_Disp_FileIndex_InDIR(dis_adc_val);
UI_idle_Display();
// DSP_Sleep_Process();
}
else if(G_Busy_Timer&&G_Flash_HQLP)
{
G_Power_Off_Timer = 240;
LCD10_Disp_FileIndex_InDIR(G_FileCurrentIndex);
if(G_UIMODE==0x01)
LCD10_Disp_HHMMSS(G_FileTotalSecond);
else
LCD10_Disp_FileLength(G_DOS_FileSize/10240);
LCD10_DispFileLock(G_FileLock);
if(G_UIMODE!=00)
LCD10_Blink_CharIcon(BLINK_HQLP);
};
#if 1 //@@chchang_012203
if(!G_Power_Off_Timer)
if(G_SleepCnt)
{
G_SleepCnt-=1;
if(G_SleepCnt)
G_Power_Off_Timer=240;
}
if(!G_SleepCnt || _G_LowBatt_State)
{
/*if(_G_LowBatt_State)
{
//LCD10_SetIcon(Icon_LowBatt_Add,Icon_LowBatt);
//LCD10_Disp_LOWBattery();
LCD10_Disp_AllIcon();
G_Busy_Timer=16; //wait 2 second disp low battery
while(G_Busy_Timer);
}*/
G_STATE=STATE_SLEEP;
/* if((G_Powerstate==0x03) && G_Battery_GroupNum)
{//if charge, don't power off
G_Power_Off_Timer=240;
G_STATE=STATE_IDLE;
}*/
}
#endif
//G_EVENT=0;
break;
//11111111---111 --- End of State IDLE -- 111 --1111111111111111 ----
//-- STATE 2: --
//EVENT Relationship in PLAY state.
/*case STATE_IDLE_PLAY:
if(!G_Power_Off_Timer)
{
G_STATE=STATE_IDLE;
Playing_To_Stop();
G_DisplayEvent_Happened=1;
G_FileCurrentIndex = 0;
UI_GetFileAttr();
};
break;*/
case STATE_PLAY:
//State PLAY --
if(_G_USB_PowerPlug_Interrupt || _G_LowBatt_State)
{//if USB connected, stop play
G_EVENT = R_STOP;
}
switch(G_EVENT)
{//PLAY event
case R_PAUSE://PAUSE/PLAY
// Do change the G_State for feeding data to DSP until Buffer full
_GPlayPause = TRUE;
LCD10_Disp_FileIndex_InDIR(G_FileCurrentIndex); //糤
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -