Skip to content

MCUXpresso: Fix LPTimer issue when using multiple timeout objects #5314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)

/* Checking if LPTRM can handle this sleep */
delta_ticks = USEC_TO_COUNT(delta_us, CLOCK_GetFreq(kCLOCK_Er32kClk));
if (delta_ticks == 0) {
/* The requested delay is less than the minimum resolution of this counter */
delta_ticks = 1;
}

if (delta_ticks > MAX_LPTMR_SLEEP) {
/* Using RTC if wait time is over 16b (2s @32kHz) */
uint32_t delta_sec;
Expand All @@ -154,6 +159,11 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
/* Set aditional, subsecond, sleep time */
if (delta_us) {
lptmr_schedule = USEC_TO_COUNT(delta_us, CLOCK_GetFreq(kCLOCK_Er32kClk));
if (lptmr_schedule == 0) {
/* The requested delay is less than the minimum resolution of this counter */
lptmr_schedule = 1;
}

}
} else {
/* Below RTC resolution using LPTMR */
Expand Down