Skip to content

Commit f746fc5

Browse files
committed
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.
1 parent acf4282 commit f746fc5

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

TESTS/mbed_hal/lp_ticker/main.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "mbed.h"
2626
#include "us_ticker_api.h"
2727
#include "lp_ticker_api.h"
28+
#include "TimerEvent.h"
2829

2930
using namespace utest::v1;
3031

@@ -39,13 +40,23 @@ static const ticker_data_t *lp_ticker_data = get_lp_ticker_data();
3940
#define SHORT_TIMEOUT (600)
4041

4142
void cb_done(uint32_t id) {
42-
complete_timestamp = us_ticker_read();
43-
complete = true;
43+
if ((uint32_t)&delay_event == id) {
44+
complete_timestamp = us_ticker_read();
45+
complete = true;
46+
} else {
47+
// Normal ticker handling
48+
TimerEvent::irq(id);
49+
}
4450
}
4551

4652
void cb_done_deepsleep(uint32_t id) {
47-
complete_timestamp = lp_ticker_read();
48-
complete = true;
53+
if ((uint32_t)&delay_event == id) {
54+
complete_timestamp = lp_ticker_read();
55+
complete = true;
56+
} else {
57+
// Normal ticker handling
58+
TimerEvent::irq(id);
59+
}
4960
}
5061

5162
void lp_ticker_delay_us(uint32_t delay_us, uint32_t tolerance)

0 commit comments

Comments
 (0)