[修改]:alarm 将年月日也传给驱动层,避免跨天 alarm 失效

This commit is contained in:
TangZhenye 2023-09-11 11:05:07 +08:00 committed by Meco Man
parent caea0616a4
commit 3e3cf91b77
2 changed files with 9 additions and 0 deletions

View File

@ -38,6 +38,9 @@ struct rt_rtc_wkalarm
rt_int32_t tm_sec; /* alarm at tm_sec */
rt_int32_t tm_min; /* alarm at tm_min */
rt_int32_t tm_hour; /* alarm at tm_hour */
rt_int32_t tm_mday; /* alarm at tm_mday */
rt_int32_t tm_mon; /* alarm at tm_mon */
rt_int32_t tm_year; /* alarm at tm_year */
};
struct rt_rtc_ops

View File

@ -57,6 +57,9 @@ static rt_err_t alarm_set(struct rt_alarm *alarm)
wkalarm.tm_sec = alarm->wktime.tm_sec;
wkalarm.tm_min = alarm->wktime.tm_min;
wkalarm.tm_hour = alarm->wktime.tm_hour;
wkalarm.tm_mday = alarm->wktime.tm_mday;
wkalarm.tm_mon = alarm->wktime.tm_mon;
wkalarm.tm_year = alarm->wktime.tm_year
ret = rt_device_control(device, RT_DEVICE_CTRL_RTC_SET_ALARM, &wkalarm);
if ((ret == RT_EOK) && wkalarm.enable)
@ -71,6 +74,9 @@ static rt_err_t alarm_set(struct rt_alarm *alarm)
alarm->wktime.tm_sec = wkalarm.tm_sec;
alarm->wktime.tm_min = wkalarm.tm_min;
alarm->wktime.tm_hour = wkalarm.tm_hour;
alarm->wktime.tm_mday = wkalarm.tm_mday;
alarm->wktime.tm_mon = wkalarm.tm_mon;
alarm->wktime.tm_year = wkalarm.tm_year;
}
}