s_shutdown.c

来自「dragon ball vz328 上的一个例子程序。 用于做手持仪表用。」· C语言 代码 · 共 96 行

C
96
字号
/*******************************************************************************
   S_start.c  by Nie 04/5/03 
   for start sub
********************************************************************************/

#ifndef VZ328
#define VZ328
#endif
#include <stdlib.h>         
#include <stdio.h>          
#include <M68328.h>
#include <ppsm.h>
#include <errors.h>
#include <proto.h>
#include "sample.h"
#include "main.h"
#include "tools.h"
#include "Sunray.h"

void ShutDownApp(void)
{

U32             startIconId, shutdownIconId, returnIconId; 
U32             size;
U32             id;
U16             i, j;           /*  Temp x, y co-ordinate */
S16             xSrc, ySrc, xDest, yDest;
P_U16           inData;  
U8              tmpVal;
TEXT  ThankTxt[]={'谢','谢','使','用','!',0};
TEXT  StartIconTxt[]={'注','销',0};
TEXT  ShutDownTxt[] = {'关','机',0};
TEXT  ReturnTxt[] = {'返','回',0};
TEXT  ProVerTxt[] = {'程','序','版','本',':','4.','4.','0.','1 ',0};
TEXT  CommTypeTxt[] = {'通','信','方','式',':','无','线','96','00','BP','SN',0};
TEXT  ModifyDateTxt[] = {'修','改','时','间',':','20','05','/1','0/','10',0};

	ClearScreen(WHITE);
	if (PutString270((P_TEXT)ProVerTxt, 40, 40, 16, 16) !=PPSM_OK) rv=PPSM_ERROR; 
	if (PutString270((P_TEXT)CommTypeTxt, 40, 70, 16, 16) !=PPSM_OK) rv=PPSM_ERROR;
    if (PutString270((P_TEXT)ModifyDateTxt, 40, 100, 16, 16) !=PPSM_OK) rv=PPSM_ERROR;
	if (PutString270((P_TEXT)ThankTxt, 40, 200, 16, 16) !=PPSM_OK) rv=PPSM_ERROR; 
	if (TextButton(&startIconId, GB_NORMAL_FONT,(P_TEXT)StartIconTxt, 165, 190, 70, 35, 1)
		!= PPSM_OK) rv=PPSM_ERROR;
	if (TextButton(&shutdownIconId, GB_NORMAL_FONT,(P_TEXT)ShutDownTxt, 165, 230, 70, 35, 1)
		!= PPSM_OK) rv=PPSM_ERROR;
	if (TextButton(&returnIconId, GB_NORMAL_FONT,(P_TEXT)ReturnTxt, 165, 270, 70, 35, 1)
		!= PPSM_OK) rv=PPSM_ERROR;
    PreVoltageProcess();
	CkeckCutButtonFlag=0;
    ElWorkCount=0;
	SetPeriod(RTC_PERI_SECOND);
	while(1)
	{
		switch(IrptGetData((P_U32)&id, (P_U32*)&inData, (P_U32)&size))
		{
			case IRPT_RTC:
                tmpVal=ReadPenIRQFlagValue();
                if (tmpVal==0) {
                    VoltageProcess();
                }
				Elcheck();
				CutDownCheck(); 
				break;
			case IRPT_ICON:                
				if (ActiveAreaRead(id,&xSrc,&ySrc,&xDest,&yDest) 
					!= PPSM_OK) rv = PPSM_ERROR;        
				if (InvRec(xSrc+1,ySrc+1,(xDest-(xSrc+1)),(yDest-(ySrc+1)))
					!= PPSM_OK) rv = PPSM_ERROR;                              
				if (*inData == PPSM_ICON_PEN_UP)
				{
                    EL_Open();
					BUZZER_ON();
					if (id==startIconId)
					{
						asm("    JSR START");
						break;
					}
					else if(id == shutdownIconId)
					{
						POWER_OFF();//关闭电源
                        asm("    JSR START");
						break;
					}
					else if(id == returnIconId)
					{
						if (AdvMessageDelete(ShutDownAppID, IRPT_ICON, -1) != PPSM_OK) 
                            rv = PPSM_ERROR;
						if (AdvSendMessage(MenuTaskAppID, NULL, SWAP_TASK) != PPSM_OK) 
                            rv= PPSM_ERROR;
						break;
					}	
				}   
		}
	}                          
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?