Modified for BG96

Fork of mbed-dev by mbed official

Revision:
180:96ed750bd169
Parent:
174:b96e65c34a4d
Child:
187:0387e8f68319
--- a/hal/mbed_us_ticker_api.c	Thu Dec 07 14:01:42 2017 +0000
+++ b/hal/mbed_us_ticker_api.c	Wed Jan 17 15:23:54 2018 +0000
@@ -17,6 +17,8 @@
 
 static ticker_event_queue_t events = { 0 };
 
+static ticker_irq_handler_type irq_handler = ticker_irq_handler;
+
 static const ticker_interface_t us_interface = {
     .init = us_ticker_init,
     .read = us_ticker_read,
@@ -24,6 +26,7 @@
     .clear_interrupt = us_ticker_clear_interrupt,
     .set_interrupt = us_ticker_set_interrupt,
     .fire_interrupt = us_ticker_fire_interrupt,
+    .get_info = us_ticker_get_info,
 };
 
 static const ticker_data_t us_data = {
@@ -36,7 +39,18 @@
     return &us_data;
 }
 
+ticker_irq_handler_type set_us_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler)
+{
+    ticker_irq_handler_type prev_irq_handler = irq_handler;
+
+    irq_handler = ticker_irq_handler;
+
+    return prev_irq_handler;
+}
+
 void us_ticker_irq_handler(void)
 {
-    ticker_irq_handler(&us_data);
+    if (irq_handler) {
+        irq_handler(&us_data);
+    }
 }