Allow lp_ticker test to coexist with TimerEvents

The lp_ticker test overrides the default ticker handler for the
low power ticker. This stops all other low power TimerEvents in the
system, including the ones for tickless, from getting called. Because
of this devices with tickless enabled malfunction during this test.

This patch fixes this problem by passing all lp ticker events it did
not trigger on to the TimerEvent irq handler.
pull/5063/head
Russ Butler 2017-09-10 17:06:46 -05:00
parent acf428200f
commit f746fc5bac
1 changed files with 15 additions and 4 deletions

View File

@ -25,6 +25,7 @@
#include "mbed.h"
#include "us_ticker_api.h"
#include "lp_ticker_api.h"
#include "TimerEvent.h"
using namespace utest::v1;
@ -39,13 +40,23 @@ static const ticker_data_t *lp_ticker_data = get_lp_ticker_data();
#define SHORT_TIMEOUT (600)
void cb_done(uint32_t id) {
complete_timestamp = us_ticker_read();
complete = true;
if ((uint32_t)&delay_event == id) {
complete_timestamp = us_ticker_read();
complete = true;
} else {
// Normal ticker handling
TimerEvent::irq(id);
}
}
void cb_done_deepsleep(uint32_t id) {
complete_timestamp = lp_ticker_read();
complete = true;
if ((uint32_t)&delay_event == id) {
complete_timestamp = lp_ticker_read();
complete = true;
} else {
// Normal ticker handling
TimerEvent::irq(id);
}
}
void lp_ticker_delay_us(uint32_t delay_us, uint32_t tolerance)