mirror of https://github.com/ARMmbed/mbed-os.git
Improved handling of NULL condition.
parent
b53b67ecad
commit
6bc00fda8a
|
@ -117,17 +117,16 @@ void us_ticker_remove_event(ticker_event_t *obj) {
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
timestamp_t us_ticker_get_next_timestamp(void) {
|
int us_ticker_get_next_timestamp(timestamp_t *timestamp) {
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
/* if head is NULL, there are no pending events */
|
||||||
__disable_irq();
|
__disable_irq();
|
||||||
|
if (head != NULL) {
|
||||||
if (head == NULL) {
|
*timestamp = head->timestamp;
|
||||||
__enable_irq();
|
ret = 1;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
timestamp_t next_timestamp = head->timestamp;
|
|
||||||
|
|
||||||
__enable_irq();
|
__enable_irq();
|
||||||
|
|
||||||
return next_timestamp;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void us_ticker_irq_handler(void);
|
||||||
|
|
||||||
void us_ticker_insert_event(ticker_event_t *obj, timestamp_t timestamp, uint32_t id);
|
void us_ticker_insert_event(ticker_event_t *obj, timestamp_t timestamp, uint32_t id);
|
||||||
void us_ticker_remove_event(ticker_event_t *obj);
|
void us_ticker_remove_event(ticker_event_t *obj);
|
||||||
timestamp_t us_ticker_get_next_timestamp(void);
|
int us_ticker_get_next_timestamp(timestamp_t *timestamp);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue