File tree 1 file changed +6
-3
lines changed 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,10 @@ void hal_rtc_init(hal_rtc_conf_t const * p_rtc_conf) {
49
49
}
50
50
51
51
void hal_rtc_start (hal_rtc_conf_t const * p_rtc_conf , uint16_t period ) {
52
- p_rtc_conf -> p_instance -> CC [0 ] = period ;
52
+ uint32_t counter = p_rtc_conf -> p_instance -> COUNTER ;
53
+
54
+ p_rtc_conf -> p_instance -> CC [0 ] = counter + period ;
55
+
53
56
p_rtc_conf -> p_instance -> EVTENSET = RTC_EVTEN_COMPARE0_Msk ;
54
57
p_rtc_conf -> p_instance -> INTENSET = RTC_INTENSET_COMPARE0_Msk ;
55
58
@@ -60,12 +63,12 @@ void hal_rtc_start(hal_rtc_conf_t const * p_rtc_conf, uint16_t period) {
60
63
}
61
64
62
65
void hal_rtc_stop (hal_rtc_conf_t const * p_rtc_conf ) {
63
- p_rtc_conf -> p_instance -> TASKS_STOP = 1 ;
64
-
65
66
p_rtc_conf -> p_instance -> EVTENCLR = RTC_EVTEN_COMPARE0_Msk ;
66
67
p_rtc_conf -> p_instance -> INTENCLR = RTC_INTENSET_COMPARE0_Msk ;
67
68
68
69
hal_irq_disable (p_rtc_conf -> irq_num );
70
+
71
+ p_rtc_conf -> p_instance -> TASKS_STOP = 1 ;
69
72
}
70
73
71
74
void RTC0_IRQHandler (void )
You can’t perform that action at this time.
0 commit comments