From f8fd702c09bf745af236307403a1df5b394ae714 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Wed, 25 Feb 2015 15:31:24 +0000 Subject: [PATCH] rearranging some code so that state is tidied up before calling us_ticker_set_interrtupt() --- libraries/mbed/common/us_ticker_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libraries/mbed/common/us_ticker_api.c b/libraries/mbed/common/us_ticker_api.c index 716e78103a..659a04f487 100644 --- a/libraries/mbed/common/us_ticker_api.c +++ b/libraries/mbed/common/us_ticker_api.c @@ -77,6 +77,10 @@ void us_ticker_insert_event(ticker_event_t *obj, timestamp_t timestamp, uint32_t prev = p; p = p->next; } + + /* if we're at the end p will be NULL, which is correct */ + obj->next = p; + /* if prev is NULL we're at the head */ if (prev == NULL) { head = obj; @@ -84,8 +88,6 @@ void us_ticker_insert_event(ticker_event_t *obj, timestamp_t timestamp, uint32_t } else { prev->next = obj; } - /* if we're at the end p will be NULL, which is correct */ - obj->next = p; __enable_irq(); }