mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #5347 from 0xc0170/nxp_fix_lptimer
MCUXpresso: Fix LPTimer issue when using multiple timeout objectspull/5371/head
commit
1566395323
|
|
@ -139,6 +139,11 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
|
|
||||||
/* Checking if LPTRM can handle this sleep */
|
/* Checking if LPTRM can handle this sleep */
|
||||||
delta_ticks = USEC_TO_COUNT(delta_us, CLOCK_GetFreq(kCLOCK_Er32kClk));
|
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) {
|
if (delta_ticks > MAX_LPTMR_SLEEP) {
|
||||||
/* Using RTC if wait time is over 16b (2s @32kHz) */
|
/* Using RTC if wait time is over 16b (2s @32kHz) */
|
||||||
uint32_t delta_sec;
|
uint32_t delta_sec;
|
||||||
|
|
@ -154,6 +159,11 @@ void lp_ticker_set_interrupt(timestamp_t timestamp)
|
||||||
/* Set aditional, subsecond, sleep time */
|
/* Set aditional, subsecond, sleep time */
|
||||||
if (delta_us) {
|
if (delta_us) {
|
||||||
lptmr_schedule = USEC_TO_COUNT(delta_us, CLOCK_GetFreq(kCLOCK_Er32kClk));
|
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 {
|
} else {
|
||||||
/* Below RTC resolution using LPTMR */
|
/* Below RTC resolution using LPTMR */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue