Implement setting time
This commit is contained in:
parent
a65b30f9df
commit
8c50aa4688
13
ds3231.hpp
13
ds3231.hpp
@ -101,7 +101,18 @@ class DS3231 {
|
||||
|
||||
writePartialRegister<TIME_REG_ADDR, DATE_START_OFFSET, DATE_END_OFFSET>(timeReg);
|
||||
}
|
||||
static void setTime(const Time &time) {}
|
||||
static void setTime(const Time &time)
|
||||
{
|
||||
detail::TimeReg timeReg;
|
||||
timeReg.setHours(time.hour);
|
||||
timeReg.setMinutes(time.minute);
|
||||
timeReg.setSeconds(time.second);
|
||||
|
||||
constexpr auto TIME_START_OFFSET = offsetof(detail::TimeReg, seconds);
|
||||
constexpr auto TIME_END_OFFSET = offsetof(detail::TimeReg, hours);
|
||||
|
||||
writePartialRegister<TIME_REG_ADDR, TIME_START_OFFSET, TIME_END_OFFSET>(timeReg);
|
||||
}
|
||||
static void setDateTime(const DateTime &dateTime) {}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user