mirror of
https://github.com/cwyark/ameba-sdk-gcc-make.git
synced 2026-07-08 14:15:38 +00:00
first commit and add gitignore, README.md
This commit is contained in:
commit
760756ba2c
1861 changed files with 709236 additions and 0 deletions
7
project/realtek_ameba1_va0_example/example_sources/rtc/readme.txt
Executable file
7
project/realtek_ameba1_va0_example/example_sources/rtc/readme.txt
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
Example Description
|
||||
|
||||
This example describes how to use the RTC API. The RTC function is implemented by a G-Timer.
|
||||
|
||||
Behavior:
|
||||
This example will print out the time information every secand.
|
||||
|
||||
34
project/realtek_ameba1_va0_example/example_sources/rtc/src/main.c
Executable file
34
project/realtek_ameba1_va0_example/example_sources/rtc/src/main.c
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Routines to access hardware
|
||||
*
|
||||
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*/
|
||||
#include "rtc_api.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
time_t seconds;
|
||||
struct tm *timeinfo;
|
||||
|
||||
rtc_init();
|
||||
rtc_write(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
|
||||
|
||||
while(1) {
|
||||
seconds = rtc_read();
|
||||
timeinfo = localtime(&seconds);
|
||||
|
||||
DBG_8195A("Time as seconds since January 1, 1970 = %d\n", seconds);
|
||||
|
||||
DBG_8195A("Time as a basic string = %s", ctime(&seconds));
|
||||
|
||||
DBG_8195A("Time as a custom formatted string = %d-%d-%d %d:%d:%d ",
|
||||
timeinfo->tm_year, timeinfo->tm_mon, timeinfo->tm_mday, timeinfo->tm_hour,
|
||||
timeinfo->tm_min,timeinfo->tm_sec);
|
||||
|
||||
wait(1);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue