31#define RTC_REG_COUNT 7
36 proto_bool (*regs_to_epoch)(uint8_t *,
const uint8_t *, uint32_t *);
37 void (*epoch_to_regs)(uint8_t *, uint32_t, uint8_t *);
39 uint32_t (*read_epoch)(uint8_t *);
41 void (*time_source)(uint8_t *);
#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.
proto_bool protocore_rtc_begin(uint8_t *work)
Initialize the I2C bus for the RTC. true; with no bus seam it is a .
uint32_t protocore_rtc_read_epoch(uint8_t *work)
Read the current time from the RTC over I2C.
proto_bool protocore_rtc_regs_to_epoch(uint8_t *work, const uint8_t *regs, uint32_t *epoch)
Convert the 7 raw RTC time registers (BCD: sec, min, hour, dow, .
PROTOCORE_NS RtcNs Rtc PROTOCORE_UNUSED
Module namespace.
proto_bool protocore_rtc_set_epoch(uint8_t *work, uint32_t epoch)
Set the RTC to epoch over I2C. true if the write succeeded.
void protocore_rtc_epoch_to_regs(uint8_t *work, uint32_t epoch, uint8_t *regs)
Convert a Unix timestamp to the 7 RTC time registers (BCD, .
uint8_t * protocore_rtc_span(void)
The PROTOCORE_I2C_DEVICE_BORROW bytes this module's state lives in.
void protocore_rtc_time_source(uint8_t *work)
A TimeSourceFn wrapper (returns protocore_rtc_read_epoch()) to .
Dispatch table. Addressed by offset, so the layout is asserted below.
proto_bool(* regs_to_epoch)(uint8_t *, const uint8_t *, uint32_t *)
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS