WS_RTC.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _WS_RTC_H_
  2. #define _WS_RTC_H_
  3. #include <ctime>
  4. #include <Wire.h>
  5. #include <NTPClient.h>
  6. #include <WiFiUdp.h>
  7. #include "WS_GPIO.h"
  8. #include "WS_Information.h"
  9. extern bool Relay_Flag[6]; // Relay current status flag
  10. #define RTC_Flag 1 // RTC Timing Switcher flag
  11. // #define RTC_OPEN_Time_Hour 16 // Time when the timing switch is enabled
  12. // #define RTC_OPEN_Time_Min 29 // Time when the timing switch is enabled
  13. // #define RTC_Closs_Time_Hour 16 // Time when the timing switch is off
  14. // #define RTC_Closs_Time_Min 30 // Time when the timing switch is off
  15. #define DS3231_I2C_ADDR 0x68
  16. #define I2C_SDA 4
  17. #define I2C_SCL 5
  18. #define RTC_OPEN_Hour (RTC_OPEN_Time_Hour%10 + RTC_OPEN_Time_Hour /10*16) // RTC Timing Switcher flag
  19. #define RTC_OPEN_Min (RTC_OPEN_Time_Min%10 + RTC_OPEN_Time_Min /10*16) // RTC Timing Switcher flag
  20. #define RTC_Closs_Hour (RTC_Closs_Time_Hour%10 + RTC_Closs_Time_Hour /10*16) // RTC Timing Switcher flag
  21. #define RTC_Closs_Min (RTC_Closs_Time_Min%10 + RTC_Closs_Time_Min /10*16) // RTC Timing Switcher flag
  22. void RTC_Init();
  23. void DS3231_ReadTime() ;
  24. void DS3231_SetTime(uint8_t sec, uint8_t min, uint8_t hour, uint8_t dayOfWeek, uint8_t day, uint8_t month, uint8_t year);
  25. uint8_t DecToBcd(uint8_t val);
  26. void Acquisition_time();
  27. void RTC_Loop();
  28. #endif