Advertisement
Guest User

DS1307RTC.h

a guest
Aug 16th, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. /*
  2. * DS1307RTC.h - library for DS1307 RTC
  3. * This library is intended to be uses with Arduino Time.h library functions
  4. */
  5.  
  6. #ifndef DS1307RTC_h
  7. #define DS1307RTC_h
  8.  
  9. #include <Time.h>
  10.  
  11. // library interface description
  12. class DS1307RTC
  13. {
  14. // user-accessible "public" interface
  15. public:
  16. DS1307RTC();
  17. static time_t get();
  18. static bool set(time_t t);
  19. static bool read(tmElements_t &tm);
  20. static bool write(tmElements_t &tm);
  21. static bool chipPresent() { return exists; }
  22.  
  23. private:
  24. static bool exists;
  25. static uint8_t dec2bcd(uint8_t num);
  26. static uint8_t bcd2dec(uint8_t num);
  27. };
  28.  
  29. #ifdef RTC
  30. #undef RTC // workaround for Arduino Due, which defines "RTC"...
  31. #endif
  32.  
  33. extern DS1307RTC RTC;
  34.  
  35. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement