Implement getting alarm times

This commit is contained in:
BlackMark 2020-05-17 20:06:13 +02:00
parent dfd2289aef
commit 21f9215bba

View File

@ -142,6 +142,30 @@ class DS3231 {
return dateTime;
}
static DateTime getAlarm1()
{
const auto alarmReg = readRegister<ALARM1_REG_ADDR>();
DateTime alarmTime = {};
alarmReg.getDate(alarmTime.day);
alarmTime.hour = alarmReg.getHours();
alarmTime.minute = alarmReg.getMinutes();
alarmTime.second = alarmReg.getSeconds();
return alarmTime;
}
static DateTime getAlarm2()
{
const auto alarmReg = readRegister<ALARM2_REG_ADDR>();
DateTime alarmTime = {};
alarmReg.getDate(alarmTime.day);
alarmTime.hour = alarmReg.getHours();
alarmTime.minute = alarmReg.getMinutes();
return alarmTime;
}
static void setDate(const Date &date)
{
detail::TimeReg timeReg;