36
36
#include "supervisor/shared/translate/translate.h"
37
37
38
38
#include "fsl_snvs_hp.h"
39
+ #include "fsl_snvs_lp.h"
39
40
40
41
void 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 );
43
44
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 );
45
53
SNVS_HP_RTC_StartTimer (SNVS );
46
54
}
47
55
48
56
void 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 );
51
59
52
60
tm -> tm_year = rtcDate .year ;
53
61
tm -> tm_mon = rtcDate .month ;
@@ -58,15 +66,15 @@ void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {
58
66
}
59
67
60
68
void common_hal_rtc_set_time (timeutils_struct_time_t * tm ) {
61
- snvs_hp_rtc_datetime_t rtcDate ;
69
+ snvs_lp_srtc_datetime_t rtcDate ;
62
70
rtcDate .year = tm -> tm_year ;
63
71
rtcDate .month = tm -> tm_mon ;
64
72
rtcDate .day = tm -> tm_mday ;
65
73
rtcDate .hour = tm -> tm_hour ;
66
74
rtcDate .minute = tm -> tm_min ;
67
75
rtcDate .second = tm -> tm_sec ;
68
76
69
- SNVS_HP_RTC_SetDatetime (SNVS , & rtcDate );
77
+ SNVS_LP_SRTC_SetDatetime (SNVS , & rtcDate );
70
78
}
71
79
72
80
int common_hal_rtc_get_calibration (void ) {
0 commit comments