1
0

SWM320_rtc.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef __SWM320_RTC_H__
  2. #define __SWM320_RTC_H__
  3. #define RTC_SUN 0x01
  4. #define RTC_MON 0x02
  5. #define RTC_TUE 0x04
  6. #define RTC_WED 0x08
  7. #define RTC_THU 0x10
  8. #define RTC_FRI 0x20
  9. #define RTC_SAT 0x40
  10. typedef struct
  11. {
  12. uint16_t Year;
  13. uint8_t Month; //取值1--12
  14. uint8_t Date; //取值1--31
  15. uint8_t Hour; //取值0--23
  16. uint8_t Minute; //取值0--59
  17. uint8_t Second; //取值0--59
  18. uint8_t SecondIEn;
  19. uint8_t MinuteIEn;
  20. } RTC_InitStructure;
  21. typedef struct
  22. {
  23. uint8_t Days; //RTC_SUN、RTC_MON、RTC_TUE、RTC_WED、RTC_THU、RTC_FRI、RTC_SAT及其或运算组合
  24. uint8_t Hour;
  25. uint8_t Minute;
  26. uint8_t Second;
  27. uint8_t AlarmIEn;
  28. } RTC_AlarmStructure;
  29. typedef struct
  30. {
  31. uint16_t Year;
  32. uint8_t Month;
  33. uint8_t Date;
  34. uint8_t Day; //RTC_SUN、RTC_MON、RTC_TUE、RTC_WED、RTC_THU、RTC_FRI、RTC_SAT
  35. uint8_t Hour;
  36. uint8_t Minute;
  37. uint8_t Second;
  38. } RTC_DateTime;
  39. void RTC_Init(RTC_TypeDef *RTCx, RTC_InitStructure *initStruct);
  40. void RTC_Start(RTC_TypeDef *RTCx);
  41. void RTC_Stop(RTC_TypeDef *RTCx);
  42. void RTC_GetDateTime(RTC_TypeDef *RTCx, RTC_DateTime *dateTime);
  43. void RTC_AlarmSetup(RTC_TypeDef *RTCx, RTC_AlarmStructure *alarmStruct);
  44. void RTC_IntSecondEn(RTC_TypeDef *RTCx);
  45. void RTC_IntSecondDis(RTC_TypeDef *RTCx);
  46. void RTC_IntSecondClr(RTC_TypeDef *RTCx);
  47. uint32_t RTC_IntSecondStat(RTC_TypeDef *RTCx);
  48. void RTC_IntMinuteEn(RTC_TypeDef *RTCx);
  49. void RTC_IntMinuteDis(RTC_TypeDef *RTCx);
  50. void RTC_IntMinuteClr(RTC_TypeDef *RTCx);
  51. uint32_t RTC_IntMinuteStat(RTC_TypeDef *RTCx);
  52. void RTC_IntHourEn(RTC_TypeDef *RTCx);
  53. void RTC_IntHourDis(RTC_TypeDef *RTCx);
  54. void RTC_IntHourClr(RTC_TypeDef *RTCx);
  55. uint32_t RTC_IntHourStat(RTC_TypeDef *RTCx);
  56. void RTC_IntDateEn(RTC_TypeDef *RTCx);
  57. void RTC_IntDateDis(RTC_TypeDef *RTCx);
  58. void RTC_IntDateClr(RTC_TypeDef *RTCx);
  59. uint32_t RTC_IntDateStat(RTC_TypeDef *RTCx);
  60. void RTC_IntAlarmEn(RTC_TypeDef *RTCx);
  61. void RTC_IntAlarmDis(RTC_TypeDef *RTCx);
  62. void RTC_IntAlarmClr(RTC_TypeDef *RTCx);
  63. uint32_t RTC_IntAlarmStat(RTC_TypeDef *RTCx);
  64. #endif //__SWM320_RTC_H__