First Commit

This commit is contained in:
MindCreeper03
2025-02-27 19:31:50 +01:00
parent bcbb6aff9a
commit e490df1715
2470 changed files with 1479965 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#include "RTClib.h"
/**************************************************************************/
/*!
@brief Set the current date/time of the RTC_Micros clock.
@param dt DateTime object with the desired date and time
*/
/**************************************************************************/
void RTC_Micros::adjust(const DateTime &dt) {
lastMicros = micros();
lastUnix = dt.unixtime();
}
/**************************************************************************/
/*!
@brief Adjust the RTC_Micros clock to compensate for system clock drift
@param ppm Adjustment to make. A positive adjustment makes the clock faster.
*/
/**************************************************************************/
void RTC_Micros::adjustDrift(int ppm) { microsPerSecond = 1000000 - ppm; }
/**************************************************************************/
/*!
@brief Get the current date/time from the RTC_Micros clock.
@return DateTime object containing the current date/time
*/
/**************************************************************************/
DateTime RTC_Micros::now() {
uint32_t elapsedSeconds = (micros() - lastMicros) / microsPerSecond;
lastMicros += elapsedSeconds * microsPerSecond;
lastUnix += elapsedSeconds;
return lastUnix;
}