mirror of https://github.com/ARMmbed/mbed-os.git
test-mbed_drivers-ticker: fix ticker cross attach
This commit fixes ticker cross-schedule bug in test_case_2x_callbacks subtest In effect of this bug: ticker_callback_1_switch_to_2 was called only once ticker2 was never been fired because it was repeatedly detached just before fire and attached againpull/5971/head
parent
3c793a714c
commit
dd84c0bc5f
|
@ -69,7 +69,9 @@ void ticker_callback_1_switch_to_2(void)
|
|||
// If ticker is NULL then it is being or has been deleted
|
||||
if (ticker1) {
|
||||
ticker1->detach();
|
||||
ticker1->attach_us(ticker_callback_2_switch_to_1, ONE_MILLI_SEC);
|
||||
}
|
||||
if (ticker2) {
|
||||
ticker2->attach_us(ticker_callback_2_switch_to_1, ONE_MILLI_SEC);
|
||||
}
|
||||
switch_led1_state();
|
||||
}
|
||||
|
@ -80,7 +82,9 @@ void ticker_callback_2_switch_to_1(void)
|
|||
// If ticker is NULL then it is being or has been deleted
|
||||
if (ticker2) {
|
||||
ticker2->detach();
|
||||
ticker2->attach_us(ticker_callback_1_switch_to_2, ONE_MILLI_SEC);
|
||||
}
|
||||
if (ticker1) {
|
||||
ticker1->attach_us(ticker_callback_1_switch_to_2, ONE_MILLI_SEC);
|
||||
}
|
||||
switch_led2_state();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue