Skip to content

Commit

Permalink
更新文档注释
Browse files Browse the repository at this point in the history
  • Loading branch information
埃博拉酱 committed Dec 22, 2022
1 parent a0a7aee commit c24e121
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,25 @@ If you encounter an error similar to `undefined reference to TIMSK` when linking
```C++
//在指定的毫秒数后触发一个计时器中断,调用你的函数。
//Call your function with a timer interrupt after given milliseconds
template <uint8_t TimerCode,
uint16_t AfterMilliseconds,
void (*DoTask)()>
void DoAfter();
template <uint8_t TimerCode, uint16_t AfterMilliseconds>
void DoAfter(void (*DoTask)());
//允许运行时动态设置毫秒数
//Specify milliseconds at runtime
template <uint8_t TimerCode, void (*DoTask)()>
void DoAfter(uint16_t AfterMilliseconds);
template <uint8_t TimerCode>
void DoAfter(uint16_t AfterMilliseconds, void (*DoTask)());

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

//将当前时刻设为0,计量经过的毫秒数。读取MillisecondsElapsed变量来获得经过的毫秒数。可选设置MillisecondsPerTick,控制计时单位是多少毫秒
//Set the time now as 0 and start to record time elapsed. Read MillisecondsElapsed variable to get the time elapsed.
Expand Down Expand Up @@ -137,4 +132,12 @@ void Delay(uint16_t DelayMilliseconds);
//Abort all tasks assigned to TimerCode. Other timers won't be affected.
template <uint8_t TimerCode>
void ShutDown();
//暂停指定计时器上的任务
//Pause the task on the specified timer
template <uint8_t TimerCode>
void Pause();
//继续指定计时器上的任务。如果继续一个未处于暂停状态的计时器,将产生未定义行为。
//Continue the task on the specified timer. If you continue a timer that is not in a paused state, undefined behavior occurs.
template <uint8_t TimerCode>
void Continue();
```
4 changes: 3 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Datatypes (KEYWORD1)

# Functions (KEYWORD2)
DoAfter KEYWORD2
DoAfter KEYWORD2
RepeatAfter KEYWORD2
StartTiming KEYWORD2
PlayTone KEYWORD2
SquareWave KEYWORD2
ShutDown KEYWORD2
Pause KEYWORD2
Continue KEYWORD2
# Structures (KEYWORD3)

# Constants (LITERAL1)
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=TimersOneForAll
version=1.5.1
version=2.0.0
author=EbolaChan <[email protected]>
maintainer=EbolaChan <[email protected]>
sentence=Make full use of all your hardware timers on your Arduino board. 充分利用你开发板上所有的硬件计时器
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。* 延迟任务,重复任务,音调,方波,毫秒秒表,可以自由指定互不冲突的独立硬件计时器,硬件中断,事件驱动。
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。* 延迟任务,重复任务,音调,方波,毫秒秒表,可以自由指定互不冲突的独立硬件计时器,硬件中断,事件驱动。
category=Timing
url=https://github.com/Silver-Fang/TimersOneForAll
architectures=avr
Expand Down
2 changes: 1 addition & 1 deletion src/Internal/ShutDown.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace TimersOneForAll
Internal::TIMSK<TimerCode> = 0;
Internal::PauseTCNT<TimerCode> = Internal::GetTCNT<TimerCode>();
}
//继续指定计时器上的任务。如果继续一个未处于暂停状态的计时器,将产生未知行为
//继续指定计时器上的任务。如果继续一个未处于暂停状态的计时器,将产生未定义行为
template <uint8_t TimerCode>
void Continue()
{
Expand Down

0 comments on commit c24e121

Please sign in to comment.