From 3e3cf91b77b7813512aa3ef0218b0e39f8ac1719 Mon Sep 17 00:00:00 2001 From: TangZhenye <361869840@qq.com> Date: Mon, 11 Sep 2023 11:05:07 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=94=B9]=EF=BC=9Aalarm=20=E5=B0=86?= =?UTF-8?q?=E5=B9=B4=E6=9C=88=E6=97=A5=E4=B9=9F=E4=BC=A0=E7=BB=99=E9=A9=B1?= =?UTF-8?q?=E5=8A=A8=E5=B1=82=EF=BC=8C=E9=81=BF=E5=85=8D=E8=B7=A8=E5=A4=A9?= =?UTF-8?q?=20alarm=20=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/include/drivers/rtc.h | 3 +++ components/drivers/rtc/alarm.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/components/drivers/include/drivers/rtc.h b/components/drivers/include/drivers/rtc.h index 0aacc4665f..9a9d9cefa3 100644 --- a/components/drivers/include/drivers/rtc.h +++ b/components/drivers/include/drivers/rtc.h @@ -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 diff --git a/components/drivers/rtc/alarm.c b/components/drivers/rtc/alarm.c index 6b89d9d1a3..62cb71ae7c 100644 --- a/components/drivers/rtc/alarm.c +++ b/components/drivers/rtc/alarm.c @@ -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; } }