-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa92b2f
commit 6178d69
Showing
5 changed files
with
16 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
#pragma once | ||
#include "Kernel.h" | ||
namespace TimersOneForAll | ||
{ | ||
{ | ||
//设为false可以暂停计时,重新设为true可继续计时 | ||
template <uint8_t TimerCode> | ||
static volatile bool Running; | ||
namespace Internal | ||
{ | ||
{ | ||
template <uint8_t TimerCode> | ||
void MEAdd() | ||
{ | ||
MillisecondsElapsed<TimerCode> ++; | ||
if (Running<TimerCode>) | ||
MillisecondsElapsed<TimerCode> ++; | ||
} | ||
} | ||
//设置当前为零时刻进行计时。从MillisecondsElapsed变量读取经过的毫秒数 | ||
template <uint8_t TimerCode> | ||
void StartTiming() | ||
{ | ||
MillisecondsElapsed<TimerCode> = 0; | ||
RepeatAfter<TimerCode, 1, Internal::MEAdd<TimerCode>>(); | ||
MillisecondsElapsed<TimerCode> = 0; | ||
Running<TimerCode> = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters