Upload files to "/"
This commit is contained in:
50
rtc_manager.h
Normal file
50
rtc_manager.h
Normal file
@@ -0,0 +1,50 @@
|
||||
// rtc_manager.h - RTC Manager for DS3231
|
||||
|
||||
#ifndef RTC_MANAGER_H
|
||||
#define RTC_MANAGER_H
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <RTClib.h>
|
||||
#include <Wire.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "task_config.h"
|
||||
|
||||
// RTC instance
|
||||
extern RTC_DS3231 rtc;
|
||||
|
||||
// RTC status
|
||||
extern bool rtcInitialized;
|
||||
|
||||
// Initialize RTC
|
||||
bool initRTC();
|
||||
|
||||
// Check if RTC is running
|
||||
bool isRTCRunning();
|
||||
|
||||
// Set RTC time (Unix timestamp)
|
||||
void setRTCTime(uint32_t unixtime);
|
||||
|
||||
// Get RTC time (Unix timestamp)
|
||||
uint32_t getRTCTime();
|
||||
|
||||
// Get formatted time string
|
||||
String getRTCTimeString();
|
||||
|
||||
// Sync time from NTP (WiFi STA mode)
|
||||
bool syncTimeFromNTP();
|
||||
|
||||
// Time Sync Task (runs on Core 1)
|
||||
void timeSyncTask(void *pvParameters);
|
||||
|
||||
// Get current timestamp in microseconds
|
||||
uint64_t getMicrosTimestamp();
|
||||
|
||||
// Convert Unix time to formatted string
|
||||
String unixTimeToString(uint32_t unixtime);
|
||||
|
||||
// Set system time from RTC
|
||||
void syncSystemTimeFromRTC();
|
||||
|
||||
#endif // RTC_MANAGER_H
|
||||
Reference in New Issue
Block a user