Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

53 wiersze
1.0 KiB

  1. #pragma once
  2. /**
  3. * \def USE_UDS3231
  4. * When defined, use the modified uDS3231 library instead of
  5. * the stock MD_DS3231 one.
  6. */
  7. //#define USE_UDS3231
  8. #ifdef USE_UDS3231
  9. #include <uDS3231.h>
  10. #else
  11. #include <MD_DS3231.h>
  12. #endif
  13. #ifndef USE_UDS3231
  14. //convenience macros to convert to and from tm years
  15. #define tmYearToCalendar(Y) ((Y) + 2000) // full four digit year
  16. #define CalendarYrToTm(Y) ((Y) - 2000)
  17. typedef unsigned long timestamp_t;
  18. typedef struct tmElements_t {
  19. uint8_t Second;
  20. uint8_t Minute;
  21. uint8_t Hour;
  22. uint8_t Day;
  23. uint8_t Month;
  24. uint8_t Year; // year from 2000
  25. };
  26. class uDS3231_Ext : public MD_DS3231
  27. {
  28. private:
  29. void unpack(tmElements_t &time)
  30. void pack(const tmElements_t &time);
  31. public:
  32. boolean readTime(tmElements_t &time);
  33. boolean writeTime(const tmElements_t &time);
  34. boolean readAlarm1(almType_t &almType, tmElements_t &time);
  35. boolean writeAlarm1(almType_t almType, const tmElements_t &time);
  36. };
  37. #define RTC_A_CLASS uDS3231_Ext
  38. #else
  39. #define RTC_A_CLASS uDS3231
  40. #endif