rearranging some code so that state is tidied up before calling us_ticker_set_interrtupt()

pull/932/head
Rohit Grover 2015-02-25 15:31:24 +00:00 committed by Rohit Grover
parent ca9050e1ef
commit f8fd702c09
1 changed files with 4 additions and 2 deletions

View File

@ -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();
}