📄 rtc_test.c
字号:
#include <time.h>#include <stdio.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>#include <sys/ioctl.h>#include <errno.h>#include <asm/types.h>#include <linux/rtc.h>#include "../include/api.h"int main(int argc,const char * argv[]){ struct tm read_tm; struct tm t; t.tm_sec = 50; //0-59 t.tm_min = 59; //0-59 t.tm_hour = 23; //0-23 t.tm_mday = 25; //1-31 t.tm_mon = 1; //0-11 t.tm_wday = 1; //0-6 week day t.tm_year = 105; //0-199 2005-1900 //ds1302_set_time(&t); if(argc>1){ if(strcmp(argv[1],"w")==0){ printf("set new date time: \n"); ds1302_set_time(&t); rtc_set_time(&t); } } rtc_get_time(&read_tm); printf("AT91RM9200 rtc time: "); show_time(&read_tm); ds1302_get_time(&read_tm); printf("DS1302 rtc time: "); show_time(&read_tm);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -