添加HC32F460系列RTC外设驱动#6069
Merged
Merged
Conversation
mysterywolf
requested changes
Jun 10, 2022
Comment on lines
+50
to
+54
| p_tm = gmtime(&time_stamp); | ||
| if (p_tm->tm_year < 100) | ||
| { | ||
| return -RT_ERROR; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
比较奇怪,换成gmtime_r后,时间也能设置成功,但是设置为立马会重启,或者hardfault。暂时还未找出来问题
mysterywolf
approved these changes
Jun 11, 2022
修复替换后设置日期会复位或者hardfault的bug,原因是定义p_tm指针未初始化。
struct tm p_tm = {0};
gmtime_r(&time_stamp, &p_tm);
mysterywolf
approved these changes
Jun 12, 2022
JamieTx
reviewed
Jun 13, 2022
| #include <rtthread.h> | ||
| #include <rtdevice.h> | ||
| #include <sys/time.h> | ||
| #include <drivers/adc.h> |
JamieTx
reviewed
Jun 13, 2022
| tm_new.tm_sec = stcRtcTime.u8Second; | ||
| tm_new.tm_min = stcRtcTime.u8Minute; | ||
| tm_new.tm_hour = stcRtcTime.u8Hour; | ||
| tm_new.tm_mday = stcRtcDate.u8Day + 1; |
JamieTx
reviewed
Jun 13, 2022
| stcRtcTime.u8Second = p_tm->tm_sec ; | ||
| stcRtcTime.u8Minute = p_tm->tm_min ; | ||
| stcRtcTime.u8Hour = p_tm->tm_hour; | ||
| stcRtcDate.u8Day = p_tm->tm_mday + 1; |
设置时间后读出的才是有效数据,日1~31,月1~12,修改与tm数据范围一致。
JamieTx
reviewed
Jun 13, 2022
| stcRtcDate.u8Day = p_tm.tm_mday; | ||
| stcRtcDate.u8Month = p_tm.tm_mon + 1; | ||
| stcRtcDate.u8Year = p_tm.tm_year - 100; | ||
| stcRtcDate.u8Weekday = p_tm.tm_wday + 1; |
JamieTx
reviewed
Jun 13, 2022
| stcRtcInit.u8ClockSrc = RTC_CLK_SRC_LRC; | ||
| #endif | ||
| stcRtcInit.u8HourFormat = RTC_HOUR_FMT_24H; | ||
| stcRtcInit.u8IntPeriod = RTC_INT_PERIOD_PER_SEC; |
Member
|
请解决一下冲突 |
Contributor
|
+1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
拉取/合并请求描述:(PR description)
[

【ev_hc32f460_lqfp100_v2】BSP中添加RTC驱动。
1.hc32\libraries\hc32_drivers中添加drv_rtc.c文件;
2.修改hc32\libraries\hc32_drivers中sconscript文件;
3.修改board文件夹下Kconfig文件,增加RTC选项;
本次PR代码已在ev_hc32f460_lqfp100_v2开发板测试通过。
]
以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。
The following content must not be changed in the submitted PR message. Otherwise, the PR will be closed immediately. After submitted PR, please use a web browser to visit PR, and check items one by one, and ticked them if no problem.
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up