本示例,只要介绍,RTC 如何实现 年/月/日 - 时/分/秒,又离成功进了一步 ^_^。
1、硬件 (RTL8762DK + 128M Bits Falsh)
2、软件(keil IDE)
1、创建examples_ble_rtc_clock工程,基于《examples_ble_led工程》来创建,创建步骤请参考第二篇文章。
2、新建rtc_clock文件夹,分别存放hub_clock.c与hub_clock.h这两个文件
2、打开examples_ble_rtc_clock工程
1)、hub_clock.h
- #ifndef _WRISTBNAD_CLOCK_H_
- #define _WRISTBNAD_CLOCK_H_
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #include
- #include "board.h"
-
- #define IsLeapYear(yr) (!((yr) % 400) || (((yr) % 100) && !((yr) % 4)))
-
- #define YearLength(yr) (IsLeapYear(yr