21#ifndef DETERMINISTICESPASYNCWEBSERVER_RTC_H
22#define DETERMINISTICESPASYNCWEBSERVER_RTC_H
28#define RTC_REG_COUNT 7
uint32_t rtc_time_source()
A TimeSourceFn wrapper (returns rtc_read_epoch()) to register with detws_time_source_add().
#define RTC_REG_COUNT
Number of time registers read from the RTC (seconds..year).
uint32_t rtc_read_epoch()
Read the current time from the RTC over I2C.
bool rtc_set_epoch(uint32_t epoch)
Set the RTC to epoch over I2C.
bool rtc_regs_to_epoch(const uint8_t regs[RTC_REG_COUNT], uint32_t *epoch)
Convert the 7 raw RTC time registers (BCD: sec, min, hour, dow, date, month, year) to a Unix timestam...
void rtc_epoch_to_regs(uint32_t epoch, uint8_t regs[RTC_REG_COUNT])
Convert a Unix timestamp to the 7 RTC time registers (BCD, 24-hour). Pure - no I2C....
bool rtc_begin()
Initialize the I2C bus for the RTC.