📄 s_sysset.c
字号:
#ifndef VZ328
#define VZ328
#endif
#define SETYEARMODE 1
#define SETMONTHMODE 2
#define SETDAYMODE 3
#define SETHOURMODE 4
#define SETMINUTEMODE 5
#define SETSECONDMODE 6
#include <stdlib.h>
#include <M68328.h>
#include <ppsm.h>
#include <errors.h>
#include <proto.h>
#include "sample.h"
#include "tools.h"
#include "main.h"
#include "Sunray.h"
void SystemSetApp(void)
{
P_U16 inData;
U32 size, id;
S16 xSrc, ySrc, xDest, yDest;
U32 SetTimeId, SetGreyId, SetScreenId, ReturnId;
TEXT SetTimeTxt[]={'设','置','时','间',0};
TEXT SetGreyTxt[]={'调','节','辉','度',0};
TEXT SetSCreenTxt[]={'屏','幕','校','准',0};
TEXT ReturnTxt[]={'返','回',0};
ReStartFlag:
*(P_U32)0xFFFFF304 &=0xEFFFFF;
ClearScreen(WHITE);
if (TextButton(&SetTimeId, GB_NORMAL_FONT,(P_TEXT)SetTimeTxt, 40, 40, 160, 40, 1)
!= PPSM_OK) rv=PPSM_ERROR;
if (TextButton(&SetGreyId, GB_NORMAL_FONT,(P_TEXT)SetGreyTxt, 40, 90, 160, 40, 1)
!= PPSM_OK) rv=PPSM_ERROR;
if (TextButton(&SetScreenId, GB_NORMAL_FONT,(P_TEXT)SetSCreenTxt, 40, 140, 160, 40, 1)
!= PPSM_OK) rv=PPSM_ERROR;
if (TextButton(&ReturnId, GB_NORMAL_FONT,(P_TEXT)ReturnTxt, 40, 240, 160, 40, 1)
!= PPSM_OK) rv=PPSM_ERROR;
CkeckCutButtonFlag=0;
ElWorkCount=0;
SetPeriod(RTC_PERI_SECOND);
while (1) {
switch (IrptGetData((P_U32)&id, (P_U32*)&inData, (P_U32)&size)) {
case IRPT_RTC:
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==SetTimeId) {
if (AdvMessageDelete(SystemSetAppID, IRPT_ICON, -1)
!=PPSM_OK) rv = PPSM_ERROR;
if (AdvSendMessage(SetTimeAppID, NULL, SWAP_TASK)
!= PPSM_OK) rv= PPSM_ERROR;
break;
} else if (id==SetGreyId) {
if (AdvMessageDelete(SystemSetAppID, IRPT_ICON, -1)
!=PPSM_OK) rv = PPSM_ERROR;
if (AdvSendMessage(SetGreyAppID, NULL, SWAP_TASK)
!= PPSM_OK) rv= PPSM_ERROR;
break;
} else if (id==SetScreenId) {
AppSwap(FALSE);
if (MessageDelete(-1)!= PPSM_OK) rv= PPSM_ERROR;
if (CalibratePen1(TRUE) !=PPSM_OK) rv=PPSM_ERROR;
AppSwap(TRUE);
goto ReStartFlag;
} else if (id==ReturnId) {
if (AdvMessageDelete(SystemSetAppID, IRPT_ICON, -1)
!=PPSM_OK) rv = PPSM_ERROR;
if (AdvSendMessage(MenuTaskAppID, NULL, SWAP_TASK)
!= PPSM_OK) rv= PPSM_ERROR;
break;
}
}
default:
break;
}
}
}
void SetGreyApp(void)
{
P_U16 inData;
U32 size, id;
S16 xSrc, ySrc, xDest, yDest;
U8 i;
U32 m;
U16 j;
U32 temp;
U32 addIconId,discIconId,numIconId,outpageIconId;
U8 count;
TEXT screenbrignttxt[]={'屏','幕','辉','度','调','节','0','~','7',0};
TEXT addtxt[]={'增','加',0};
TEXT dissubtxt[]={'减','少',0};
TEXT Outpage[]={'返','回',0};
ClearScreen(WHITE);
Typing(GB_NORMAL_FONT, REPLACE_STYLE, BLACK, 50, 50, (P_U8)screenbrignttxt);
if (TextButton(&addIconId, GB_NORMAL_FONT,(P_TEXT)addtxt, 100,80, 50, 30, 1)
!= PPSM_OK) rv=PPSM_ERROR;
if (TextButton(&discIconId, GB_NORMAL_FONT,(P_TEXT)dissubtxt, 180,80, 50, 30, 1)
!= PPSM_OK) rv=PPSM_ERROR;
if (TextButton(&outpageIconId, GB_NORMAL_FONT,(P_TEXT)Outpage, 70, 260, 100, 40, 1)
!= PPSM_OK) rv=PPSM_ERROR;
count=GetBrightless();
for (j=0;j<8;j++) {
SunrayBrighttest(j);
if ((j%2)==0 ) {
LEDHealthOn();
} else {
LEDHealthOff();
}
for (temp=0;temp<0xFFFF;temp++);
}
for (j=0;j<8;j++) {
SunrayBrighttest(7-j);
if ((j%2)==0 ) {
LEDHealthOn();
} else {
LEDHealthOff();
}
for (temp=0;temp<0xFFFF;temp++);
}
SunrayBrighttest(count);
count=GetBrightless();
CkeckCutButtonFlag=0;
ElWorkCount=0;
SetPeriod(RTC_PERI_SECOND);
startnum:
NumButton(&numIconId,count,GB_NORMAL_FONT,160, 85, 20, 25, 0,1);
while (1) {
switch (IrptGetData((P_U32)&id, (P_U32*)&inData, (P_U32)&size)) {
case IRPT_RTC:
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==discIconId) {
if (count>0) {
count--;
SunrayBrightless(count);
goto startnum;
}
break;
} else if (id==addIconId) {
if (count<8) {
count++;
SunrayBrightless(count);
goto startnum;
}
break;
} else if (id==outpageIconId) {
if (AdvMessageDelete(SetGreyAppID, IRPT_ICON, -1)
!=PPSM_OK) rv = PPSM_ERROR;
if (AdvSendMessage(SystemSetAppID, NULL, SWAP_TASK)
!= PPSM_OK) rv= PPSM_ERROR;
}
}
}
}
}
void SetTimeApp(void)
{
U16 read_time[7],set_year_time;
U8 set_time[8];
P_U16 inData;
U32 size, id;
S16 xSrc, ySrc, xDest, yDest;
U32 okIconId,canIconId,temp;
U32 yearId,monthId,dayId,hourId,minuteId,secondId;
U8 yeartime[8],monthtime[8],daytime[8],hourtime[8],minutetime[8],secondtime[8];
U8 yearnum,monthnum,daynum,hournum,minutenum,secondnum;
U32 setdateflag;
U8 keyval,StarNum,Errorpass;
U8 temppass[12];
U8 inpassflag;
U8 rtcflag;
U16 gCursorXPos;
U16 gCursorYPos,tmpval;
U8 i,j;
TEXT currenttime[]={'当','前','PD','A ','的','时','间','为',':',0};
TEXT okTxt[]={'确','定',0};
TEXT canTxt[]={'取','消',0};
for (i=0;i<8;i++) {
yeartime[i]=0;
monthtime[i]=0;
daytime[i]=0;
hourtime[i]=0;
minutetime[i]=0;
secondtime[i]=0;
set_time[i]=0;
}
set_year_time=0;
yearnum=0;
monthnum=0;
daynum=0;
hournum=0;
minutenum=0;
secondnum=0;
setdateflag=0;
FirstGetData(read_time);
AnyGetTime(read_time);
DECtoTEXT(yeartime, read_time[0],4);
DECtoTEXT(monthtime, read_time[1],2);
DECtoTEXT(daytime, read_time[2],2);
DECtoTEXT(hourtime, read_time[3],2);
DECtoTEXT(minutetime, read_time[4],2);
DECtoTEXT(secondtime, read_time[5],2);
ClearScreen(WHITE);
CursorSetPos( 90,183);
CursorSetStatus(PPSM_CURSOR_ON);
CursorSetStatus(PPSM_CURSOR_REVERSED);
CursorInit(16,8);
CursorSetBlink(5);
KeyPadFunction_letter (150);
if (TextButton(&okIconId,GB_NORMAL_FONT,(P_TEXT)okTxt,40, 284, 60, 35, 1)
!=PPSM_OK) rv=PPSM_ERROR;
if (TextButton(&canIconId,GB_NORMAL_FONT,(P_TEXT)canTxt,140, 284, 60, 35, 1)
!=PPSM_OK) rv=PPSM_ERROR;
Typing(GB_NORMAL_FONT, REPLACE_STYLE, BLACK, 40, 40, (P_U8)currenttime);
DisplayTimeAn(read_time);
ActiveAreaEnable((P_U32)&yearId ,ICON_AREA ,CONTINUOUS_MODE ,90,158,108,190);
ActiveAreaEnable((P_U32)&monthId ,ICON_AREA ,CONTINUOUS_MODE ,90,126,108,142);
ActiveAreaEnable((P_U32)&dayId ,ICON_AREA ,CONTINUOUS_MODE ,90,94,108,110);
ActiveAreaEnable((P_U32)&hourId ,ICON_AREA ,CONTINUOUS_MODE ,110,164,128,180);
ActiveAreaEnable((P_U32)&minuteId ,ICON_AREA ,CONTINUOUS_MODE ,110,132,128,148);
ActiveAreaEnable((P_U32)&secondId ,ICON_AREA ,CONTINUOUS_MODE ,110,100,128,116);
SetPeriod(RTC_PERI_SECOND);
while (1) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -