[bsp/n32] 修复每次上电都初始化RTC导致上电时间被重置的问题
This commit is contained in:
parent
9de975fa93
commit
240172609c
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
#ifdef BSP_USING_RTC
|
#ifdef BSP_USING_RTC
|
||||||
|
|
||||||
|
#define USER_WRITE_BKP_DAT1_DATA 0xA5A5
|
||||||
|
|
||||||
uint32_t SynchPrediv, AsynchPrediv;
|
uint32_t SynchPrediv, AsynchPrediv;
|
||||||
|
|
||||||
static rt_err_t n32_rtc_get_timeval(struct timeval *tv)
|
static rt_err_t n32_rtc_get_timeval(struct timeval *tv)
|
||||||
|
@ -105,6 +107,8 @@ static rt_err_t n32_rtc_init(void)
|
||||||
|
|
||||||
/* Allow access to RTC */
|
/* Allow access to RTC */
|
||||||
PWR_BackupAccessEnable(ENABLE);
|
PWR_BackupAccessEnable(ENABLE);
|
||||||
|
if (USER_WRITE_BKP_DAT1_DATA != BKP_ReadBkpData(BKP_DAT1) )
|
||||||
|
{
|
||||||
|
|
||||||
#if defined(SOC_N32G45X) || defined(SOC_N32WB452)
|
#if defined(SOC_N32G45X) || defined(SOC_N32WB452)
|
||||||
/* Reset Backup */
|
/* Reset Backup */
|
||||||
|
@ -194,6 +198,9 @@ static rt_err_t n32_rtc_init(void)
|
||||||
return -RT_ERROR;
|
return -RT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BKP_WriteBkpData(BKP_DAT1, USER_WRITE_BKP_DAT1_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue