41 int count =
twi.
read(regs, size);
50 int count =
twi.
write(pos, regs, size);
58 if (
read(&now,
sizeof(now)) !=
sizeof(now))
return (
false);
69 int res =
write(&now,
sizeof(now));
71 return (res ==
sizeof(now));
80 pos = offsetof(
rtcc_t,alarm0);
82 pos = offsetof(
rtcc_t,alarm1);
98 pos = offsetof(
rtcc_t,alarm0);
100 pos = offsetof(
rtcc_t,alarm1);
112 pos = offsetof(
rtcc_t,control);
113 if (
read(&cntrl,
sizeof(cntrl), pos) !=
sizeof(cntrl))
return (
false);
118 if (
write(&cntrl,
sizeof(cntrl), pos) !=
sizeof(cntrl))
return (
false);
134 pos = offsetof(
rtcc_t,alarm0.day);
135 if (
read(&config,
sizeof(config), pos) !=
sizeof(config))
return (0);
139 pos = offsetof(
rtcc_t,alarm1.day);
140 if (
read(&config,
sizeof(config), pos) !=
sizeof(config))
return (0);
150 uint8_t pos = offsetof(
rtcc_t,control);
151 if (
read(&cntrl,
sizeof(cntrl), pos) !=
sizeof(cntrl))
return (
false);
157 if (
write(&cntrl,
sizeof(cntrl), pos) !=
sizeof(cntrl))
return (
false);
168 uint8_t pos = offsetof(
rtcc_t,control);
169 if (
read(&cntrl,
sizeof(cntrl), pos) !=
sizeof(cntrl))
return (
false);
171 return (
write(&cntrl,
sizeof(cntrl), pos) ==
sizeof(cntrl));
187 outs << t.
clock <<
' '
IOStream & bcd(IOStream &outs)
uint8_t as_uint8
Unsigned byte access.
uint8_t month
01-12 Month.
int write(void *regs, uint8_t size, uint8_t pos=0)
uint8_t minutes
00-59 Minutes.
virtual void on_interrupt(uint16_t arg=0)
bool get_time(time_t &now)
uint8_t triggered
Alarm Interrupt Flag.
bool square_wave(bool flag)
uint8_t month
01-12 Month.
uint8_t seconds
00-59 Seconds.
IOStream & bin(IOStream &outs)
AlarmInterrupt m_alarm_irq
bool get_alarm(uint8_t nr, time_t &alarm, uint8_t &when)
alarm_t alarm1
Alarm 1 setting (time/configuration).
void write(int value) const
time_t clock
Current time.
bool set_alarm(uint8_t nr, time_t &alarm, uint8_t when)
uint8_t hours
00-23 Hours.
control_t control
Device control register.
int read(void *buf, size_t size)
uint8_t alm1en
Alarm 1 Module Enable.
int8_t calibration
Time calibration (in clock cycles).
uint8_t seconds
00-59 Seconds.
int write(void *buf, size_t size)
uint8_t as_uint8
< Day, alarm configuration and status.
void acquire(TWI::Driver *dev)
alarm_t alarm0
Alarm 0 setting (time/configuration).
int read(void *regs, uint8_t size, uint8_t pos=0)
uint8_t polarity
Alarm Pin (MFP) Polarity.
OutputPin & operator<<(int value)
uint8_t sqwen
Square-Ware Enable.
AlarmInterrupt(Board::ExternalInterruptPin pin)
bool clear_alarm(uint8_t nr)
bool set_time(time_t &now)
uint8_t alm0en
Alarm 0 Module Enable.