mirror of https://github.com/ARMmbed/mbed-os.git
[API] Timer-start behavior (bug)fix
Only start the timer when it is not running currently. In old behavior the current slice-time was discarded, now multiple starts have no effect.pull/552/head
parent
1b833cbd67
commit
0ea849e7ff
|
@ -23,8 +23,10 @@ Timer::Timer() : _running(), _start(), _time() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::start() {
|
void Timer::start() {
|
||||||
|
if (!_running) {
|
||||||
_start = us_ticker_read();
|
_start = us_ticker_read();
|
||||||
_running = 1;
|
_running = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::stop() {
|
void Timer::stop() {
|
||||||
|
|
Loading…
Reference in New Issue