Skip to content

Commit c24e121

Browse files
author
埃博拉酱
committed
更新文档注释
1 parent a0a7aee commit c24e121

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,30 +56,25 @@ If you encounter an error similar to `undefined reference to TIMSK` when linking
5656
```C++
5757
//在指定的毫秒数后触发一个计时器中断,调用你的函数。
5858
//Call your function with a timer interrupt after given milliseconds
59-
template <uint8_t TimerCode,
60-
uint16_t AfterMilliseconds,
61-
void (*DoTask)()>
62-
void DoAfter();
59+
template <uint8_t TimerCode, uint16_t AfterMilliseconds>
60+
void DoAfter(void (*DoTask)());
6361
//允许运行时动态设置毫秒数
6462
//Specify milliseconds at runtime
65-
template <uint8_t TimerCode, void (*DoTask)()>
66-
void DoAfter(uint16_t AfterMilliseconds);
63+
template <uint8_t TimerCode>
64+
void DoAfter(uint16_t AfterMilliseconds, void (*DoTask)());
6765

6866
//每隔指定的毫秒数,无限重复调用你的函数。第一次调用也将在那个毫秒数之后发生。
6967
//Repetitively and infinitely call your function with a timer interrupt for each IntervalMilliseconds. The first interrupt happens after IntervalMilliseconds, too.
70-
template <uint8_t TimerCode, uint16_t IntervalMilliseconds, void (*DoTask)()>
71-
void RepeatAfter();
72-
//仅重复有限次数,重复全部结束后触发DoneCallback回调
73-
//Repeat for only RepeatTimes. After all repeats done, DoneCallback is called.
74-
template <uint8_t TimerCode, uint16_t IntervalMilliseconds, void (*DoTask)(), int32_t RepeatTimes, void (*DoneCallback)() = nullptr>
75-
void RepeatAfter();
68+
template <uint8_t TimerCode, uint16_t IntervalMilliseconds, int32_t RepeatTimes = -1, void (*DoneCallback)() = nullptr>
69+
void RepeatAfter(void (*DoTask)())
7670
//允许运行时动态设置毫秒数。重复次数不指定的话则为无限重复。重复全部结束后触发DoneCallback回调
7771
//Specify milliseconds at runtime. After all repeats done, DoneCallback is called.
78-
template <uint8_t TimerCode, void (*DoTask)(), int32_t RepeatTimes, void (*DoneCallback)() = nullptr>
79-
void RepeatAfter(uint16_t IntervalMilliseconds);
80-
//每隔指定毫秒数重复执行任务。重复次数若为负数,或不指定重复次数,则默认无限重复
81-
template <uint8_t TimerCode, uint16_t IntervalMilliseconds, void (*DoTask)(), void (*DoneCallback)() = nullptr>
82-
void RepeatAfter(int32_t RepeatTimes);
72+
template <uint8_t TimerCode, int32_t RepeatTimes = -1, void (*DoneCallback)() = nullptr>
73+
void RepeatAfter(uint16_t IntervalMilliseconds, void (*DoTask)())
74+
//仅重复有限次数,重复全部结束后触发DoneCallback回调
75+
//Repeat for only RepeatTimes. After all repeats done, DoneCallback is called.
76+
template <uint8_t TimerCode, uint16_t IntervalMilliseconds, void (*DoneCallback)() = nullptr>
77+
void RepeatAfter(int32_t RepeatTimes, void (*DoTask)())
8378

8479
//将当前时刻设为0,计量经过的毫秒数。读取MillisecondsElapsed变量来获得经过的毫秒数。可选设置MillisecondsPerTick,控制计时单位是多少毫秒
8580
//Set the time now as 0 and start to record time elapsed. Read MillisecondsElapsed variable to get the time elapsed.
@@ -137,4 +132,12 @@ void Delay(uint16_t DelayMilliseconds);
137132
//Abort all tasks assigned to TimerCode. Other timers won't be affected.
138133
template <uint8_t TimerCode>
139134
void ShutDown();
135+
//暂停指定计时器上的任务
136+
//Pause the task on the specified timer
137+
template <uint8_t TimerCode>
138+
void Pause();
139+
//继续指定计时器上的任务。如果继续一个未处于暂停状态的计时器,将产生未定义行为。
140+
//Continue the task on the specified timer. If you continue a timer that is not in a paused state, undefined behavior occurs.
141+
template <uint8_t TimerCode>
142+
void Continue();
140143
```

keywords.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Datatypes (KEYWORD1)
22

33
# Functions (KEYWORD2)
4-
DoAfter KEYWORD2
4+
DoAfter KEYWORD2
55
RepeatAfter KEYWORD2
66
StartTiming KEYWORD2
77
PlayTone KEYWORD2
88
SquareWave KEYWORD2
99
ShutDown KEYWORD2
10+
Pause KEYWORD2
11+
Continue KEYWORD2
1012
# Structures (KEYWORD3)
1113

1214
# Constants (LITERAL1)

library.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name=TimersOneForAll
2-
version=1.5.1
2+
version=2.0.0
33
author=EbolaChan <[email protected]>
44
maintainer=EbolaChan <[email protected]>
55
sentence=Make full use of all your hardware timers on your Arduino board. 充分利用你开发板上所有的硬件计时器
6-
paragraph=*You must enable C++17 for your IDE. Open "%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt" and change the argument "-std=gnu++11" to -std=gnu++17.* Delayed task, repetitive delayed task, tones, square waves, timing by milliseconds. Hardware interrupt that can break into any running code accurately at the time you set. Specify which hardware timer to use, all with 1/16 microsecond accuracy. Allocate them to different tasks so that they run simultaneously without conflicts. Currently only support timing for less than 1 minute. *您必须为您的 IDE 启用 C++17。打开“%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt”并将参数“-std=gnu++11”更改为-std=gnu++17。* 延迟任务,重复任务,音调,方波,毫秒秒表,可以自由指定互不冲突的独立硬件计时器,硬件中断,事件驱动。
6+
paragraph=(Uno & Mega 2560) *You must enable C++17 for your IDE. Open "%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt" and change the argument "-std=gnu++11" to -std=gnu++17.* Delayed task, repetitive delayed task, tones, square waves, timing by milliseconds. Hardware interrupt that can break into any running code accurately at the time you set. Specify which hardware timer to use, all with 1/16 microsecond accuracy. Allocate them to different tasks so that they run simultaneously without conflicts. Currently only support timing for less than 1 minute. *您必须为您的 IDE 启用 C++17。打开“%LOCALAPPDATA%\Arduino15\packages\arduino\hardware\avr\1.8.3\platform.txt”并将参数“-std=gnu++11”更改为-std=gnu++17。* 延迟任务,重复任务,音调,方波,毫秒秒表,可以自由指定互不冲突的独立硬件计时器,硬件中断,事件驱动。
77
category=Timing
88
url=https://github.com/Silver-Fang/TimersOneForAll
99
architectures=avr

src/Internal/ShutDown.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace TimersOneForAll
2323
Internal::TIMSK<TimerCode> = 0;
2424
Internal::PauseTCNT<TimerCode> = Internal::GetTCNT<TimerCode>();
2525
}
26-
//继续指定计时器上的任务。如果继续一个未处于暂停状态的计时器,将产生未知行为
26+
//继续指定计时器上的任务。如果继续一个未处于暂停状态的计时器,将产生未定义行为
2727
template <uint8_t TimerCode>
2828
void Continue()
2929
{

0 commit comments

Comments
 (0)