File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -83,10 +83,15 @@ void us_ticker_clear_interrupt(void)
83
83
84
84
void us_ticker_set_interrupt (timestamp_t timestamp )
85
85
{
86
+ uint32_t now_us , delta_us ;
87
+
88
+ now_us = us_ticker_read ();
89
+ delta_us = timestamp >= now_us ? timestamp - now_us : (uint32_t )((uint64_t )timestamp + 0xFFFFFFFF - now_us );
90
+
86
91
uint32_t delta = timestamp - us_ticker_read ();
87
92
PIT_StopTimer (PIT , kPIT_Chnl_3 );
88
93
PIT_StopTimer (PIT , kPIT_Chnl_2 );
89
- PIT_SetTimerPeriod (PIT , kPIT_Chnl_3 , (uint32_t )delta );
94
+ PIT_SetTimerPeriod (PIT , kPIT_Chnl_3 , (uint32_t )delta_us );
90
95
PIT_EnableInterrupts (PIT , kPIT_Chnl_3 , kPIT_TimerInterruptEnable );
91
96
PIT_StartTimer (PIT , kPIT_Chnl_3 );
92
97
PIT_StartTimer (PIT , kPIT_Chnl_2 );
Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
135
135
136
136
lptmr_schedule = 0 ;
137
137
now_us = lp_ticker_read ();
138
- delta_us = timestamp > now_us ? timestamp - now_us : (uint32_t )((uint64_t )timestamp + 0xFFFFFFFF - now_us );
138
+ delta_us = timestamp >= now_us ? timestamp - now_us : (uint32_t )((uint64_t )timestamp + 0xFFFFFFFF - now_us );
139
139
140
140
/* Checking if LPTRM can handle this sleep */
141
141
delta_ticks = USEC_TO_COUNT (delta_us , CLOCK_GetFreq (kCLOCK_Er32kClk ));
You can’t perform that action at this time.
0 commit comments