File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -95,11 +95,14 @@ void lp_ticker_init(void)
95
95
TIMER_EnableInt ((TIMER_T * ) NU_MODBASE (timer2_modinit .modname ));
96
96
TIMER_EnableWakeup ((TIMER_T * ) NU_MODBASE (timer2_modinit .modname ));
97
97
98
- // Schedule wakeup to match semantics of lp_ticker_get_compare_match()
99
- lp_ticker_set_interrupt ( wakeup_tick );
98
+ // NOTE: TIMER_Start() first and then lp_ticker_set_interrupt(); otherwise, we may get stuck in lp_ticker_read() because
99
+ // timer is not running.
100
100
101
101
// Start timer
102
102
TIMER_Start ((TIMER_T * ) NU_MODBASE (timer2_modinit .modname ));
103
+
104
+ // Schedule wakeup to match semantics of lp_ticker_get_compare_match()
105
+ lp_ticker_set_interrupt (wakeup_tick );
103
106
}
104
107
105
108
timestamp_t lp_ticker_read ()
Original file line number Diff line number Diff line change @@ -94,11 +94,14 @@ void lp_ticker_init(void)
94
94
TIMER_EnableInt ((TIMER_T * ) NU_MODBASE (timer2_modinit .modname ));
95
95
TIMER_EnableWakeup ((TIMER_T * ) NU_MODBASE (timer2_modinit .modname ));
96
96
97
- // Schedule wakeup to match semantics of lp_ticker_get_compare_match()
98
- lp_ticker_set_interrupt ( wakeup_tick );
97
+ // NOTE: TIMER_Start() first and then lp_ticker_set_interrupt(); otherwise, we may get stuck in lp_ticker_read() because
98
+ // timer is not running.
99
99
100
100
// Start timer
101
101
TIMER_Start ((TIMER_T * ) NU_MODBASE (timer2_modinit .modname ));
102
+
103
+ // Schedule wakeup to match semantics of lp_ticker_get_compare_match()
104
+ lp_ticker_set_interrupt (wakeup_tick );
102
105
}
103
106
104
107
timestamp_t lp_ticker_read ()
You can’t perform that action at this time.
0 commit comments