Watchdog Timer

Fork of mbed-src by mbed official

Revision:
484:b5ae48b573d3
Parent:
481:ca51ab3eed5a
Child:
495:01cb89f68337
--- a/common/us_ticker_api.c	Sat Feb 28 07:15:07 2015 +0000
+++ b/common/us_ticker_api.c	Tue Mar 03 07:15:07 2015 +0000
@@ -117,6 +117,16 @@
     __enable_irq();
 }
 
-timestamp_t us_ticker_get_next_timestamp(void) {
-    return head->timestamp;
+int us_ticker_get_next_timestamp(timestamp_t *timestamp) {
+    int ret = 0;
+
+    /* if head is NULL, there are no pending events */
+    __disable_irq();
+    if (head != NULL) {
+        *timestamp = head->timestamp;
+        ret = 1;
+    }
+    __enable_irq();
+
+    return ret;
 }