21 #ifndef COSA_DS3231_HH 22 #define COSA_DS3231_HH 63 } __attribute__ ((packed));
99 WHEN_MIN_MATCH = 0x06,
103 } __attribute__ ((packed));
199 int read(
void* regs, uint8_t size, uint8_t pos = 0);
209 int write(
void* regs, uint8_t size, uint8_t pos = 0);
218 __attribute__((always_inline))
220 return (
read(&now,
sizeof(now)) ==
sizeof(now));
230 __attribute__((always_inline))
232 return (
write(&now,
sizeof(now)) ==
sizeof(now));
243 __attribute__((always_inline))
245 return (
get(&alarm,
sizeof(alarm), offsetof(
timekeeper_t, alarm1), mask));
256 __attribute__((always_inline))
258 return (
set(&alarm,
sizeof(alarm), offsetof(
timekeeper_t, alarm1), mask));
269 __attribute__((always_inline))
271 return (
get(&alarm,
sizeof(alarm), offsetof(
timekeeper_t, alarm2), mask));
282 __attribute__((always_inline))
284 return (
set(&alarm,
sizeof(alarm), offsetof(
timekeeper_t, alarm2), mask));
311 bool get(
void* alarm, uint8_t size, uint8_t offset, uint8_t& mask);
322 bool set(
void* alarm, uint8_t size, uint8_t offset, uint8_t mask);
int write(void *regs, uint8_t size, uint8_t pos=0)
bool set_alarm1(alarm1_t &alarm, uint8_t mask)
time_t clock
Current time.
bool set_alarm2(alarm2_t &alarm, uint8_t mask)
bool square_wave(bool flag)
status_t status
Device status register.
control_t control
Device control register.
bool get_time(time_t &now)
int read(void *regs, uint8_t size, uint8_t pos=0)
int16_t temp
Device temperature.
int8_t aging
Crystal adjustment.
bool set_time(time_t &now)
alarm2_t alarm2
Alarm 2 setting.
bool get_alarm1(alarm1_t &alarm, uint8_t &mask)
alarm1_t alarm1
Alarm 1 setting.
IOStream & operator<<(IOStream &outs, DS3231::alarm1_t &t)
bool get_alarm2(alarm2_t &alarm, uint8_t &mask)