3636#include "supervisor/shared/translate/translate.h"
3737
3838#include "fsl_snvs_hp.h"
39+ #include "fsl_snvs_lp.h"
3940
4041void rtc_init (void ) {
41- snvs_hp_rtc_config_t config ;
42- SNVS_HP_RTC_GetDefaultConfig (& config );
42+ snvs_hp_rtc_config_t hpconfig ;
43+ SNVS_HP_RTC_GetDefaultConfig (& hpconfig );
4344
44- SNVS_HP_RTC_Init (SNVS , & config );
45+ SNVS_HP_RTC_Init (SNVS , & hpconfig );
46+
47+ snvs_lp_srtc_config_t lpconfig ;
48+ SNVS_LP_SRTC_GetDefaultConfig (& lpconfig );
49+
50+ SNVS_LP_SRTC_Init (SNVS , & lpconfig );
51+
52+ SNVS_LP_SRTC_StartTimer (SNVS );
4553 SNVS_HP_RTC_StartTimer (SNVS );
4654}
4755
4856void common_hal_rtc_get_time (timeutils_struct_time_t * tm ) {
49- snvs_hp_rtc_datetime_t rtcDate ;
50- SNVS_HP_RTC_GetDatetime (SNVS , & rtcDate );
57+ snvs_lp_srtc_datetime_t rtcDate ;
58+ SNVS_LP_SRTC_GetDatetime (SNVS , & rtcDate );
5159
5260 tm -> tm_year = rtcDate .year ;
5361 tm -> tm_mon = rtcDate .month ;
@@ -58,15 +66,15 @@ void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {
5866}
5967
6068void common_hal_rtc_set_time (timeutils_struct_time_t * tm ) {
61- snvs_hp_rtc_datetime_t rtcDate ;
69+ snvs_lp_srtc_datetime_t rtcDate ;
6270 rtcDate .year = tm -> tm_year ;
6371 rtcDate .month = tm -> tm_mon ;
6472 rtcDate .day = tm -> tm_mday ;
6573 rtcDate .hour = tm -> tm_hour ;
6674 rtcDate .minute = tm -> tm_min ;
6775 rtcDate .second = tm -> tm_sec ;
6876
69- SNVS_HP_RTC_SetDatetime (SNVS , & rtcDate );
77+ SNVS_LP_SRTC_SetDatetime (SNVS , & rtcDate );
7078}
7179
7280int common_hal_rtc_get_calibration (void ) {
0 commit comments