main.c
上传用户:wealth48
上传日期:2022-06-24
资源大小:1701k
文件大小:33k
源码类别:

uCOS

开发平台:

C/C++

  1. /***************************************************************************
  2. Copyright (c) 2004-2007 threewater@up-tech.com, All rights reserved.
  3. by threewter 2004.5.12
  4. ***************************************************************************/
  5. /***************************************************************************
  6.     #说明: C  main 函数,ucos-ii初始化等定义
  7. ----------------------------------  Bug  --------------------------------------
  8. ----------------------------------  TODO list  --------------------------------------
  9. ----------------------------------修正--------------------------------------
  10. 2004-5-12 创建
  11. ***************************************************************************/
  12. #include"../ucos-ii/includes.h"               /* uC/OS interface */
  13. #include "../ucos-ii/add/osaddition.h"
  14. #include "../inc/drivers.h"
  15. #include "../inc/sys/lib.h"
  16. #include "menuGUI.h"
  17. #include "Model.h"
  18. #include <string.h>
  19. #include <stdio.h>
  20. #pragma import(__use_no_semihosting_swi)  // ensure no functions that use semihosting 
  21. ///******************任务定义***************///
  22. OS_STK Main_Stack[STACKSIZE]={0, };   //Main_Test_Task堆栈
  23. void Main_Task(void *Id);             //Main_Test_Task
  24. #define Main_Task_Prio     12
  25. OS_STK test_Stack[STACKSIZE]={0, };   //test_Test_Task堆栈
  26. void test_Task(void *Id);             //test_Test_Task
  27. #define test_Task_Prio     11
  28. OS_STK star_Stack[STACKSIZE]={0, };   //test_Test_Task堆栈
  29. void star_Task(void *Id);             //test_Test_Task
  30. #define star_Task_Prio     10
  31. /**************已经定义的OS任务*************
  32. #define SYS_Task_Prio 1
  33. #define Touch_Screen_Task_Prio 9
  34. #define Main_Task_Prio     12
  35. #define Key_Scan_Task_Prio      58
  36. #define Lcd_Fresh_prio           59
  37. #define Led_Flash_Prio           60
  38. ***************************************/////////
  39. ///*****************事件定义*****************///
  40. /////////////////////////////////////////////////////
  41. //                  Main function.                //
  42. ////////////////////////////////////////////////////
  43. extern U16 LCDBufferII2[480][640];
  44. extern U16* pbuf;
  45. extern rLCDADDR1;
  46. extern U8 *LoadBMPBuf;
  47. int main(void)
  48. {
  49. ARMTargetInit();        // do target (uHAL based ARM system) initialisation //
  50. OSInit();               // needed by uC/OS-II //
  51. OSInitUart();
  52. initOSFile();
  53. #if USE_MINIGUI==0
  54. initOSMessage();
  55. initOSList();
  56. initOSDC();
  57. initOSCtrl();
  58. //LoadFont();
  59. #endif
  60. loadsystemParam();
  61. // create the tasks in uC/OS and assign increasing //
  62. // priorities to them so that Task3 at the end of  //
  63. // the pipeline has the highest priority.          //
  64. LCD_printf("Create task on uCOS-II...n");
  65. OSTaskCreate(Main_Task,  (void *)0,  (OS_STK *)&Main_Stack[STACKSIZE-1],  Main_Task_Prio);
  66. OSTaskCreate(test_Task,  (void *)0,  (OS_STK *)&test_Stack[STACKSIZE-1],  test_Task_Prio);
  67. OSTaskCreate(star_Task,  (void *)0,  (OS_STK *)&star_Stack[STACKSIZE-1],  star_Task_Prio);
  68. OSAddTask_Init(1);
  69.   
  70. LCD_printf("Starting uCOS-II...n");
  71. LCD_printf("Entering graph mode...n");
  72. LCD_printf("0641301240 wenzhiqiangn");
  73. LCD_printf("0641301236 chenhaiyongn");
  74. LoadBMPBuf = malloc(3 * 640*2000);
  75.  
  76. OSStart();              // start the OS //
  77. // never reached //
  78. return 0;
  79. }//main
  80. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  81. void Main_Task(void *Id)             //Main_Test_Task
  82. {
  83. //-------------------------------
  84. POSMSG pMsg;//定义消息结构
  85. int X,Y;
  86. int choiceIndex;
  87. int i;
  88. int distance;
  89. unsigned int Get_time,G_time[2];
  90. struct point{
  91.    int x;
  92.    int y;
  93. };//定义点坐标结构
  94. struct point scrpoint;//触摸点
  95. struct point scrpoint2[2];
  96. static char KeyName2[3];
  97. static int KeyStatue[2]={0,0};
  98. char * KeyName[16]={"10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25"};
  99. int count=0;
  100. int doubleFlag = 1;
  101. int Flag=0;
  102.     WaitMessage(0);
  103. //------------------------------------
  104. InitMenuGUI();
  105. InitModel();
  106.     
  107.     
  108. for(;;){
  109. pMsg=WaitMessage(0);//等待消息
  110.        switch(pMsg->Message){
  111. case OSM_TOUCH_SCREEN://OSM_TOUCH_SCREEN:
  112.     
  113. switch(pMsg->LParam){
  114.      case TCHSCR_ACTION_CLICK:
  115.                     
  116.                          scrpoint.x=pMsg->WParam&0x0000ffff;
  117.                          if(scrpoint.x<1) scrpoint.x=1;
  118.                          if(scrpoint.x>639) scrpoint.x=639;
  119.                          scrpoint.y=pMsg->WParam>>16;
  120.                          if(scrpoint.y<1) scrpoint.y=1;
  121.                          if(scrpoint.y>479) scrpoint.y=479;
  122.                          Uart_Printf(0,"nx0=%d",scrpoint.x);
  123.                          Uart_Printf(0,"y0=%dn",scrpoint.y);
  124.                          choiceIndex = ChoiceWhat(scrpoint.x,scrpoint.y);
  125.                          Uart_Printf(0,"ChoiceWhat:%dn",choiceIndex);  
  126.                          if(choiceIndex<25){
  127.                           if(getState(choiceIndex) == 0){
  128.                           Select(choiceIndex);
  129.                           Mark(choiceIndex);
  130.                           }
  131.                           else {
  132.                           Cancal(choiceIndex);
  133.                           CancalMark(choiceIndex);
  134.                           }
  135.                          
  136.                          }else{
  137.                           if(choiceIndex == 30){
  138.                           for(i = 0;i < 32;i++)
  139.                           ScrollMenu(-10);
  140.                           }//上一页
  141.                           if(choiceIndex == 31){
  142.                           for(i = 0;i < 32;i++)
  143.                           ScrollMenu(10);
  144.                           }//下一页
  145.               
  146.                           if(choiceIndex == 32){//点菜结束
  147.                           EndSelect();
  148. for(i = 0;i < 25;i++)
  149. {
  150. if(getState(i) == 1){
  151. CancalMark(i);
  152. }
  153. }
  154. InitModel();
  155.                           ScrollMenu(0);
  156.                           }
  157.                           if(choiceIndex == 33){
  158.                           CloseImage();
  159.                           for(;;){OSTimeDly(2000);}
  160.                           }//关闭
  161.                          }
  162.                          Uart_Printf(0,"total:%d",getTotalPrice());
  163.                          ShowNum(450,430,getTotalPrice());
  164.                          
  165.                          break;
  166.                   
  167.                       
  168. case TCHSCR_ACTION_DOWN:
  169. scrpoint.x=-1;//表示触摸屏按下
  170. //获得触摸点坐标
  171. scrpoint2[0].x=pMsg->WParam&0x0000ffff;
  172.                         if(scrpoint2[0].x<1) scrpoint2[0].x=1;
  173.                         if(scrpoint2[0].x>639) scrpoint2[0].x=639;
  174. scrpoint2[0].y=pMsg->WParam>>16;
  175.                         if(scrpoint2[0].y<1) scrpoint2[0].y=1;
  176.                         if(scrpoint2[0].y>479) scrpoint2[0].y=479;
  177.                         
  178.                         G_time[0]=OSTimeGet();//获取系统当前时间
  179.                         
  180.                         
  181.                         Uart_Printf(0,"nx1=%d",scrpoint2[0].x);
  182.                         Uart_Printf(0,"y1=%dn",scrpoint2[0].y);
  183.                         
  184.                              break;
  185. case TCHSCR_ACTION_MOVE:
  186. scrpoint2[1].x=pMsg->WParam&0x0000ffff;
  187.                         if(scrpoint2[1].x<1) scrpoint2[1].x=1;
  188.                         if(scrpoint2[1].x>639) scrpoint2[1].x=639;                        
  189. scrpoint2[1].y=pMsg->WParam>>16;
  190.                         if(scrpoint2[1].y<1) scrpoint2[1].y=1;
  191.                         if(scrpoint2[1].y>479) scrpoint2[1].y=479;
  192.                         
  193.                         
  194.                         G_time[1]=OSTimeGet();//获取系统当前时间
  195.                         Get_time= G_time[1]- G_time[0];//获取从按下到移动的时间
  196.                         Uart_Printf(0,"移动时间 :%dn",Get_time);
  197.                         
  198.                         
  199.                         
  200.                         
  201.                         Uart_Printf(0,"nx2=%d",scrpoint2[1].x);
  202.                         Uart_Printf(0,"y2=%dn",scrpoint2[1].y);
  203.                         
  204.                         X=scrpoint2[1].x-scrpoint2[0].x;
  205.                         Y=scrpoint2[1].y-scrpoint2[0].y;
  206.                         
  207.                         distance=sqrt(X*X+Y*Y)*1000;
  208.                         Uart_Printf(0,"distance:%d",distance);
  209.                         
  210.                         scrpoint2[0].x=scrpoint2[1].x;
  211.                         scrpoint2[0].y=scrpoint2[1].y;
  212.                          
  213.                          
  214.                         
  215.                         Uart_Printf(0,"移动速度 :%dn",distance/Get_time);
  216.                         
  217.                        
  218.                         
  219.                         if(X==0 && Y==0)
  220.                         {
  221.                              //当作单击处理
  222.                              Uart_Printf(0,"n...Click...");
  223.                              
  224.                        
  225.                         }
  226.                         else
  227.                         {
  228.                             if(X>0)
  229.                             {
  230.                                if(Y<0)
  231.                                {
  232.                                    if(abs(Y)<=X)
  233.                                    {
  234.                                        //向右滚
  235.                                        
  236.                                         Uart_Printf(0,"n...Go to right...");
  237.                                    }
  238.                                    else
  239.                                    {
  240.                                        //向上滚
  241.                                        if(distance/Get_time>1000)
  242.                                        {
  243.                                             //向上甩
  244.                                             Uart_Printf(0,"n...Go to top fastly...");
  245.                                             
  246.                                        }
  247.                                       
  248.                                        else {Uart_Printf(0,"n...Go to top...");
  249.                                        ScrollMenu(distance/1000);}
  250.                                    }
  251.                                }
  252.                                else
  253.                                {
  254.                                    if(Y<=X)
  255.                                    {
  256.                                         //向右滚
  257.                                         Uart_Printf(0,"n...Go to right...");
  258.                                    }
  259.                                    else
  260.                                    {
  261.                                        //向下滚
  262.                                        if(distance/Get_time>1000)
  263.                                        {
  264.                                             //向下甩
  265.                                             Uart_Printf(0,"n...Go to bottom fastly...");
  266.                                             
  267.                                        }
  268.                                        else Uart_Printf(0,"n...Go to bottom...");
  269.                                        ScrollMenu(-distance/1000);
  270.                                        
  271.                                     }
  272.                           
  273.                                 }
  274.                              }
  275.                              else
  276.                              {
  277.                                   if(Y<0)
  278.                                   {
  279.                                       if(abs(Y)<=abs(X))
  280.                                       {
  281.                                              //向左滚
  282.                                              Uart_Printf(0,"n...Go to left...");
  283.                                       }
  284.                                       else
  285.                                       {
  286.                                              //向上滚
  287.                                             if(distance/Get_time>1000)
  288.                                             {
  289.                                                 //向上甩
  290.                                                 Uart_Printf(0,"n...Go to top fastly...");
  291.                                             
  292.                                             }
  293.                                             
  294.                                             else {Uart_Printf(0,"n...Go to top...");
  295.                                             ScrollMenu(distance/1000);}
  296.                                       }
  297.                                    }
  298.                                    else
  299.                                    {
  300.                                        if(Y<=abs(X))
  301.                                        {
  302.                                              //向左滚
  303.                                              Uart_Printf(0,"n...Go to left...");
  304.                                        }
  305.                                        else
  306.                                        {
  307.                                                  //向下滚
  308.                                                 if(distance/Get_time>1000)
  309.                                                 {
  310.                                                       //向下甩
  311.                                                       Uart_Printf(0,"n...Go to bottom fastly...");
  312.                                             
  313.                                                 }
  314.                                               
  315.                                                 else {
  316.                                                  Uart_Printf(0,"n...Go to bottom...");
  317.                                                  ScrollMenu(-distance/1000);
  318.                                                  }
  319.                                        }
  320.                           
  321.                                    }
  322.                               }
  323.                         }
  324.                         
  325.                         
  326.                         
  327.                 break;
  328.                 case  TCHSCR_ACTION_UP:
  329.                     scrpoint2[0].x=0;
  330.                     scrpoint2[0].y=0;
  331.                     scrpoint2[1].x=0;
  332.                     scrpoint2[1].y=0;
  333.                
  334.                     break;
  335.                     
  336.                        
  337.                    
  338. }
  339.    break;
  340.   
  341.   
  342.   
  343.   
  344.   
  345.    case OSM_KEY:
  346.    Flag++;
  347.    if(Flag==2)
  348.    {
  349.         Uart_Printf(0,"keyn");
  350.             if((pMsg->WParam)=='+')//表示按两个键
  351.         {
  352.             KeyStatue[0]=1;   
  353.             KeyStatue[1]=1;     //对按键进行标记
  354.             Uart_Printf(0,"touch = + ");
  355.            
  356.                                                
  357.                                                          
  358.         }
  359.         else if(KeyStatue[0]==1 || KeyStatue[1]==1)         
  360.         {
  361.       
  362.           //   count++;
  363.              
  364.              if(KeyStatue[0]==1)
  365.              {
  366.                 KeyName2[0]=pMsg->WParam;
  367.                 
  368.      
  369.                 KeyStatue[0]=0;
  370.                 Uart_Printf(0,"KeyName2[0]======%cn",KeyName2[0]);
  371.                 
  372.                 
  373.              }
  374.              
  375.              else //if(count>2)
  376.              {
  377.         
  378.                 KeyName2[1]=pMsg->WParam;
  379.                 Uart_Printf(0,"KeyName2[1]======%cn",KeyName2[1]);
  380.          
  381.                 KeyName2[2]=0;
  382.                 Uart_Printf(0,"KeyName2======%sn",KeyName2);
  383.        
  384.                 KeyStatue[1]=0;
  385.             //    count=0;
  386.                 
  387.              }
  388.           
  389.              if(KeyStatue[0]==0 && KeyStatue[1]==0)
  390.              {
  391.                  if(strcmp(KeyName2,KeyName[0])==0)
  392.                  {
  393.                       Uart_Printf(0,"touch=10n");
  394.                       doubleFlag =0;
  395.                       choiceIndex = 9;
  396.                       if(getState(choiceIndex) == 0){
  397.                           Select(choiceIndex);
  398.                           Mark(choiceIndex);
  399.                           }
  400.                           else {
  401.                           Cancal(choiceIndex);
  402.                           CancalMark(choiceIndex);
  403.                           }
  404.                       
  405.                     
  406.                      
  407.                  }else
  408.                  if(strcmp(KeyName2,KeyName[1])==0)
  409.                  {
  410.                      
  411.                       Uart_Printf(0,"touch=11n");
  412.                       doubleFlag =0;
  413.                       choiceIndex = 10;
  414.                       if(getState(choiceIndex) == 0){
  415.                           Select(choiceIndex);
  416.                           Mark(choiceIndex);
  417.                           }
  418.                           else {
  419.                           Cancal(choiceIndex);
  420.                           CancalMark(choiceIndex);
  421.                           }
  422.                       
  423.                      
  424.                  }else
  425.                   if(strcmp(KeyName2,KeyName[2])==0)
  426.                  {
  427.                       Uart_Printf(0,"touch=12n"); 
  428.                       doubleFlag =0;
  429.                       choiceIndex = 11;
  430.                       if(getState(choiceIndex) == 0){
  431.                           Select(choiceIndex);
  432.                           Mark(choiceIndex);
  433.                           }
  434.                           else {
  435.                           Cancal(choiceIndex);
  436.                           CancalMark(choiceIndex);
  437.                           }
  438.                       
  439.                  }else
  440.                   if(strcmp(KeyName2,KeyName[3])==0)
  441.                  {
  442.                       Uart_Printf(0,"touch=13n");
  443.                       doubleFlag =0;
  444.                       choiceIndex = 12;
  445.                       if(getState(choiceIndex) == 0){
  446.                           Select(choiceIndex);
  447.                           Mark(choiceIndex);
  448.                           }
  449.                           else {
  450.                           Cancal(choiceIndex);
  451.                           CancalMark(choiceIndex);
  452.                           }
  453.                      
  454.                      
  455.                  }else
  456.                  if(strcmp(KeyName2,KeyName[4])==0)
  457.                  {
  458.                       Uart_Printf(0,"touch=14n");
  459.                       doubleFlag =0;
  460.                       choiceIndex = 13;
  461.                       if(getState(choiceIndex) == 0){
  462.                           Select(choiceIndex);
  463.                           Mark(choiceIndex);
  464.                           }
  465.                           else {
  466.                           Cancal(choiceIndex);
  467.                           CancalMark(choiceIndex);
  468.                           }
  469.                       
  470.                      
  471.                  }else
  472.                  if(strcmp(KeyName2,KeyName[5])==0)
  473.                  {
  474.                       Uart_Printf(0,"touch=15n");
  475.                       doubleFlag =0;
  476.                       choiceIndex = 14;
  477.                       if(getState(choiceIndex) == 0){
  478.                           Select(choiceIndex);
  479.                           Mark(choiceIndex);
  480.                           }
  481.                           else {
  482.                           Cancal(choiceIndex);
  483.                           CancalMark(choiceIndex);
  484.                           }
  485.                       
  486.                      
  487.                  }else
  488.                  if(strcmp(KeyName2,KeyName[6])==0)
  489.                  {
  490.                       Uart_Printf(0,"touch=16n");
  491.                       doubleFlag =0;
  492.                       choiceIndex = 15;
  493.                       if(getState(choiceIndex) == 0){
  494.                           Select(choiceIndex);
  495.                           Mark(choiceIndex);
  496.                           }
  497.                           else {
  498.                           Cancal(choiceIndex);
  499.                           CancalMark(choiceIndex);
  500.                           }
  501.                       
  502.                      
  503.                  }else
  504.                  if(strcmp(KeyName2,KeyName[7])==0)
  505.                  {
  506.                       Uart_Printf(0,"touch=17n");
  507.                       doubleFlag =0;
  508.                       choiceIndex = 16;
  509.                       if(getState(choiceIndex) == 0){
  510.                           Select(choiceIndex);
  511.                           Mark(choiceIndex);
  512.                           }
  513.                           else {
  514.                           Cancal(choiceIndex);
  515.                           CancalMark(choiceIndex);
  516.                           }
  517.                       
  518.                      
  519.                  }else
  520.                  if(strcmp(KeyName2,KeyName[8])==0)
  521.                  {
  522.                       Uart_Printf(0,"touch=18n");
  523.                       doubleFlag =0;
  524.                       choiceIndex = 17;
  525.                       if(getState(choiceIndex) == 0){
  526.                           Select(choiceIndex);
  527.                           Mark(choiceIndex);
  528.                           }
  529.                           else {
  530.                           Cancal(choiceIndex);
  531.                           CancalMark(choiceIndex);
  532.                           }
  533.                       
  534.                      
  535.                  }else
  536.                  if(strcmp(KeyName2,KeyName[9])==0)
  537.                  {
  538.                       Uart_Printf(0,"touch=19n");
  539.                       doubleFlag =0;
  540.                       choiceIndex = 18;
  541.                       if(getState(choiceIndex) == 0){
  542.                           Select(choiceIndex);
  543.                           Mark(choiceIndex);
  544.                           }
  545.                           else {
  546.                           Cancal(choiceIndex);
  547.                           CancalMark(choiceIndex);
  548.                           }
  549.                       
  550.                      
  551.                  }else
  552.                  if(strcmp(KeyName2,KeyName[10])==0)
  553.                  {
  554.                       Uart_Printf(0,"touch=20n");
  555.                       doubleFlag =0;
  556.                       choiceIndex = 19;
  557.                       if(getState(choiceIndex) == 0){
  558.                           Select(choiceIndex);
  559.                           Mark(choiceIndex);
  560.                           }
  561.                           else {
  562.                           Cancal(choiceIndex);
  563.                           CancalMark(choiceIndex);
  564.                           }
  565.                       
  566.                      
  567.                  }
  568.                  else
  569.                  if(strcmp(KeyName2,KeyName[11])==0)
  570.                  {
  571.                       Uart_Printf(0,"touch=21n");
  572.                       doubleFlag =0;
  573.                       choiceIndex = 20;
  574.                       if(getState(choiceIndex) == 0){
  575.                           Select(choiceIndex);
  576.                           Mark(choiceIndex);
  577.                           }
  578.                           else {
  579.                           Cancal(choiceIndex);
  580.                           CancalMark(choiceIndex);
  581.                           }
  582.                       
  583.                      
  584.                  }else
  585.                  if(strcmp(KeyName2,KeyName[12])==0)
  586.                  {
  587.                       Uart_Printf(0,"touch=22n");
  588.                       doubleFlag =0;
  589.                       choiceIndex = 21;
  590.                       if(getState(choiceIndex) == 0){
  591.                           Select(choiceIndex);
  592.                           Mark(choiceIndex);
  593.                           }
  594.                           else {
  595.                           Cancal(choiceIndex);
  596.                           CancalMark(choiceIndex);
  597.                           }
  598.                       
  599.                      
  600.                  }else
  601.                  if(strcmp(KeyName2,KeyName[13])==0)
  602.                  {
  603.                       Uart_Printf(0,"touch=23n");
  604.                       doubleFlag =0;
  605.                       choiceIndex = 22;
  606.                       if(getState(choiceIndex) == 0){
  607.                           Select(choiceIndex);
  608.                           Mark(choiceIndex);
  609.                           }
  610.                           else {
  611.                           Cancal(choiceIndex);
  612.                           CancalMark(choiceIndex);
  613.                           }
  614.                       
  615.                      
  616.                  }else
  617.                  if(strcmp(KeyName2,KeyName[14])==0)
  618.                  {
  619.                       Uart_Printf(0,"touch=24n");
  620.                       doubleFlag =0;
  621.                       choiceIndex = 23;
  622.                       if(getState(choiceIndex) == 0){
  623.                           Select(choiceIndex);
  624.                           Mark(choiceIndex);
  625.                           }
  626.                           else {
  627.                           Cancal(choiceIndex);
  628.                           CancalMark(choiceIndex);
  629.                           }
  630.                       
  631.                      
  632.                  }else
  633.                  if(strcmp(KeyName2,KeyName[15])==0)
  634.                  {
  635.                       Uart_Printf(0,"touch=25n");
  636.                       doubleFlag =0;
  637.                       choiceIndex = 24;
  638.                       if(getState(choiceIndex) == 0){
  639.                           Select(choiceIndex);
  640.                           Mark(choiceIndex);
  641.                           }
  642.                           else {
  643.                           Cancal(choiceIndex);
  644.                           CancalMark(choiceIndex);
  645.                           }
  646.                       
  647.                      
  648.                  }
  649.                //  doubleFlag =0;
  650.                Flag=0;
  651.          
  652.                 
  653.              }
  654.         }
  655.         else if(KeyStatue[0]==0 && KeyStatue[1]==0 )
  656.         {
  657.         
  658.            switch(pMsg->WParam)
  659.            {
  660.               case '1':
  661.              /* if(doubleFlag < 2)
  662.                    doubleFlag ++;
  663.                   else{*/
  664.                    choiceIndex = 0;
  665.                       if(getState(choiceIndex) == 0){
  666.                           Select(choiceIndex);
  667.                           Mark(choiceIndex);
  668.                           }
  669.                           else {
  670.                           Cancal(choiceIndex);
  671.                           CancalMark(choiceIndex);
  672.                           }
  673.                    Uart_Printf(0,"touch=1n");break;
  674.               //     }
  675.                    
  676.               case '2':
  677.               /*    if(doubleFlag < 2)
  678.                    doubleFlag ++;
  679.                   else{*/
  680.                   choiceIndex = 1;
  681.                       if(getState(choiceIndex) == 0){
  682.                           Select(choiceIndex);
  683.                           Mark(choiceIndex);
  684.                           }
  685.                           else {
  686.                           Cancal(choiceIndex);
  687.                           CancalMark(choiceIndex);
  688.                           }
  689.                    Uart_Printf(0,"touch=2n");break;
  690.                    //}
  691.               case '3':
  692.        /*       if(doubleFlag < 2)
  693.                    doubleFlag ++;
  694.                   else{*/
  695.                   choiceIndex = 2;
  696.                       if(getState(choiceIndex) == 0){
  697.                           Select(choiceIndex);
  698.                           Mark(choiceIndex);
  699.                           }
  700.                           else {
  701.                           Cancal(choiceIndex);
  702.                           CancalMark(choiceIndex);
  703.                           }
  704.                   Uart_Printf(0,"touch=3n");break;
  705.                   //}
  706.               case '4':
  707.             /* if(doubleFlag < 2)
  708.                    doubleFlag ++;
  709.                   else{*/
  710.                   choiceIndex = 3;
  711.                       if(getState(choiceIndex) == 0){
  712.                           Select(choiceIndex);
  713.                           Mark(choiceIndex);
  714.                           }
  715.                           else {
  716.                           Cancal(choiceIndex);
  717.                           CancalMark(choiceIndex);
  718.                           }
  719.                   Uart_Printf(0,"touch=4n");break;
  720.                   //}
  721.               case '5':
  722.              /* if(doubleFlag < 2)
  723.                    doubleFlag ++;
  724.                   else{*/
  725.                   choiceIndex = 4;
  726.                       if(getState(choiceIndex) == 0){
  727.                           Select(choiceIndex);
  728.                           Mark(choiceIndex);
  729.                           }
  730.                           else {
  731.                           Cancal(choiceIndex);
  732.                           CancalMark(choiceIndex);
  733.                           }
  734.                   Uart_Printf(0,"touch=5n");break;
  735.                   //}
  736.               case '6':
  737.              /* if(doubleFlag < 2)
  738.                    doubleFlag ++;
  739.                   else{*/
  740.                   choiceIndex = 5;
  741.                       if(getState(choiceIndex) == 0){
  742.                           Select(choiceIndex);
  743.                           Mark(choiceIndex);
  744.                           }
  745.                           else {
  746.                           Cancal(choiceIndex);
  747.                           CancalMark(choiceIndex);
  748.                           }
  749.                   Uart_Printf(0,"touch=6n");break;
  750.                   //}
  751.               case '7':
  752.              /* if(doubleFlag < 2)
  753.                    doubleFlag ++;
  754.                   else{*/
  755.                   choiceIndex = 6;
  756.                       if(getState(choiceIndex) == 0){
  757.                           Select(choiceIndex);
  758.                           Mark(choiceIndex);
  759.                           }
  760.                           else {
  761.                           Cancal(choiceIndex);
  762.                           CancalMark(choiceIndex);
  763.                           }
  764.                   Uart_Printf(0,"touch=7n");break;
  765.                   //}
  766.               case '8':
  767.              /* if(doubleFlag < 2)
  768.                    doubleFlag ++;
  769.                   else{*/
  770.                   choiceIndex = 7;
  771.                       if(getState(choiceIndex) == 0){
  772.                           Select(choiceIndex);
  773.                           Mark(choiceIndex);
  774.                           }
  775.                           else {
  776.                           Cancal(choiceIndex);
  777.                           CancalMark(choiceIndex);
  778.                           }
  779.                   Uart_Printf(0,"touch=8n");break; 
  780.                   //}
  781.               case '9':
  782.              /* if(doubleFlag < 2)
  783.                    doubleFlag ++;
  784.                   else{*/
  785.                   choiceIndex = 8;
  786.                       if(getState(choiceIndex) == 0){
  787.                           Select(choiceIndex);
  788.                           Mark(choiceIndex);
  789.                           }
  790.                           else {
  791.                           Cancal(choiceIndex);
  792.                           CancalMark(choiceIndex);
  793.                           }
  794.                   Uart_Printf(0,"touch=9n");break;
  795.                   //}
  796.           
  797.               default:
  798.                   break;
  799.               
  800.              
  801.                   
  802.                   
  803.           }
  804.          
  805.        }
  806.        ShowNum(450,430,getTotalPrice());
  807.        Flag = 0;
  808.        break;
  809.        }
  810.                      
  811.         }
  812.            
  813. DeleteMessage(pMsg);//删除消息
  814.        // OSTimeDly(10);
  815. }
  816. //-------------------------------
  817. for(;;){
  818. }
  819. }
  820. void star_Task(void *Id){
  821. Uart_Printf(0,"star_Task start!");
  822. LCD_ChangeMode(DspGraMode);
  823. start1BMP = malloc(2 * 640 * 480);
  824. LoadBMP(start1BMP,"/sys/ucos/e-menu/star1.bmp",640,480);
  825. pbuf = start1BMP;
  826. kLCD_Refresh();
  827. for(;;){
  828. OSTimeDly(10000);
  829. }
  830. }
  831. void test_Task(void *Id){
  832. int i = 0;
  833. Uart_Printf(0,"test_Task start!");
  834. startBMP = malloc(2 * 640 * 480);
  835. bootBMP[0] = malloc(2 * 72 * 32);
  836. bootBMP[1] = malloc(2 * 72 * 32);
  837. bootBMP[2] = malloc(2 * 72 * 32);
  838. bootBMP[3] = malloc(2 * 72 * 32);
  839. LoadBMP(startBMP,"/sys/ucos/e-menu/start.bmp",640,480);
  840. pbuf = startBMP;
  841. LoadBMP(bootBMP[0],"/sys/ucos/e-menu/boot0.bmp",72,30);
  842. LoadBMP(bootBMP[1],"/sys/ucos/e-menu/boot1.bmp",72,30);
  843. LoadBMP(bootBMP[2],"/sys/ucos/e-menu/boot2.bmp",72,30);
  844. LoadBMP(bootBMP[3],"/sys/ucos/e-menu/boot3.bmp",72,30);
  845. kLCD_Refresh();
  846. for(;bootFlag == 1;){
  847. PaintBMP(pbuf,bootBMP[i],437,247,72,30);
  848. kLCD_Part_Refresh(437,247,509,277);
  849. i++;
  850. if(i == 4)i = 0;
  851. OSTimeDly(200);
  852. }
  853. for(;;){
  854. OSTimeDly(10000);
  855. }
  856. }