Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

42 righe
1005 B

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