Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

44 Zeilen
1.1 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. #define RTC_A_CLASS uDS3231
  11. #define WRITE_ALARM_1(t) RTC_A.writeAlarm1(DS3231_ALM_HMS, t)
  12. #define READ_ALARM_1(t) almType_t almDummy; RTC_A.readAlarm1(almDummy, t)
  13. #else
  14. #include <MD_DS3231.h>
  15. typedef struct tmElements_t {
  16. uint8_t second = 0;
  17. uint8_t minute = 0;
  18. uint8_t hour = 0;
  19. uint8_t day = 0;
  20. uint8_t month = 0;
  21. uint16_t year = 0; // year from 2000
  22. };
  23. class MD_DS3231_Ext : public MD_DS3231
  24. {
  25. private:
  26. void unpack(tmElements_t &time);
  27. void pack(const tmElements_t &time);
  28. public:
  29. boolean readTime(tmElements_t &time);
  30. boolean writeTime(const tmElements_t &time);
  31. boolean readAlarm1(almType_t &almType, tmElements_t &time);
  32. boolean writeAlarm1(almType_t almType, const tmElements_t &time);
  33. };
  34. #define RTC_A_CLASS MD_DS3231_Ext
  35. #define WRITE_ALARM_1(t) RTC_A.writeAlarm1(DS3231_ALM_HMS, t)
  36. #define READ_ALARM_1(t) almType_t almDummy; RTC_A.readAlarm1(almDummy, t)
  37. #endif