31#define RTC_REG_COUNT 7
36 embed_bool (*
regs_to_epoch)(
const uint8_t *,
const uint8_t *, uint32_t *);
38 embed_bool (*
begin)(
const uint8_t *);
#define PROTOCORE_UNUSED
Suppress the unused warning. Every module ends in a namespace most callers only partly use.
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
embed_bool protocore_rtc_regs_to_epoch(const uint8_t *work, const uint8_t *regs, uint32_t *epoch)
Convert the 7 raw RTC time registers (BCD: sec, min, hour, dow, .
uint32_t protocore_rtc_read_epoch(uint8_t *work)
Read the current time from the RTC over I2C.
embed_bool protocore_rtc_begin(const uint8_t *work)
Initialize the I2C bus for the RTC. true; with no bus seam it is a .
void protocore_rtc_epoch_to_regs(const uint8_t *work, uint32_t epoch, uint8_t *regs)
Convert a Unix timestamp to the 7 RTC time registers (BCD, .
uint32_t protocore_rtc_time_source(void)
The RTC as a TimeSourceFn: protocore_rtc_read_epoch() over this module's own borrow.
embed_bool protocore_rtc_set_epoch(uint8_t *work, uint32_t epoch)
Set the RTC to epoch over I2C. true if the write succeeded.
uint8_t * protocore_rtc_span(void)
The PROTOCORE_I2C_DEVICE_BORROW bytes this module's state lives in.
Dispatch table. Addressed by offset, so the layout is asserted below.
embed_bool(* set_epoch)(uint8_t *, uint32_t)
uint32_t(* read_epoch)(uint8_t *)
embed_bool(* regs_to_epoch)(const uint8_t *, const uint8_t *, uint32_t *)
embed_bool(* begin)(const uint8_t *)
void(* epoch_to_regs)(const uint8_t *, uint32_t, uint8_t *)