MCP79410_Timer.h 868 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef MCP79410_Timer_h
  2. #define MCP79410_Timer_h
  3. #include <Arduino.h>
  4. #include <Wire.h>
  5. class MCP79410_Timer {
  6. public:
  7. MCP79410_Timer(byte rtcAddress);
  8. MCP79410_Timer(void);
  9. void start();
  10. void stop();
  11. void reset();
  12. int status();
  13. uint8_t hours();
  14. uint8_t minutes();
  15. uint8_t seconds();
  16. String getTime();
  17. uint32_t getTotalSeconds();
  18. private:
  19. // private methods
  20. unsigned char _readRtcByte(const unsigned char adr);
  21. void _writeRtcByte(const unsigned char adr, const unsigned char data);
  22. uint8_t _makeDec(uint8_t num);
  23. uint8_t _makeHex(uint8_t num);
  24. unsigned char _getRtcData(const unsigned char adr, const unsigned char validbits);
  25. String _format2digit(const unsigned char data);
  26. // private variables
  27. byte _rtcAddress;
  28. int _rtcState;
  29. };
  30. #endif