📄 testatv.c
字号:
/*************************************************************************
*
* Copyright (C) Asic Center. 2001
* All Rights Reserved
*
* Filename : testcode.c
* Function : Some tasks for testing system prototype, such as SHELL, TIMER
* TASK, IDLE TASK, TASK A,B,C, and so on.
* Revision :
* 2001/10/9 Pessia Create this file
*
************************************************************************/
#include <stdio.h>
#include <string.h>
#include <ppsm.h>
void shell_task(void);
void a_task(void);
void b_task(void);
void c_task(void);
void TestAtvTrans(void);
/********************************************************************
* Function shell_task()
* param in: void
* param out: void
* description: Shell Task
* In test, we just add 1 or 2 icon on the screen,
* when you push it, shell task will send a message to
* system task to start a special task.
********************************************************************/
void shell_task(void)
{
MSG msg;
int i=0;
char tmp[2]="+";
char tmp2[40];
int x,y,len;
int sx,sy,mx,my;
gpcSetColor(0xff8800);
gpcDrawText(10,2,"TestAtv",13);
/* test code for activearea */
TestAtvTrans();
while(1)
{
RecvMessage(&msg, -1);
switch(msg.message)
{
case SM_KEYDOWN :
case SM_KEYREPEAT :
case SM_KEYUP :
/*
tmp[0] = msg.wparam - 0 + '0';
tmp[1] = 0;
gpcDrawText(5,30,tmp,1);
sprintf(tmp2, "%ld",passedticks);
len = strlen(tmp2);
gpcDrawText(5,120,tmp2,len);
*/
break;
case IRPT_ICON :
{
switch(msg.lparam)
{
case PPSM_ICON_TOUCH :
gpcSetColor(0xfffff);
gpcFillRect(5,90,55,110);
gpcSetColor(0xff8800);
gpcDrawText(5,90,"Touch",5);
break;
case PPSM_ICON_DRAG :
gpcSetColor(0xfffff);
gpcFillRect(55,90,110,110);
gpcSetColor(0xff8800);
gpcDrawText(55,90,"Drag",4);
break;
case PPSM_ICON_PEN_UP :
gpcSetColor(0xfffff);
gpcFillRect(5,110,55,130);
gpcSetColor(0xff8800);
gpcDrawText(5,110,"PenUp",5);
break;
case PPSM_ICON_DRAG_UP :
gpcSetColor(0xfffff);
gpcFillRect(55,110,110,130);
gpcSetColor(0xff8800);
gpcDrawText(55,110,"DragUp",6);
break;
default:
break;
}
break;
}
default:
break;
}
}
}
/********************************************************************
* Function a_task()
* param in: void
* param out: void
* description: Task A
********************************************************************/
void a_task(void)
{
}
/********************************************************************
* Function b_task()
* param in:
* param out:
* description: Task B
********************************************************************/
void b_task(void)
{
}
/********************************************************************
* Function IdleHandler()
* param in:
* param out:
* description: Task C
********************************************************************/
void c_task(void)
{
}
typedef struct _track
{
U16 x;
U16 y;
U16 msg;
}TRACK;
#define ENDTEST 1
#define SKIP 2
/* test code for activearea */
void TestAtvTrans(void)
{
MSG rosmsg, ppsmsg;
int i;
int x,y;
U16 message;
U32 lparam;
U32 areaId_a,areaId_b,areaId_c,areaId_d;
U32 areaId_a2,areaId_b2,areaId_c2,areaId_d2;
TRACK t[]= {{50, 20, SM_PENDOWN},
{40, 20, SM_PENMOVE},
{38, 20, SM_PENUP},
{0, 0, SKIP},
{50, 15, SM_PENDOWN},
{50, 17, SM_PENMOVE},
{50, 18, SM_PENUP},
{0, 0, SKIP},
{50, 10, SM_PENMOVE},
{50, 11, SM_PENMOVE},
{50, 15, SM_PENMOVE},
{50, 31, SM_PENMOVE},
{50, 35, SM_PENMOVE},
{50, 51, SM_PENMOVE},
{50, 55, SM_PENMOVE},
{50, 61, SM_PENMOVE},
{50, 65, SM_PENMOVE},
{50, 71, SM_PENMOVE},
{50, 75, SM_PENMOVE},
{50, 91, SM_PENMOVE},
{0, 0, ENDTEST}
};
ActiveAreaEnable(&areaId_a, INPUT_AREA, CONTINUOUS_MODE, 40, 10, 80, 50);
gpcDrawRect(40, 10, 80, 50);
ActiveAreaEnable(&areaId_b, INPUT_AREA, CONTINUOUS_MODE, 40, 30, 80, 70);
gpcDrawRect(40, 30, 80, 70);
ActiveAreaEnable(&areaId_c, ICON_AREA, STROKE_MODE, 40, 60, 60, 80);
gpcDrawRect(40, 60, 60, 80);
ActiveAreaEnable(&areaId_d, ICON_AREA, STROKE_MODE, 40, 70, 60, 90);
gpcDrawRect(40, 70, 60, 90);
ActiveListPush();
ActiveAreaEnable(&areaId_a2, INPUT_AREA, CONTINUOUS_MODE, 40, 10, 80, 50);
gpcDrawRect(40, 10, 80, 50);
ActiveAreaEnable(&areaId_b2, INPUT_AREA, CONTINUOUS_MODE, 40, 30, 80, 70);
gpcDrawRect(40, 30, 80, 70);
ActiveAreaEnable(&areaId_c2, ICON_AREA, STROKE_MODE, 40, 60, 60, 80);
gpcDrawRect(40, 60, 60, 80);
ActiveAreaEnable(&areaId_d2, ICON_AREA, STROKE_MODE, 40, 70, 60, 90);
gpcDrawRect(40, 70, 60, 90);
TSTATV:
for(i=0;;i++)
{
if(t[i].msg == SKIP) i++;
if(t[i].msg == ENDTEST) break;
rosmsg.message = t[i].msg;
((POINT *)&rosmsg.lparam)->x = t[i].x;
((POINT *)&rosmsg.lparam)->y = t[i].y;
SysTransMsg(&rosmsg, gSysTcbTbl[2].atvcb, &ppsmsg);
message = ppsmsg.message;
lparam = ppsmsg.lparam;
}
ActiveListPop();
//goto TSTATV;
ActiveAreaToFront(areaId_a);
ActiveAreaPosition(areaId_a,40,10,80,55);
goto TSTATV;
ActiveAreaDisable(areaId_a);
ActiveAreaDisable(areaId_b);
ActiveAreaDisable(areaId_c);
ActiveAreaDisable(areaId_d);
ActiveAreaDisable(areaId_a2);
ActiveAreaDisable(areaId_b2);
ActiveAreaDisable(areaId_c2);
ActiveAreaDisable(areaId_d2);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -