|
|
上代码(main.c):
#include "sys.h"
#include "ds1302.h"
#include <stdio.h>
#define START_WIN_NUM_VP 0x2000 //
u8 date_buff[40];
u8 len;
void main(void)
{
sys_init();
ds1302_init();
while(1)
{
sys_delay_ms(100);
ds1302_read_date();
len = sprintf(date_buff,"20%02x/%02x/%02x %02x:%02x:%02x week:%x",
(u16)cur_date.year,(u16)cur_date.month,(u16)cur_date.day,
(u16)cur_date.hour,(u16)cur_date.min,(u16)cur_date.sec,
(u16)cur_date.week
);
date_buff[len+1] = 0;
sys_write_vp(START_WIN_NUM_VP,date_buff,len/2+2);
}
}
ui设计:
使用文本显示,注意设置0字库,23的中文字库,x,y大小;

|
|