Fork of the espurna firmware for `mhsw` switches
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.

30 lines
583 B

  1. /*
  2. dummyRTC support module
  3. Copyright (C) 2018 by Pavel Chauzov <poulch at mail dot ru>
  4. */
  5. #include <TimeLib.h>
  6. #define _bcdToDec(val) ((uint8_t) ((val / 16 * 10) + (val % 16)))
  7. #define _decToBcd(val) ((uint8_t) ((val / 10 * 16) + (val % 10)))
  8. time_t getTime_rtc() {
  9. tmElements_t tm;
  10. tm.Second = _bcdToDec(1);
  11. tm.Minute = _bcdToDec(0);
  12. tm.Hour = _bcdToDec(0);
  13. tm.Wday = _bcdToDec(0);
  14. tm.Day = _bcdToDec(1);
  15. tm.Month = _bcdToDec(1);
  16. tm.Year = y2kYearToTm(16);
  17. return makeTime(tm);
  18. }
  19. uint8_t setTime_rtc(time_t nt) {
  20. return 0;
  21. }