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.
Diff: common/us_ticker_api.c
- Revision:
- 221:8276e3a4886f
- Parent:
- 9:0ce32e54c9a7
- Child:
- 304:89b9c3a9a045
--- a/common/us_ticker_api.c Tue Jun 03 10:30:56 2014 +0100 +++ b/common/us_ticker_api.c Tue Jun 03 11:30:07 2014 +0100 @@ -22,13 +22,13 @@ void us_ticker_set_handler(ticker_event_handler handler) { us_ticker_init(); - + event_handler = handler; } void us_ticker_irq_handler(void) { us_ticker_clear_interrupt(); - + /* Go through all the pending TimerEvents */ while (1) { if (head == NULL) { @@ -36,7 +36,7 @@ us_ticker_disable_interrupt(); return; } - + if ((int)(head->timestamp - us_ticker_read()) <= 0) { // This event was in the past: // point to the following one and execute its handler @@ -57,11 +57,11 @@ void us_ticker_insert_event(ticker_event_t *obj, unsigned int timestamp, uint32_t id) { /* disable interrupts for the duration of the function */ __disable_irq(); - + // initialise our data obj->timestamp = timestamp; obj->id = id; - + /* Go through the list until we either reach the end, or find an element this should come before (which is possibly the head). */ @@ -84,13 +84,13 @@ } /* if we're at the end p will be NULL, which is correct */ obj->next = p; - + __enable_irq(); } void us_ticker_remove_event(ticker_event_t *obj) { __disable_irq(); - + // remove this object from the list if (head == obj) { // first in the list, so just drop me @@ -109,6 +109,6 @@ p = p->next; } } - + __enable_irq(); }