📄 keyfunc.c
字号:
{
RefreshLcdBuf(2,19+30*i,Bmp049);
}
else
{
RefreshLcdBuf(2,19+30*i,Bmp048);
}
}
LcdSendGraphicDisplay(0,0,8,LcdMaxWidth,(UINT8 *)&LcdDispBuf[0][0]);
while(1)
{
LCDDisplayOnOff(1);
};
}
void WriteRtcData(void)
{
date[0]=((UINT16)SecTimeBuf[0]<<4)+SecTimeBuf[1];
date[1]=((UINT16)MinTimeBuf[0]<<4)+MinTimeBuf[1];
date[2]=((UINT16)HourTimeBuf[0]<<4)+HourTimeBuf[1];
date[3]= WeekTimeBuf;
date[4]=((UINT16)DateTimeBuf[0]<<4)+DateTimeBuf[1];
date[5]=((UINT16)MonthTimeBuf[0]<<4)+MonthTimeBuf[1];
date[6]=((UINT16)YearTimeBuf[2]<<4)+YearTimeBuf[3];
I2CWriteDate();
}
void MtEnterPrg(void)
{
if(SysLcdFramePoint < 13)
{
if(KeyEditFlag == 0xAA)
{
KeyEditFlag=0;
}
else
{
KeyEditFlag = 0xAA;
}
__PRINTF("\r\nEnterDefMenuFlag=%x",EnterDefMenuFlag);
}
else
if(SysLcdFramePoint == 13)
{
#if (USED_RTC==0)
//保存时间退出
YearTimeBuf[0]=0x02;YearTimeBuf[1]=0x00;
YEAR=FourBcdToHexPrgInt(YearTimeBuf);
MONTH=TwoBcdToHexPrg(MonthTimeBuf);
DOM=TwoBcdToHexPrg(DateTimeBuf);
HOUR=TwoBcdToHexPrg(HourTimeBuf);
MIN=TwoBcdToHexPrg(MinTimeBuf);
SEC=TwoBcdToHexPrg(SecTimeBuf);
DOW=WeekTimeBuf;
#else
WriteRtcData();
#endif
SysModeStatus= SYS_IDLE_STA;
SysLcdFramePoint = 1;
SortTimeListPrg();
JdqTime=3000l;
RefreshFlag=1;
ReadRtc();
TimePrgTask();
LcdDisplayDefScr();
}
else if(SysLcdFramePoint == 14)
{
SysModeStatus= SYS_IDLE_STA;
SysLcdFramePoint=1;
SortTimeListPrg();
ReadRtc();
TimePrgTask ();
}
}
void IAPPRG(void)
{
UINT32 num;
//VICIntEnClr = 0x00000010;
Set_start_pll(FPCLK2,PLLCFG_Val2);
VICDefVectAddr = (unsigned int) def_isr; // for spurious interrupts
num=erase(TIMER_PART_ADR,TIMER_PART_ADR+sizeof(TimerPartTab)-1);
if(num != 0)
{
__PRINTF("\r\n erase code Err=%x",num);
for(;;);
}
num=program (TIMER_PART_ADR, TimerPartBak, 4*1024l);
if(num != 0)
{
__PRINTF("\r\n program code Err=%x",num);
for(;;);
}
Set_start_pll(FPCLK1,PLLCFG_Val1);
//VICIntEnable=0x00000010;
}
void SaveProgramPrg(void)
{
//保存设置的定时参数
UINT32 i;
UINT16 num;
__PRINTF("\r\n stcTimerPiont=%x",sizeof(stcTimerPiont));
for(i=0;i<sizeof(TimerPartBak);i++)
{
((UINT8*)TimerPartBak)[i]=TimerPartTab[i];
}
__PRINTF("\r\n stcTimerPiont=%x",sizeof(stcTimerPiont));
//保存当次的设置
//TimerPiontApp=
((stcTimerPiont *)&TimerPartBak)[TimerPiontApp.PragNum]=TimerPiontApp;
__PRINTF("\r\n TimerPiontApp.PragNum=%x",TimerPiontApp.PragNum);
__PRINTF("\r\n");
IAPPRG();
//编程完毕读出下一个定时点参数
if(++TimerPiontApp.PragNum>=MAX_PRAM_ITEM)
{
TimerPiontApp.PragNum=0;
}
num=TimerPiontApp.PragNum;
TimerPiontApp=((stcTimerPiont *)&TimerPartTab)[TimerPiontApp.PragNum];
//复位指针
TimerPiontApp.PragNum=num;
LcdPoint=2;
}
void DeviceMag(void) //设备管理
{
switch(SysLcdFramePoint)
{
case 0:
if((SwitchSave & (0x01<<0x0))!=0)
{
SwitchSave &= ~(0x01<<0);
}
else
{
SwitchSave |= (0x01<<0);
}
CtrJdqPrg();
break;
case 1:
if((SwitchSave & (0x01<<1))!=0)
{
SwitchSave &= ~(0x01<<1);
}
else
{
SwitchSave |= (0x01<<1);
}
CtrJdqPrg();
break;
case 2:
if((SwitchSave & (0x01<<2))!=0)
{
SwitchSave &= ~(0x01<<2);
}
else
{
SwitchSave |= (0x01<<2);
}
CtrJdqPrg();
break;
case 3:
if((SwitchSave & (0x01<<3))!=0)
{
SwitchSave &= ~(0x01<<3);
}
else
{
SwitchSave |= (0x01<<3);
}
CtrJdqPrg();
break;
case 4:
if((SwitchSave & (0x01<<4))!=0)
{
SwitchSave &= ~(0x01<<4);
}
else
{
SwitchSave |= (0x01<<4);
}
CtrJdqPrg();
break;
case 5:
if((SwitchSave & (0x01<<5))!=0)
{
SwitchSave &= ~(0x01<<5);
}
else
{
SwitchSave |= (0x01<<5);
}
CtrJdqPrg();
break;
break;
case 6:
SwitchSave=0xFFFFFFFF;
CtrJdqPrg();
break;
case 7:
SwitchSave=0x00;
CtrJdqPrg();
break;
default:
SysModeStatus= SYS_IDLE_STA;
RefreshFlag=1;
TimePrgTask();
LcdDisplayDefScr();
break;
}
}
#ifdef BOGUS
{
UINT8 i;
if(SysLcdFramePoint == 1)
{
SysModeStatus= SYS_IDLE_STA;
return;
}
RefreshLcdScreen(24,0,(UINT8*)Bmp099);
DVDNum=Mp3Num=FMNum=0;
for(i=0;i<10;i++)
{
SerialSendPrg(TransSOF,DVD_DEVICE,1,ReadMacSerialNum,0,0);
DelayMs(200);
if(UartRcvFlag == 0xAA)
{
UartRcvFlag=0;
DVDNum=1;
break;
}
}
for(i=0;i<10;i++)
{
SerialSendPrg(TransSOF,MP3_DEVICE,3,ReadMacSerialNum,0,0);
DelayMs(200);
if(UartRcvFlag == 0xAA)
{
UartRcvFlag=0;
Mp3Num=1;
break;
}
}
for(i=0;i<10;i++)
{
SerialSendPrg(TransSOF,FM_DEVICE,2,ReadMacSerialNum,0,0);
DelayMs(200);
if(UartRcvFlag == 0xAA)
{
UartRcvFlag=0;
FMNum=1;
break;
}
}
RefreshFlag=1;
}
#endif /* BOGUS */
void DelRecFilesPrgTT(void)
{
//UINT32 i;
if(SysLcdFramePoint == 0)
{
Mp3PlayerInfo.CurrentFileNum=CurMusicCmd.CurrentFileNum;
DelRecFilesPrg();
}
else
{
for(Mp3PlayerInfo.CurrentFileNum=501;Mp3PlayerInfo.CurrentFileNum<512;Mp3PlayerInfo.CurrentFileNum++)
{
//DelRecFilesPrg();
DeleteRecFile(Mp3PlayerInfo.CurrentFileNum);
}
#if USED_LCD
//ClearLcdBuf(20,70, 16,100);
RefreshLcdScreen(16,128,Bmp111111907);
ePutstr("Delete file Err");
DelayMs(1500);
#endif /* BOGUS */
}
Mp3PlayerInfo.ALLFileNum=RecorderFileInit(0xFFF);
HexToTwoBcdPrg(HourTimeBuf,0);
HexToTwoBcdPrg(MinTimeBuf,0);
HexToTwoBcdPrg(SecTimeBuf,0);
SysModeStatus=SYS_REC_STA;
SysLcdFramePoint=2;
}
/*
************************************************************************************************************************
**函数原型: void EnterKeyPrg(void)
**参数说明: 无
**返回值: 无
**说明: 该函数用于处理Enter键
************************************************************************************************************************
*/
void EnterKeyPrg(void)
{
UINT8 i;
switch(SysModeStatus)
{
case SYS_IDLE_STA: //默认菜单选择
SysModeStatus=SYS_HAND_STA;
SysLcdFramePoint=0;
RefreshLcdBuf(0,0,(UINT8*)Bmp043); //主菜单
Mp3PlayerInfo.Mp3Status=STOP_STATUS;
Mp3PlayerInfo.Mp3Mode=0;
break;
case SYS_HAND_STA: //hand
SysSelPlayerFunc();
break;
case SYS_MP3_STA: //hand
USBMP3EnterPrg();
break;
case SYS_MT_STA: //mt
MtEnterPrg();
break;
case SYS_REC_STA: //开关
RecEnterPrg();
break;
case SYS_SETTIMER_STA:
SetTimerEnterPrg();
break;
case SYS_PW_SW_STA: //开关
DeviceMag();
break;
case SYS_DEL_SET_TIMER:
if(SysLcdFramePoint == 0)
{
//
DelPragItem(999);
}
SysModeStatus=SYS_SETTIMER_STA;
TimerPiontApp=((stcTimerPiont *)&TimerPartTab)[1];
TimerPiontApp.PragNum=1;
SysLcdFramePoint = 32;
break;
case SYS_DEL_RECFILES:
DelRecFilesPrgTT();
break;
default:
SysModeStatus=0;
break;
}
}
//
void LeftMtPrg(void)
{
if(KeyEditFlag == 0xAA)
{
switch(SysLcdFramePoint)
{
case 1: //调整日低
if(--DateTimeBuf[1] > 9)
{
DateTimeBuf[1]= 9;
}
if(TwoBcdToHexPrg(DateTimeBuf) == 0)
DateTimeBuf[1]=1;
if(TwoBcdToHexPrg(DateTimeBuf) > 31)
DateTimeBuf[1]=1;
break;
case 2: //调整月高
if(--MonthTimeBuf[0] > 1)
{
MonthTimeBuf[0]= 1;
}
if(TwoBcdToHexPrg(MonthTimeBuf) == 0)
MonthTimeBuf[1]=1;
if(TwoBcdToHexPrg(MonthTimeBuf) > 12)
MonthTimeBuf[1]=1;
break;
case 3: //调整月低
if(--MonthTimeBuf[1] > 9)
{
MonthTimeBuf[1]= 9;
}
if(TwoBcdToHexPrg(MonthTimeBuf) == 0)
MonthTimeBuf[1]=1;
if(TwoBcdToHexPrg(MonthTimeBuf) > 12)
MonthTimeBuf[1]=1;
break;
case 4: //调整年高
if(--YearTimeBuf[2] > 9)
{
YearTimeBuf[2]= 9;
}
break;
case 5: //调整年底
if(--YearTimeBuf[3] > 9)
{
YearTimeBuf[3]= 9;
}
break;
case 6: //调整星期
if(--WeekTimeBuf > 6)
{
WeekTimeBuf= 6;
}
break;
case 7: //调整时高
if(--HourTimeBuf[0] > 2)
{
HourTimeBuf[0]= 2;
}
if(TwoBcdToHexPrg(HourTimeBuf) > 23)
HourTimeBuf[1]=0;
break;
case 8: //调整时低
if(--HourTimeBuf[1] > 9)
{
HourTimeBuf[1]= 9;
}
if(TwoBcdToHexPrg(HourTimeBuf) > 23)
HourTimeBuf[1]=0;
break;
case 9: //调整分高
if(--MinTimeBuf[0] > 5)
{
MinTimeBuf[0]= 5;
}
break;
case 10: //调整分低
if(--MinTimeBuf[1] > 9)
{
MinTimeBuf[1]= 9;
}
break;
case 11: //调整秒高
if(--SecTimeBuf[0] > 5)
{
SecTimeBuf[0]= 5;
}
break;
case 12: //调整秒低
if(--SecTimeBuf[1] > 9)
{
SecTimeBuf[1]= 9;
}
break;
case 13: //保存
break;
case 14: //退出
break;
default: //调整日高
SysLcdFramePoint=0;
if(--DateTimeBuf[0] > 3)
{
DateTimeBuf[0]=3;
}
if(TwoBcdToHexPrg(DateTimeBuf) == 0)
DateTimeBuf[1]=1;
if(TwoBcdToHexPrg(DateTimeBuf) > 31)
DateTimeBuf[1]=1;
break;
}
}
else
{
if(--SysLcdFramePoint>14)
{
SysLcdFramePoint=14;
}
}
}
void LeftKeyPrg(void)
{
switch(SysModeStatus)
{
case SYS_IDLE_STA: //默认菜单选择
break;
case SYS_HAND_STA: //hand
if(--SysLcdFramePoint>3)
{
SysLcdFramePoint=3;
}
break;
case SYS_MP3_STA: //hand
USBMP3DownPrg();
break;
case SYS_MT_STA: //mt
LeftMtPrg();
break;
case SYS_REC_STA: //开关
//SwitchEnterPrg();
RecDownPrg();
break;
case SYS_SETTIMER_STA:
SetTimerLeftPrg();
break;
case SYS_PW_SW_STA: //开关
//SwitchEnterPrg();
if(--SysLcdFramePoint>8)
{
SysLcdFramePoint=8;
}
break;
case SYS_DEL_SET_TIMER:
case SYS_DEL_RECFILES:
if(SysLcdFramePoint== 0)
{
SysLcdFramePoint=1;
}
else
SysLcdFramePoint=0;
break;
default:
SysModeStatus=0;
break;
}
}
//
void RightMtPrg(void)
{
if(KeyEditFlag == 0xAA)
{
switch(SysLcdFramePoint)
{
case 1: //调整日低
if(++DateTimeBuf[1] > 9)
{
DateTimeBuf[1]= 0;
}
if(TwoBcdToHexPrg(DateTimeBuf) == 0)
DateTimeBuf[1]=1;
if(TwoBcdToHexPrg(DateTimeBuf) > 31)
DateTimeBuf[1]=1;
break;
case 2: //调整月高
if(++MonthTimeBuf[0] > 1)
{
MonthTimeBuf[0]= 0;
}
if(TwoBcdToHexPrg(MonthTimeBuf) == 0)
MonthTimeBuf[1]=1;
if(TwoBcdToHexPrg(MonthTimeBuf) > 12)
MonthTimeBuf[1]=1;
break;
case 3: //调整月低
if(++MonthTimeBuf[1] > 9)
{
MonthTimeBuf[1]= 0;
}
if(TwoBcdToHexPrg(MonthTimeBuf) == 0)
MonthTimeBuf[1]=1;
if(TwoBcdToHexPrg(MonthTimeBuf) > 12)
MonthTimeBuf[1]=1;
break;
case 4: //调整年高
if(++YearTimeBuf[2] > 9)
{
YearTimeBuf[2]= 0;
}
break;
case 5: //调整年底
if(++YearTimeBuf[3] > 9)
{
YearTimeBuf[3]= 0;
}
break;
case 6: //调整星期
if(++WeekTimeBuf > 6)
{
WeekTimeBuf= 0;
}
break;
case 7: //调整时高
if(++HourTimeBuf[0] > 2)
{
HourTimeBuf[0]= 0;
}
if(TwoBcdToHexPrg(HourTimeBuf) > 23)
HourTimeBuf[1]=0;
break;
case 8: //调整时低
if(++HourTimeBuf[1] > 9)
{
HourTimeBuf[1]= 0;
}
if(TwoBcdToHexPrg(HourTimeBuf) > 23)
HourTimeBuf[1]=0;
break;
case 9: //调整分高
if(++MinTimeBuf[0] > 5)
{
MinTimeBuf[0]= 0;
}
break;
case 10: //调整分低
if(++MinTimeBuf[1] > 9)
{
MinTimeBuf[1]= 0;
}
break;
case 11: //调整秒高
if(++SecTimeBuf[0] > 5)
{
SecTimeBuf[0]= 0;
}
break;
case 12: //调整秒低
if(++SecTimeBuf[1] > 9)
{
SecTimeBuf[1]= 0;
}
break;
case 13: //保存
break;
case 14: //退出
break;
default: //调整日高
SysLcdFramePoint=0;
if(++DateTimeBuf[0] > 3)
{
DateTimeBuf[0]=0;
}
if(TwoBcdToHexPrg(DateTimeBuf) == 0)
DateTimeBuf[1]=1;
if(TwoBcdToHexPrg(DateTimeBuf) > 31)
DateTimeBuf[1]=0;
break;
}
}
else
{
if(++SysLcdFramePoint>14)
{
SysLcdFramePoint=0;
}
}
}
void RightKeyPrg(void)
{
switch(SysModeStatus)
{
case SYS_IDLE_STA: //默认菜单选择
break;
case SYS_HAND_STA: //hand
if(++SysLcdFramePoint>3)
{
SysLcdFramePoint=0;
}
break;
case SYS_MP3_STA: //hand
USBMP3UpPrg();
break;
case SYS_MT_STA: //mt
RightMtPrg();
break;
case SYS_REC_STA: //开关
//SwitchEnterPrg();
RecUpPrg();
break;
case SYS_SETTIMER_STA:
SetTimerRightPrg();
break;
case SYS_PW_SW_STA: //开关
//SwitchEnterPrg();
if(++SysLcdFramePoint>8)
{
SysLcdFramePoint=0;
}
break;
case SYS_DEL_SET_TIMER:
case SYS_DEL_RECFILES:
if(SysLcdFramePoint== 0)
{
SysLcdFramePoint=1;
}
else
SysLcdFramePoint=0;
break;
default:
SysModeStatus=0;
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -