河北水利局项目
This commit is contained in:
75
rptime/rptime.c
Normal file
75
rptime/rptime.c
Normal file
@@ -0,0 +1,75 @@
|
||||
//#include "stdafx.h"
|
||||
#include "rptime.h"
|
||||
|
||||
struct rptime_struct
|
||||
{
|
||||
u8 type;
|
||||
u8 year;
|
||||
u8 month;
|
||||
u8 day;
|
||||
u8 hour;
|
||||
u8 minute;
|
||||
u8 second;
|
||||
};
|
||||
|
||||
struct rptime_struct rptime;
|
||||
|
||||
void rptime_get(u8 * val)
|
||||
{
|
||||
val[0] = rptime.type;
|
||||
val[1] = rptime.second;
|
||||
val[2] = rptime.minute;
|
||||
val[3] = rptime.hour;
|
||||
val[4] = rptime.day;
|
||||
val[5] = rptime.month;
|
||||
val[6] = rptime.year;
|
||||
}
|
||||
|
||||
void rptime_set(u8 * val)
|
||||
{
|
||||
rptime.type = val[0];
|
||||
rptime.second = val[1];
|
||||
rptime.minute = val[2];
|
||||
rptime.hour = val[3];
|
||||
rptime.day = val[4];
|
||||
rptime.month = val[5];
|
||||
rptime.year = val[6];
|
||||
}
|
||||
|
||||
u8 rp_getday()
|
||||
{
|
||||
return rptime.day;
|
||||
}
|
||||
|
||||
u8 rp_gethour()
|
||||
{
|
||||
return rptime.hour;
|
||||
}
|
||||
|
||||
u8 rp_getminute()
|
||||
{
|
||||
return rptime.minute;
|
||||
}
|
||||
|
||||
u8 rp_getsecond()
|
||||
{
|
||||
return rptime.second;
|
||||
}
|
||||
|
||||
void rptime_write()
|
||||
{
|
||||
rptime_writefile((u8*)&rptime,sizeof(rptime));
|
||||
}
|
||||
|
||||
void rptime_read()
|
||||
{
|
||||
rptime_readfile((u8*)&rptime,sizeof(rptime));
|
||||
|
||||
if(rptime.hour>0x24)
|
||||
{
|
||||
rptime.hour = 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
16
rptime/rptime.h
Normal file
16
rptime/rptime.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef __RPTIME__
|
||||
#define __RPTIME__
|
||||
#include "global.h"
|
||||
#include "Basedefine.h"
|
||||
|
||||
void rptime_get(u8 * val);
|
||||
void rptime_set(u8 * val);
|
||||
void rptime_write();
|
||||
void rptime_read();
|
||||
u8 rp_getday();
|
||||
u8 rp_gethour();
|
||||
u8 rp_getminute();
|
||||
u8 rp_getsecond();
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user