mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Revision:
304:89b9c3a9a045
Parent:
221:8276e3a4886f
Child:
361:56c2a6244bba
--- a/common/us_ticker_api.c	Fri Aug 29 11:45:07 2014 +0100
+++ b/common/us_ticker_api.c	Fri Aug 29 17:15:07 2014 +0100
@@ -45,6 +45,8 @@
             if (event_handler != NULL) {
                 event_handler(p->id); // NOTE: the handler can set new events
             }
+            /* Note: We continue back to examining the head because calling the
+             * event handler may have altered the chain of pending events. */
         } else {
             // This event and the following ones in the list are in the future:
             //      set it as next interrupt and return
@@ -54,7 +56,7 @@
     }
 }
 
-void us_ticker_insert_event(ticker_event_t *obj, unsigned int timestamp, uint32_t id) {
+void us_ticker_insert_event(ticker_event_t *obj, timestamp_t timestamp, uint32_t id) {
     /* disable interrupts for the duration of the function */
     __disable_irq();
 
@@ -95,7 +97,9 @@
     if (head == obj) {
         // first in the list, so just drop me
         head = obj->next;
-        if (obj->next != NULL) {
+        if (head == NULL) {
+            us_ticker_disable_interrupt();
+        } else {
             us_ticker_set_interrupt(head->timestamp);
         }
     } else {