luat_rtc_air105.c 989 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "luat_base.h"
  2. #include "luat_rtc.h"
  3. #include "app_interface.h"
  4. int luat_rtc_set(struct tm *tblock) {
  5. Date_UserDataStruct Date;
  6. Time_UserDataStruct Time;
  7. Time.Sec = tblock->tm_sec;
  8. Time.Min = tblock->tm_min;
  9. Time.Hour = tblock->tm_hour;
  10. //tblock->tm_wday = uTime.Time.Week;
  11. Date.Year = tblock->tm_year;
  12. Date.Mon = tblock->tm_mon;
  13. Date.Day = tblock->tm_mday;
  14. RTC_SetDateTime(&Date, &Time, 1);
  15. return 0;
  16. }
  17. int luat_rtc_get(struct tm *tblock) {
  18. Date_UserDataStruct Date;
  19. Time_UserDataStruct Time;
  20. RTC_GetDateTime(&Date, &Time);
  21. tblock->tm_sec = Time.Sec;
  22. tblock->tm_min = Time.Min;
  23. tblock->tm_hour = Time.Hour;
  24. tblock->tm_wday = Time.Week;
  25. tblock->tm_year = Date.Year;
  26. tblock->tm_mon = Date.Mon;
  27. tblock->tm_mday = Date.Day;
  28. return 0;
  29. }
  30. int luat_rtc_timer_start(int id, struct tm *tblock) {
  31. return -1; // 暂不支持
  32. }
  33. int luat_rtc_timer_stop(int id) {
  34. return -1; // 暂不支持
  35. }