Implement getting alarm times
This commit is contained in:
parent
dfd2289aef
commit
21f9215bba
24
ds3231.hpp
24
ds3231.hpp
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user