PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 年之前
12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * DS1307RTC.h - library for DS1307 RTC
  3. * This library is intended to be uses with Arduino Time library functions
  4. */
  5. #ifndef DS1307RTC_h
  6. #define DS1307RTC_h
  7. #include <TimeLib.h>
  8. // library interface description
  9. class DS1307RTC
  10. {
  11. // user-accessible "public" interface
  12. public:
  13. DS1307RTC();
  14. static time_t get();
  15. static bool set(time_t t);
  16. static bool read(tmElements_t &tm);
  17. static bool write(tmElements_t &tm);
  18. static bool chipPresent() { return exists; }
  19. static unsigned char isRunning();
  20. static void setCalibration(char calValue);
  21. static char getCalibration();
  22. private:
  23. static bool exists;
  24. static uint8_t dec2bcd(uint8_t num);
  25. static uint8_t bcd2dec(uint8_t num);
  26. };
  27. #ifdef RTC
  28. #undef RTC // workaround for Arduino Due, which defines "RTC"...
  29. #endif
  30. extern DS1307RTC RTC;
  31. #endif