Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NUCLEO-F030R8_ExtXtalTest
Fork of mbed-src by
Diff: common/us_ticker_api.c
- Revision:
- 221:8276e3a4886f
- Parent:
- 9:0ce32e54c9a7
- Child:
- 304:89b9c3a9a045
diff -r aa774fb95d17 -r 8276e3a4886f common/us_ticker_api.c
--- 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();
}
