rtc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /**
  2. ******************************** STM32F10x *********************************
  3. * @文件名 : rtc.c
  4. * @作者 : strongerHuang
  5. * @库版本 : V3.5.0
  6. * @文件版本 : V1.0.0
  7. * @日期 : 2016年07月18日
  8. * @摘要 : RTC头文件
  9. ******************************************************************************/
  10. /* 定义防止递归包含 ----------------------------------------------------------*/
  11. #ifndef _RTC_H
  12. #define _RTC_H
  13. /* 包含的头文件 --------------------------------------------------------------*/
  14. #include "stm32f10x.h"
  15. /* 类型定义 ------------------------------------------------------------------*/
  16. typedef struct
  17. {
  18. uint8_t Year;
  19. uint8_t Month;
  20. uint8_t Date;
  21. uint8_t Week;
  22. uint8_t Hour;
  23. uint8_t Minute;
  24. uint8_t Second;
  25. }RTC_DateTimeTypeDef;
  26. typedef enum{
  27. RTC_OK = 0x00, //正确
  28. RTC_TIMEOUT, //超时
  29. RTC_EXIT, //退出
  30. RTC_OVERFLOW, //溢出
  31. }RTC_RESULT;
  32. /* 宏定义 --------------------------------------------------------------------*/
  33. #define SEC_DAY (24*3600) //一天秒数
  34. #define SEC_YEAR (365*SEC_DAY) //一年秒数(平年)
  35. /* 函数申明 ------------------------------------------------------------------*/
  36. void RTC_Configuration(void);
  37. void RTC_Initializes(void);
  38. uint8_t RTC_Init(void);
  39. RTC_RESULT RTC_SetDateTime(RTC_DateTimeTypeDef RTC_DateTimeStructure);
  40. void RTC_GetDateTime(RTC_DateTimeTypeDef *RTC_DateTimeStructure);
  41. void RTC_SetAlarmTime_S(uint32_t Time );
  42. extern RTC_DateTimeTypeDef DeviceRTC;
  43. #endif /* _RTC_H */
  44. /**** Copyright (C)2016 strongerHuang. All Rights Reserved **** END OF FILE ****/