21#ifndef PROTOCORE_RTC_H
22#define PROTOCORE_RTC_H
28#define RTC_REG_COUNT 7
#define RTC_REG_COUNT
Number of time registers read from the RTC (seconds..year).
void pc_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 pc_rtc_begin()
Initialize the I2C bus for the RTC.
bool pc_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...
uint32_t pc_rtc_read_epoch()
Read the current time from the RTC over I2C.
uint32_t pc_rtc_time_source()
A TimeSourceFn wrapper (returns pc_rtc_read_epoch()) to register with pc_time_source_add().
bool pc_rtc_set_epoch(uint32_t epoch)
Set the RTC to epoch over I2C.