📄 s3c2440_main.c
字号:
#include "Include.h"
#include <stdlib.h>
#include <string.h>
/*==============================================================================*/
/*==============================================================================*/
struct GUI_MENU *SystemMainMenu[]={
// &GUI_ICO_Menu_SystemTime,
// &GUI_ICO_Menu_TSCalibrate,
// &GUI_ICO_Menu_COM_Load,
&GUI_ICO_Menu_ALCO_Test,
&GUI_ICO_Menu_SystemSetup,
// &GUI_ICO_Menu_Calculator,
&GUI_ICO_Menu_Extra,
&GUI_MenuEnd
};
/*==============================================================================*/
/*==============================================================================*/
/*==============================================================================*/
static int MainMenuProc(HWND wnd,int msg,int paramt0,int paramt1)
{
static struct GUI_ICOMENU_PARAMT Paramt={0,0,3};
static i=0,j=0;
////
GUI_MemdevEnable();
GUI_ICOMenu(wnd,msg,&Paramt,SystemMainMenu);
GUI_TransFillRectangle(8,128,LCD_XSIZE-8*2,2,RGB565(31,63,31));
GUI_TransFillRectangle(8,LCD_YSIZE-40,LCD_XSIZE-8*2,2,RGB565(31,63,31));
////
Display_SimulateClock(4,132,128,128);
GUI_LabelPrintf(LCD_XSIZE>>1,LCD_YSIZE-40,LCD_XSIZE>>1,40,RGB565(31,63,31),RGB_Tran,RGB_Tran,Center,Font_Digit_12x24,"%02X:%02X:%02X",rBCDHOUR,rBCDMIN,rBCDSEC);
UpdataBatteryData();
ShowBatteryScale(4,LCD_YSIZE-32,RGB565(31,63,31),RGB_Tran,i+j);
//////////////
//////////////
GUI_ShowWindow(wnd);
//////////////
//////////////
if( paramt0==1000 )
{
i+=1;
if((i+j)>5) i=0;
}
}
/*==============================================================================*/
/*==============================================================================*/
static void MainMenu(void)
{
int a,key;
HWND wnd;
////
GUI_MemdevEnable();
wnd=GUI_CreateWindow( 0,0,LCD_XSIZE,LCD_YSIZE,
0,RGB565(5,10,16),DeskTop_Image,
MainMenuProc,
"Main Menu");
////
SendMessage(wnd,GUI_MSG_PAINT,0,0);
GUI_ShowWindow(wnd);
////
while(1)
{
key=Uart_GetKey(0);
////
if(key!=0)
{
switch(key)
{
case ASC_ENTER:
SendMessage(wnd,GUI_MSG_OK,0,0);
break;
////
case 'a':
SendMessage(wnd,GUI_MSG_BACK,0,0);
break;
////
case 'd':
SendMessage(wnd,GUI_MSG_NEXT,0,0);
break;
////
case 'w':
SendMessage(wnd,GUI_MSG_UP,0,0);
break;
////
case 's':
SendMessage(wnd,GUI_MSG_DOWN,0,0);
break;
case '0':
GUI_WindowTest();
break;
default:
break;
}
key=0;
}
////
if(TS_PRESS_100MS())
{
SendMessage(wnd,GUI_MSG_TS_DOWN,0,0);
TS_Stop();
}
////
if(a!=rBCDSEC)
{
a=rBCDSEC;
SendMessage(wnd,GUI_MSG_PAINT,1000,0);
}
}
}
/*==============================================================================*/
void dely(U32 tt)
{
U32 i;
for(;tt>0;tt--)
{
for(i=0;i<10000;i++){}
}
}
int Main(void)
{
int i,data;
int a,b;
////
a=0;
b=0;
i=0;
data=0;
EnableModuleClock(CLOCK_ALL);
__rt_lib_init();
CPU_ISR_Init();
// CPU_SetClkDivFHP(CPU_CLK_DIV_1_4_8);
CPU_SetMPLL(CPU_405MHZ);
CPU_GetFclkMHZ();
MMU_Init();
Uart_Init();
Uart_SetBaud(0,115200);
Uart_Puts(0,"\n==================================\n");
Uart_Puts(0,"* Main Entry *\n\n");
Uart_Printf(0,"Current Time:20%02X-%02X-%02X, %02X:%02X:%02X\n",rBCDYEAR,rBCDMON,rBCDDAY,rBCDHOUR,rBCDMIN,rBCDSEC);
Uart_Printf(0,"rMPLLCON=%08X; rCLKDIVN=%08X\n",rMPLLCON,rCLKDIVN);
Uart_Printf(0,"CPU Fclk=%dMHZ; Hclk=&%dMHZ; Pclk=%dMHZ\n",CpuFclkHZ/1000000,CpuHclkHZ/1000000,CpuPclkHZ/1000000);
Uart_Printf(0,"NorFlash ID:%08X.\n",Get_NorFlash_ID());
Uart_Printf(0,"Float Test:19/6=%f\n",(float)19/6);
Port_Init();
ADC_Init();
RTC_Init();
IIC_Init();
ALCO_Init();
Tick15msInit();
ARM_EnableIRQ();
GUI_Init();
GUI_MemdevDisable();
NandFlash_Init();
// NandFlash_Test();
if(SDI_Init())
{
FAT_Init();
////
Find_SystemFile("\\boot\\boot.ini");
}
///////////////////////////////
if(pGUI_TS->IsDown())
{
TouchScreen_Calibrate();
}
////
while(1)
{
MainMenu();
}
////
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -