mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Revision:
177:d650f5d4c87a
Parent:
174:b96e65c34a4d
Child:
182:a56a73fd2a6f
--- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c	Wed Oct 25 14:53:38 2017 +0100
+++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/lp_ticker.c	Wed Nov 08 13:50:44 2017 +0000
@@ -139,6 +139,11 @@
 
     /* 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;
@@ -154,6 +159,11 @@
         /* 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 */