mbed
Fork of mbed-dev by
Diff: hal/mbed_lp_ticker_api.c
- Revision:
- 181:96ed750bd169
- Parent:
- 175:b96e65c34a4d
--- a/hal/mbed_lp_ticker_api.c Thu Dec 07 14:01:42 2017 +0000 +++ b/hal/mbed_lp_ticker_api.c Wed Jan 17 15:23:54 2018 +0000 @@ -19,6 +19,8 @@ static ticker_event_queue_t events = { 0 }; +static ticker_irq_handler_type irq_handler = ticker_irq_handler; + static const ticker_interface_t lp_interface = { .init = lp_ticker_init, .read = lp_ticker_read, @@ -26,6 +28,7 @@ .clear_interrupt = lp_ticker_clear_interrupt, .set_interrupt = lp_ticker_set_interrupt, .fire_interrupt = lp_ticker_fire_interrupt, + .get_info = lp_ticker_get_info, }; static const ticker_data_t lp_data = { @@ -38,9 +41,20 @@ return &lp_data; } +ticker_irq_handler_type set_lp_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 lp_ticker_irq_handler(void) { - ticker_irq_handler(&lp_data); + if (irq_handler) { + irq_handler(&lp_data); + } } #endif