?? basic.c
字號:
//============================================================================
// Include
//============================================================================
#include <stdio.h>
#include <cyg/kernel/kapi.h>
#include <cyg/io/rtc/fie702x_rtc.h>
#include "RTCSystem.h"
//============================================================================
// Global Variables
//============================================================================
cyg_io_handle_t rtc_handle;
int main (void)
{
RTC_Time mytime;
RTC_Date mydate;
int err;
/* open rtc driver
*/
err = cyg_io_lookup( "/dev/rtc", &rtc_handle );
if (ENOERR != err)
{
printf("Can't open '%s'\n", "/dev/rtc");
}
API_RTC_set_RecTime(rtc_handle, 0x1234);
printf("record time = %d\n", API_RTC_get_RecTime(rtc_handle));
while (1)
{
cyg_thread_delay(100);
API_RTC_get_Date(rtc_handle, &mydate);
API_RTC_get_Time(rtc_handle, &mytime);
printf("\nYear:%d Month:%d Day:%d\n",mydate.year,mydate.month,mydate.day);
printf("Hour:%d Min:%d Sec:%d\n",mytime.hour,mytime.minute,mytime.second);
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -